xref: /csrg-svn/usr.bin/ftp/ftp_var.h (revision 38033)
121741Sdist /*
2*38033Skarels  * Copyright (c) 1985, 1989 Regents of the University of California.
333737Sbostic  * All rights reserved.
421741Sdist  *
533737Sbostic  * Redistribution and use in source and binary forms are permitted
634901Sbostic  * provided that the above copyright notice and this paragraph are
734901Sbostic  * duplicated in all such forms and that any documentation,
834901Sbostic  * advertising materials, and other materials related to such
934901Sbostic  * distribution and use acknowledge that the software was developed
1034901Sbostic  * by the University of California, Berkeley.  The name of the
1134901Sbostic  * University may not be used to endorse or promote products derived
1234901Sbostic  * from this software without specific prior written permission.
1334901Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
1434901Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
1534901Sbostic  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
1633737Sbostic  *
17*38033Skarels  *	@(#)ftp_var.h	5.6 (Berkeley) 05/17/89
1821741Sdist  */
1910298Ssam 
2010298Ssam /*
2110298Ssam  * FTP global variables.
2210298Ssam  */
2310298Ssam 
2410298Ssam /*
2510298Ssam  * Options and other state info.
2610298Ssam  */
2710298Ssam int	trace;			/* trace packets exchanged */
2811652Ssam int	hash;			/* print # for each buffer transferred */
2911652Ssam int	sendport;		/* use PORT cmd for each data connection */
3010298Ssam int	verbose;		/* print messages coming back from server */
3110298Ssam int	connected;		/* connected to server */
3210298Ssam int	fromatty;		/* input is from a terminal */
3310298Ssam int	interactive;		/* interactively prompt on m* cmds */
3410298Ssam int	debug;			/* debugging level */
3510298Ssam int	bell;			/* ring bell on cmd completion */
3611349Ssam int	doglob;			/* glob local file names */
3710298Ssam int	autologin;		/* establish user account on connection */
3826049Sminshall int	proxy;			/* proxy server connection active */
3926049Sminshall int	proxflag;		/* proxy connection exists */
4026049Sminshall int	sunique;		/* store files on server with unique name */
4126049Sminshall int	runique;		/* store local files with unique name */
4226049Sminshall int	mcase;			/* map upper to lower case for mget names */
4326049Sminshall int	ntflag;			/* use ntin ntout tables for name translation */
4426049Sminshall int	mapflag;		/* use mapin mapout templates on file names */
4526049Sminshall int	code;			/* return/reply code for ftp command */
4626049Sminshall int	crflag;			/* if 1, strip car. rets. on ascii gets */
4726049Sminshall char	pasv[64];		/* passive port for proxy data connection */
4826049Sminshall char	*altarg;		/* argv[1] with no shell-like preprocessing  */
4926049Sminshall char	ntin[17];		/* input translation table */
5026049Sminshall char	ntout[17];		/* output translation table */
5126049Sminshall #include <sys/param.h>
5226049Sminshall char	mapin[MAXPATHLEN];	/* input map template */
5326049Sminshall char	mapout[MAXPATHLEN];	/* output map template */
5410298Ssam char	typename[32];		/* name of file transfer type */
55*38033Skarels int	type;			/* requested file transfer type */
56*38033Skarels int	curtype;		/* current file transfer type */
5710298Ssam char	structname[32];		/* name of file transfer structure */
5810298Ssam int	stru;			/* file transfer structure */
5910298Ssam char	formname[32];		/* name of file transfer format */
6010298Ssam int	form;			/* file transfer format */
6110298Ssam char	modename[32];		/* name of file transfer mode */
6210298Ssam int	mode;			/* file transfer mode */
6311220Ssam char	bytename[32];		/* local byte size in ascii */
6411220Ssam int	bytesize;		/* local byte size in binary */
6510298Ssam 
6610298Ssam char	*hostname;		/* name of host connected to */
67*38033Skarels int	unix_server;		/* server is unix, can use binary for ascii */
68*38033Skarels int	unix_proxy;		/* proxy is unix, can use binary for ascii */
6910298Ssam 
7010298Ssam struct	servent *sp;		/* service spec for tcp/ftp */
7110298Ssam 
7210298Ssam #include <setjmp.h>
7310298Ssam jmp_buf	toplevel;		/* non-local goto stuff for cmd scanner */
7410298Ssam 
7510298Ssam char	line[200];		/* input line buffer */
7610298Ssam char	*stringbase;		/* current scan point in line buffer */
7710298Ssam char	argbuf[200];		/* argument storage buffer */
7810298Ssam char	*argbase;		/* current storage point in arg buffer */
7910298Ssam int	margc;			/* count of arguments on input line */
8010298Ssam char	*margv[20];		/* args parsed from input line */
8126049Sminshall int     cpend;                  /* flag: if != 0, then pending server reply */
8226049Sminshall int	mflag;			/* flag: if != 0, then active multi command */
8310298Ssam 
8410298Ssam int	options;		/* used during socket creation */
8510298Ssam 
8610298Ssam /*
8710298Ssam  * Format of command table.
8810298Ssam  */
8910298Ssam struct cmd {
9010298Ssam 	char	*c_name;	/* name of command */
9110298Ssam 	char	*c_help;	/* help string */
9210298Ssam 	char	c_bell;		/* give bell when command completes */
9311652Ssam 	char	c_conn;		/* must be connected to use command */
9426049Sminshall 	char	c_proxy;	/* proxy server may execute */
9510298Ssam 	int	(*c_handler)();	/* function to call */
9610298Ssam };
9710298Ssam 
9826049Sminshall struct macel {
9926049Sminshall 	char mac_name[9];	/* macro name */
10026049Sminshall 	char *mac_start;	/* start of macro in macbuf */
10126049Sminshall 	char *mac_end;		/* end of macro in macbuf */
10226049Sminshall };
10326049Sminshall 
10426049Sminshall int macnum;			/* number of defined macros */
10526497Sminshall struct macel macros[16];
10626049Sminshall char macbuf[4096];
10726049Sminshall 
10810298Ssam extern	char *tail();
10910298Ssam extern	char *index();
11010298Ssam extern	char *rindex();
11111652Ssam extern	char *remglob();
11210298Ssam extern	int errno;
11326497Sminshall extern	char *mktemp();
11426497Sminshall extern	char *strncpy();
11526497Sminshall extern	char *strncat();
11626497Sminshall extern	char *strcat();
11726497Sminshall extern	char *strcpy();
118