xref: /csrg-svn/usr.bin/ftp/ftp_var.h (revision 33737)
121741Sdist /*
226049Sminshall  * Copyright (c) 1985 Regents of the University of California.
3*33737Sbostic  * All rights reserved.
421741Sdist  *
5*33737Sbostic  * Redistribution and use in source and binary forms are permitted
6*33737Sbostic  * provided that this notice is preserved and that due credit is given
7*33737Sbostic  * to the University of California at Berkeley. The name of the University
8*33737Sbostic  * may not be used to endorse or promote products derived from this
9*33737Sbostic  * software without specific prior written permission. This software
10*33737Sbostic  * is provided ``as is'' without express or implied warranty.
11*33737Sbostic  *
12*33737Sbostic  *	@(#)ftp_var.h	5.4 (Berkeley) 03/14/88
1321741Sdist  */
1410298Ssam 
1510298Ssam /*
1610298Ssam  * FTP global variables.
1710298Ssam  */
1810298Ssam 
1910298Ssam /*
2010298Ssam  * Options and other state info.
2110298Ssam  */
2210298Ssam int	trace;			/* trace packets exchanged */
2311652Ssam int	hash;			/* print # for each buffer transferred */
2411652Ssam int	sendport;		/* use PORT cmd for each data connection */
2510298Ssam int	verbose;		/* print messages coming back from server */
2610298Ssam int	connected;		/* connected to server */
2710298Ssam int	fromatty;		/* input is from a terminal */
2810298Ssam int	interactive;		/* interactively prompt on m* cmds */
2910298Ssam int	debug;			/* debugging level */
3010298Ssam int	bell;			/* ring bell on cmd completion */
3111349Ssam int	doglob;			/* glob local file names */
3210298Ssam int	autologin;		/* establish user account on connection */
3326049Sminshall int	proxy;			/* proxy server connection active */
3426049Sminshall int	proxflag;		/* proxy connection exists */
3526049Sminshall int	sunique;		/* store files on server with unique name */
3626049Sminshall int	runique;		/* store local files with unique name */
3726049Sminshall int	mcase;			/* map upper to lower case for mget names */
3826049Sminshall int	ntflag;			/* use ntin ntout tables for name translation */
3926049Sminshall int	mapflag;		/* use mapin mapout templates on file names */
4026049Sminshall int	code;			/* return/reply code for ftp command */
4126049Sminshall int	crflag;			/* if 1, strip car. rets. on ascii gets */
4226049Sminshall char	pasv[64];		/* passive port for proxy data connection */
4326049Sminshall char	*altarg;		/* argv[1] with no shell-like preprocessing  */
4426049Sminshall char	ntin[17];		/* input translation table */
4526049Sminshall char	ntout[17];		/* output translation table */
4626049Sminshall #include <sys/param.h>
4726049Sminshall char	mapin[MAXPATHLEN];	/* input map template */
4826049Sminshall char	mapout[MAXPATHLEN];	/* output map template */
4910298Ssam char	typename[32];		/* name of file transfer type */
5010298Ssam int	type;			/* file transfer type */
5110298Ssam char	structname[32];		/* name of file transfer structure */
5210298Ssam int	stru;			/* file transfer structure */
5310298Ssam char	formname[32];		/* name of file transfer format */
5410298Ssam int	form;			/* file transfer format */
5510298Ssam char	modename[32];		/* name of file transfer mode */
5610298Ssam int	mode;			/* file transfer mode */
5711220Ssam char	bytename[32];		/* local byte size in ascii */
5811220Ssam int	bytesize;		/* local byte size in binary */
5910298Ssam 
6010298Ssam char	*hostname;		/* name of host connected to */
6110298Ssam 
6210298Ssam struct	servent *sp;		/* service spec for tcp/ftp */
6310298Ssam 
6410298Ssam #include <setjmp.h>
6510298Ssam jmp_buf	toplevel;		/* non-local goto stuff for cmd scanner */
6610298Ssam 
6710298Ssam char	line[200];		/* input line buffer */
6810298Ssam char	*stringbase;		/* current scan point in line buffer */
6910298Ssam char	argbuf[200];		/* argument storage buffer */
7010298Ssam char	*argbase;		/* current storage point in arg buffer */
7110298Ssam int	margc;			/* count of arguments on input line */
7210298Ssam char	*margv[20];		/* args parsed from input line */
7326049Sminshall int     cpend;                  /* flag: if != 0, then pending server reply */
7426049Sminshall int	mflag;			/* flag: if != 0, then active multi command */
7510298Ssam 
7610298Ssam int	options;		/* used during socket creation */
7710298Ssam 
7810298Ssam /*
7910298Ssam  * Format of command table.
8010298Ssam  */
8110298Ssam struct cmd {
8210298Ssam 	char	*c_name;	/* name of command */
8310298Ssam 	char	*c_help;	/* help string */
8410298Ssam 	char	c_bell;		/* give bell when command completes */
8511652Ssam 	char	c_conn;		/* must be connected to use command */
8626049Sminshall 	char	c_proxy;	/* proxy server may execute */
8710298Ssam 	int	(*c_handler)();	/* function to call */
8810298Ssam };
8910298Ssam 
9026049Sminshall struct macel {
9126049Sminshall 	char mac_name[9];	/* macro name */
9226049Sminshall 	char *mac_start;	/* start of macro in macbuf */
9326049Sminshall 	char *mac_end;		/* end of macro in macbuf */
9426049Sminshall };
9526049Sminshall 
9626049Sminshall int macnum;			/* number of defined macros */
9726497Sminshall struct macel macros[16];
9826049Sminshall char macbuf[4096];
9926049Sminshall 
10010298Ssam extern	char *tail();
10110298Ssam extern	char *index();
10210298Ssam extern	char *rindex();
10311652Ssam extern	char *remglob();
10410298Ssam extern	int errno;
10526497Sminshall extern	char *mktemp();
10626497Sminshall extern	char *strncpy();
10726497Sminshall extern	char *strncat();
10826497Sminshall extern	char *strcat();
10926497Sminshall extern	char *strcpy();
110