shithub: castor9

ref: dfc5c880042c1c61b88a2f3f2eaf344e8fe88684
dir: /castor.h/

View raw version
typedef struct Ctx Ctx;
typedef struct Hist Hist;
typedef struct Url Url;
typedef struct Response Response;

struct Url {
	char *raw;
	char *full;
	char *scheme;
	char *user;
	char *pass;
	char *host;
	char *port;
	char *path;
	char *query;
	char *fragment;
	int free;
};

typedef struct {
	char *s1;
	char *s2;
}Str2;

struct Response {
	Url *url;
	char *meta;
	int status;
	int fd;
};

struct Ctx
{
	Url		*url;
	Rtext	*text;
};

struct Hist
{
	Hist *p;
	Hist *n;
	Ctx *c;
};

#pragma varargck type "U" Url*
#pragma varargck type "E" Str2
#pragma varargck type "N" char*
#pragma varargck type "]" char*

/* util.c */
void *emalloc(int n);
char *estrdup(char *s);

/* url.c */
int	Efmt(Fmt*);
int	Nfmt(Fmt*);
int	Mfmt(Fmt*);
int Ufmt(Fmt *f);
Url *urlparse(Url *from, char *s);
int matchurl(Url *u, Url *s);
void freeurl(Url *u);
char *Upath(Url *u);

int request(Url *u);
void gemini_get(Url *u);
void texthit(Panel *p, int b, Rtext *t);
void message(char *s, ...);