xref: /csrg-svn/usr.bin/ftp/ftp_var.h (revision 62012)
121741Sdist /*
2*62012Sbostic  * Copyright (c) 1985, 1989, 1993
3*62012Sbostic  *	The Regents of the University of California.  All rights reserved.
421741Sdist  *
542665Sbostic  * %sccs.include.redist.c%
633737Sbostic  *
7*62012Sbostic  *	@(#)ftp_var.h	8.1 (Berkeley) 06/06/93
821741Sdist  */
910298Ssam 
1010298Ssam /*
1110298Ssam  * FTP global variables.
1210298Ssam  */
1310298Ssam 
1410298Ssam /*
1510298Ssam  * Options and other state info.
1610298Ssam  */
1710298Ssam int	trace;			/* trace packets exchanged */
1811652Ssam int	hash;			/* print # for each buffer transferred */
1911652Ssam int	sendport;		/* use PORT cmd for each data connection */
2010298Ssam int	verbose;		/* print messages coming back from server */
2110298Ssam int	connected;		/* connected to server */
2210298Ssam int	fromatty;		/* input is from a terminal */
2310298Ssam int	interactive;		/* interactively prompt on m* cmds */
2410298Ssam int	debug;			/* debugging level */
2510298Ssam int	bell;			/* ring bell on cmd completion */
2611349Ssam int	doglob;			/* glob local file names */
2710298Ssam int	autologin;		/* establish user account on connection */
2826049Sminshall int	proxy;			/* proxy server connection active */
2926049Sminshall int	proxflag;		/* proxy connection exists */
3026049Sminshall int	sunique;		/* store files on server with unique name */
3126049Sminshall int	runique;		/* store local files with unique name */
3226049Sminshall int	mcase;			/* map upper to lower case for mget names */
3326049Sminshall int	ntflag;			/* use ntin ntout tables for name translation */
3426049Sminshall int	mapflag;		/* use mapin mapout templates on file names */
3526049Sminshall int	code;			/* return/reply code for ftp command */
3626049Sminshall int	crflag;			/* if 1, strip car. rets. on ascii gets */
3726049Sminshall char	pasv[64];		/* passive port for proxy data connection */
3826049Sminshall char	*altarg;		/* argv[1] with no shell-like preprocessing  */
3926049Sminshall char	ntin[17];		/* input translation table */
4026049Sminshall char	ntout[17];		/* output translation table */
4126049Sminshall #include <sys/param.h>
4226049Sminshall char	mapin[MAXPATHLEN];	/* input map template */
4326049Sminshall char	mapout[MAXPATHLEN];	/* output map template */
4410298Ssam char	typename[32];		/* name of file transfer type */
4538033Skarels int	type;			/* requested file transfer type */
4638033Skarels int	curtype;		/* current file transfer type */
4710298Ssam char	structname[32];		/* name of file transfer structure */
4810298Ssam int	stru;			/* file transfer structure */
4910298Ssam char	formname[32];		/* name of file transfer format */
5010298Ssam int	form;			/* file transfer format */
5110298Ssam char	modename[32];		/* name of file transfer mode */
5210298Ssam int	mode;			/* file transfer mode */
5311220Ssam char	bytename[32];		/* local byte size in ascii */
5411220Ssam int	bytesize;		/* local byte size in binary */
5510298Ssam 
5610298Ssam char	*hostname;		/* name of host connected to */
5738033Skarels int	unix_server;		/* server is unix, can use binary for ascii */
5838033Skarels int	unix_proxy;		/* proxy is unix, can use binary for ascii */
5910298Ssam 
6010298Ssam struct	servent *sp;		/* service spec for tcp/ftp */
6110298Ssam 
6210298Ssam #include <setjmp.h>
6310298Ssam jmp_buf	toplevel;		/* non-local goto stuff for cmd scanner */
6410298Ssam 
6510298Ssam char	line[200];		/* input line buffer */
6610298Ssam char	*stringbase;		/* current scan point in line buffer */
6710298Ssam char	argbuf[200];		/* argument storage buffer */
6810298Ssam char	*argbase;		/* current storage point in arg buffer */
6910298Ssam int	margc;			/* count of arguments on input line */
7010298Ssam char	*margv[20];		/* args parsed from input line */
7126049Sminshall int     cpend;                  /* flag: if != 0, then pending server reply */
7226049Sminshall int	mflag;			/* flag: if != 0, then active multi command */
7310298Ssam 
7410298Ssam int	options;		/* used during socket creation */
7510298Ssam 
7610298Ssam /*
7710298Ssam  * Format of command table.
7810298Ssam  */
7910298Ssam struct cmd {
8010298Ssam 	char	*c_name;	/* name of command */
8110298Ssam 	char	*c_help;	/* help string */
8210298Ssam 	char	c_bell;		/* give bell when command completes */
8311652Ssam 	char	c_conn;		/* must be connected to use command */
8426049Sminshall 	char	c_proxy;	/* proxy server may execute */
8510298Ssam 	int	(*c_handler)();	/* function to call */
8610298Ssam };
8710298Ssam 
8826049Sminshall struct macel {
8926049Sminshall 	char mac_name[9];	/* macro name */
9026049Sminshall 	char *mac_start;	/* start of macro in macbuf */
9126049Sminshall 	char *mac_end;		/* end of macro in macbuf */
9226049Sminshall };
9326049Sminshall 
9426049Sminshall int macnum;			/* number of defined macros */
9526497Sminshall struct macel macros[16];
9626049Sminshall char macbuf[4096];
9726049Sminshall 
9810298Ssam extern	char *tail();
9910298Ssam extern	char *index();
10010298Ssam extern	char *rindex();
10111652Ssam extern	char *remglob();
10210298Ssam extern	int errno;
10326497Sminshall extern	char *mktemp();
10426497Sminshall extern	char *strncpy();
10526497Sminshall extern	char *strncat();
10626497Sminshall extern	char *strcat();
10726497Sminshall extern	char *strcpy();
108