xref: /original-bsd/usr.bin/ftp/ftp_var.h (revision 3f73ce2f)
1 /*
2  * Copyright (c) 1985, 1989 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)ftp_var.h	5.9 (Berkeley) 06/01/90
8  */
9 
10 /*
11  * FTP global variables.
12  */
13 
14 /*
15  * Options and other state info.
16  */
17 int	trace;			/* trace packets exchanged */
18 int	hash;			/* print # for each buffer transferred */
19 int	sendport;		/* use PORT cmd for each data connection */
20 int	verbose;		/* print messages coming back from server */
21 int	connected;		/* connected to server */
22 int	fromatty;		/* input is from a terminal */
23 int	interactive;		/* interactively prompt on m* cmds */
24 int	debug;			/* debugging level */
25 int	bell;			/* ring bell on cmd completion */
26 int	doglob;			/* glob local file names */
27 int	autologin;		/* establish user account on connection */
28 int	proxy;			/* proxy server connection active */
29 int	proxflag;		/* proxy connection exists */
30 int	sunique;		/* store files on server with unique name */
31 int	runique;		/* store local files with unique name */
32 int	mcase;			/* map upper to lower case for mget names */
33 int	ntflag;			/* use ntin ntout tables for name translation */
34 int	mapflag;		/* use mapin mapout templates on file names */
35 int	code;			/* return/reply code for ftp command */
36 int	crflag;			/* if 1, strip car. rets. on ascii gets */
37 char	pasv[64];		/* passive port for proxy data connection */
38 char	*altarg;		/* argv[1] with no shell-like preprocessing  */
39 char	ntin[17];		/* input translation table */
40 char	ntout[17];		/* output translation table */
41 #include <sys/param.h>
42 char	mapin[MAXPATHLEN];	/* input map template */
43 char	mapout[MAXPATHLEN];	/* output map template */
44 char	typename[32];		/* name of file transfer type */
45 int	type;			/* requested file transfer type */
46 int	curtype;		/* current file transfer type */
47 char	structname[32];		/* name of file transfer structure */
48 int	stru;			/* file transfer structure */
49 char	formname[32];		/* name of file transfer format */
50 int	form;			/* file transfer format */
51 char	modename[32];		/* name of file transfer mode */
52 int	mode;			/* file transfer mode */
53 char	bytename[32];		/* local byte size in ascii */
54 int	bytesize;		/* local byte size in binary */
55 
56 char	*hostname;		/* name of host connected to */
57 int	unix_server;		/* server is unix, can use binary for ascii */
58 int	unix_proxy;		/* proxy is unix, can use binary for ascii */
59 
60 struct	servent *sp;		/* service spec for tcp/ftp */
61 
62 #include <setjmp.h>
63 jmp_buf	toplevel;		/* non-local goto stuff for cmd scanner */
64 
65 char	line[200];		/* input line buffer */
66 char	*stringbase;		/* current scan point in line buffer */
67 char	argbuf[200];		/* argument storage buffer */
68 char	*argbase;		/* current storage point in arg buffer */
69 int	margc;			/* count of arguments on input line */
70 char	*margv[20];		/* args parsed from input line */
71 int     cpend;                  /* flag: if != 0, then pending server reply */
72 int	mflag;			/* flag: if != 0, then active multi command */
73 
74 int	options;		/* used during socket creation */
75 
76 /*
77  * Format of command table.
78  */
79 struct cmd {
80 	char	*c_name;	/* name of command */
81 	char	*c_help;	/* help string */
82 	char	c_bell;		/* give bell when command completes */
83 	char	c_conn;		/* must be connected to use command */
84 	char	c_proxy;	/* proxy server may execute */
85 	int	(*c_handler)();	/* function to call */
86 };
87 
88 struct macel {
89 	char mac_name[9];	/* macro name */
90 	char *mac_start;	/* start of macro in macbuf */
91 	char *mac_end;		/* end of macro in macbuf */
92 };
93 
94 int macnum;			/* number of defined macros */
95 struct macel macros[16];
96 char macbuf[4096];
97 
98 extern	char *tail();
99 extern	char *index();
100 extern	char *rindex();
101 extern	char *remglob();
102 extern	int errno;
103 extern	char *mktemp();
104 extern	char *strncpy();
105 extern	char *strncat();
106 extern	char *strcat();
107 extern	char *strcpy();
108