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