
#define	READ_SIZE	2048

#define	HEAD	0
#define	GET	1
#define	POST	2
#define	GETNEW	3

/* Codes for the child to ask the parent to ask the browser to do... */
#define	R_ERROR		0	/* browser->msg_error */
#define	R_STATUS	1	/* browser->msg_status */
#define	R_ALERT		2	/* browser->alert_box */
#define	R_CLEAR		3	/* browser->clear_cache */
#define	R_REDIR		4	/* browser->new_url */
#define	R_PROMPT	5	/* browser->ask_user */
#define	R_ONLINE	6	/* browser->online */

/* weblib.c */
extern struct Args {
	char *Aurl;
	union {
		char *xAfile;
		unsigned long *xAsize;
	} Afs;
	union {
		char *xAcont;
		unsigned long *xAtime;
		char *xAsubj;
	} Acts;
	char *Atype;
#define	Afile	Afs.xAfile
#define	Asize	Afs.xAsize
#define	Acont	Acts.xAcont
#define	Atime	Acts.xAtime
#define	Asubj	Acts.xAsubj
} Args;

extern char     gbuf[];
extern FILE *fp;
extern char *debug, *gzip;
extern const char *reqs[], *days[], *monthtab[];
extern urlB proxyHosts[];

typedef enum {Creject, Cprompt, Cserver, Caccept} CookieFlag;
extern CookieFlag cookieFlag;

/* domail.c */
extern char username[];

/* hostinfo.c */
extern service urltypes[];

/* network.c */
struct sockB;
extern struct sockB *Conn;
extern char *agent;

/* init.c */
extern char   **proxies;
extern char     cab_version[];
extern browser_info_t *browser;
extern long child;

/* version.c */
extern const char version[], date[], when[];
extern const long version_bcd;

long 
readline(int zeroit, struct sockB *host, char *buf, int limit);
long
_get_url(char *url, int req, void *ptr1, void *ptr2, void *ptr3);
long 
make_unix_time(char *s);

long ___CDECL 
get_url_info(char *url, long *timep, long *sizep, char *type);
long ___CDECL 
get_url(char *url, char *filename);
long ___CDECL 
post(char *url, char *content, char *enctype, char *filename);
long ___CDECL
mailto(char *url, char *subject, char *filename);
long ___CDECL
get_if_newer(char *url, char *filename, long *time);

#define	LOG(x)	if (debug) printf x

int 
no_proxy(struct urlB *s);

typedef long (protoT)();

protoT doftp, dohttp, dowais, dogopher, donntp, dofail,	domail, donews;

urlB *processUrl(char *url);
