~ft/gemnine

gemnine/gemnine.h -rw-r--r-- 1.1 KiB
456b7098 — Sigrid Solveig Haflínudóttir dump raw to stdout if not /dev/cons 1 year, 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
enum {
	Cinput = 10,
	Cinputnoecho = 11,
	Csuccess = 20,
	Credirtmp = 30,
	Credirperm = 31,
	Cfailtmp = 40,
	Cunavail = 41,
	Ccgierr = 42,
	Cproxyerr = 43,
	Cslowdown = 44,
	Cfailperm = 50,
	Cnotfound = 51,
	Cgone = 52,
	Cnoproxy = 53,
	Cbadrequest = 59,
	Ccertrequired = 60,
	Ccertnotauth = 61,
	Ccertinvalid = 62,
};

typedef struct Response Response;
typedef struct Url Url;

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

struct Url {
	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*

/* req.c */
Response *request(Url *url);
void freeresponse(Response *r);

/* 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);

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