]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/mothra/mothra.h
mothra: <base> tag, nstrcpy
[plan9front.git] / sys / src / cmd / mothra / mothra.h
1 enum{
2         NWWW=64,        /* # of pages we hold in the log */
3         NXPROC=5,       /* # of parallel procs loading the pix */
4         NPIXMB=8,       /* megabytes of image data to keep arround */
5         NNAME=512,
6         NLINE=256,
7         NAUTH=128,
8         NTITLE=81,      /* length of title (including nul at end) */
9         NLABEL=50,      /* length of option name in forms */
10         NREDIR=10,      /* # of redirections we'll tolerate before declaring a loop */
11 };
12
13 typedef struct Action Action;
14 typedef struct Url Url;
15 typedef struct Www Www;
16 typedef struct Field Field;
17 struct Action{
18         char *image;
19         Field *field;
20         char *link;
21         char *name;
22         int ismap;
23         int width;
24         int height;
25 };
26 struct Url{
27         char fullname[NNAME];
28         char basename[NNAME];
29         char reltext[NNAME];
30         char tag[NNAME];
31         int map;                /* is this an image map? */
32 };
33 struct Www{
34         Url *url;
35         void *pix;
36         void *form;
37         char title[NTITLE];
38         Rtext *text;
39         int yoffs;
40         int changed;            /* reader sets this every time it updates page */
41         int finished;           /* reader sets this when done */
42         int alldone;            /* page will not change further -- used to adjust cursor */
43 };
44
45 enum{
46         PLAIN,
47         HTML,
48
49         GIF,
50         JPEG,
51         PNG,
52         BMP,
53         ICO,
54
55         GUNZIP,
56         COMPRESS,
57         PAGE,
58 };
59
60 /*
61  *  authentication types
62  */
63 enum{
64         ANONE,
65         ABASIC,
66 };
67
68 Image *hrule, *bullet, *linespace;
69 char home[512];         /* where to put files */
70 int chrwidth;           /* nominal width of characters in font */
71 Panel *text;            /* Panel displaying the current www page */
72 int debug;              /* command line flag */
73
74 /*
75  * HTTP methods
76  */
77 enum{
78         GET=1,
79         POST,
80 };
81
82 void update(Www *w);
83 void finish(Www *w);
84 void plrdhtml(char *, int, Www *);
85 void plrdplain(char *, int, Www *);
86 void htmlerror(char *, int, char *, ...);       /* user-supplied routine */
87 void seturl(Url *, char *, char *);
88 void getpix(Rtext *, Www *);
89 ulong countpix(void *p);
90 void freepix(void *p);
91 int pipeline(char *, int);
92 int urlopen(Url *, int, char *);
93 void getfonts(void);
94 void *emalloc(int);
95 void *emallocz(int, int);
96 void nstrcpy(char *to, char *from, int len);
97 void freeform(void *p);
98 void message(char *, ...);
99 int snooptype(int fd);
100 void mkfieldpanel(Rtext *);
101 void geturl(char *, int, char *, int, int);
102 char version[];