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