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.4 (Berkeley) 10/09/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 int passivemode; /* passive mode enabled */ 44 char *altarg; /* argv[1] with no shell-like preprocessing */ 45 char ntin[17]; /* input translation table */ 46 char ntout[17]; /* output translation table */ 47 char mapin[MAXPATHLEN]; /* input map template */ 48 char mapout[MAXPATHLEN]; /* output map template */ 49 char typename[32]; /* name of file transfer type */ 50 int type; /* requested file transfer type */ 51 int curtype; /* current file transfer type */ 52 char structname[32]; /* name of file transfer structure */ 53 int stru; /* file transfer structure */ 54 char formname[32]; /* name of file transfer format */ 55 int form; /* file transfer format */ 56 char modename[32]; /* name of file transfer mode */ 57 int mode; /* file transfer mode */ 58 char bytename[32]; /* local byte size in ascii */ 59 int bytesize; /* local byte size in binary */ 60 61 char *hostname; /* name of host connected to */ 62 int unix_server; /* server is unix, can use binary for ascii */ 63 int unix_proxy; /* proxy is unix, can use binary for ascii */ 64 65 struct servent *sp; /* service spec for tcp/ftp */ 66 67 jmp_buf toplevel; /* non-local goto stuff for cmd scanner */ 68 69 char line[200]; /* input line buffer */ 70 char *stringbase; /* current scan point in line buffer */ 71 char argbuf[200]; /* argument storage buffer */ 72 char *argbase; /* current storage point in arg buffer */ 73 int margc; /* count of arguments on input line */ 74 char *margv[20]; /* args parsed from input line */ 75 int cpend; /* flag: if != 0, then pending server reply */ 76 int mflag; /* flag: if != 0, then active multi command */ 77 78 int options; /* used during socket creation */ 79 80 /* 81 * Format of command table. 82 */ 83 struct cmd { 84 char *c_name; /* name of command */ 85 char *c_help; /* help string */ 86 char c_bell; /* give bell when command completes */ 87 char c_conn; /* must be connected to use command */ 88 char c_proxy; /* proxy server may execute */ 89 void (*c_handler) __P((int, char **)); /* function to call */ 90 }; 91 92 struct macel { 93 char mac_name[9]; /* macro name */ 94 char *mac_start; /* start of macro in macbuf */ 95 char *mac_end; /* end of macro in macbuf */ 96 }; 97 98 int macnum; /* number of defined macros */ 99 struct macel macros[16]; 100 char macbuf[4096]; 101