shithub: castor9

ref: 22f34a315b71fdeb2ac90b79f134e11b3052f07a
dir: /castor.h/

View raw version
typedef struct Url Url;

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;

#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);
int strbeg(char* str, char *prefix);
char *replace_char(char *s, char f, char r);

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