xref: /csrg-svn/usr.bin/ftp/ftp_var.h (revision 26497)
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.3 (Berkeley) 03/07/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	crflag;			/* if 1, strip car. rets. on ascii gets */
36 char	pasv[64];		/* passive port for proxy data connection */
37 char	*altarg;		/* argv[1] with no shell-like preprocessing  */
38 char	ntin[17];		/* input translation table */
39 char	ntout[17];		/* output translation table */
40 #include <sys/param.h>
41 char	mapin[MAXPATHLEN];	/* input map template */
42 char	mapout[MAXPATHLEN];	/* output map template */
43 char	typename[32];		/* name of file transfer type */
44 int	type;			/* file transfer type */
45 char	structname[32];		/* name of file transfer structure */
46 int	stru;			/* file transfer structure */
47 char	formname[32];		/* name of file transfer format */
48 int	form;			/* file transfer format */
49 char	modename[32];		/* name of file transfer mode */
50 int	mode;			/* file transfer mode */
51 char	bytename[32];		/* local byte size in ascii */
52 int	bytesize;		/* local byte size in binary */
53 
54 char	*hostname;		/* name of host connected to */
55 
56 struct	servent *sp;		/* service spec for tcp/ftp */
57 
58 #include <setjmp.h>
59 jmp_buf	toplevel;		/* non-local goto stuff for cmd scanner */
60 
61 char	line[200];		/* input line buffer */
62 char	*stringbase;		/* current scan point in line buffer */
63 char	argbuf[200];		/* argument storage buffer */
64 char	*argbase;		/* current storage point in arg buffer */
65 int	margc;			/* count of arguments on input line */
66 char	*margv[20];		/* args parsed from input line */
67 int     cpend;                  /* flag: if != 0, then pending server reply */
68 int	mflag;			/* flag: if != 0, then active multi command */
69 
70 int	options;		/* used during socket creation */
71 
72 /*
73  * Format of command table.
74  */
75 struct cmd {
76 	char	*c_name;	/* name of command */
77 	char	*c_help;	/* help string */
78 	char	c_bell;		/* give bell when command completes */
79 	char	c_conn;		/* must be connected to use command */
80 	char	c_proxy;	/* proxy server may execute */
81 	int	(*c_handler)();	/* function to call */
82 };
83 
84 struct macel {
85 	char mac_name[9];	/* macro name */
86 	char *mac_start;	/* start of macro in macbuf */
87 	char *mac_end;		/* end of macro in macbuf */
88 };
89 
90 int macnum;			/* number of defined macros */
91 struct macel macros[16];
92 char macbuf[4096];
93 
94 extern	char *tail();
95 extern	char *index();
96 extern	char *rindex();
97 extern	char *remglob();
98 extern	int errno;
99 extern	char *mktemp();
100 extern	char *strncpy();
101 extern	char *strncat();
102 extern	char *strcat();
103 extern	char *strcpy();
104