1*3a184c67SAntonio Huete Jimenez /* $NetBSD: ftp_var.h,v 1.13 2020/07/04 09:59:07 lukem Exp $ */ 2*3a184c67SAntonio Huete Jimenez /* from NetBSD: ftp_var.h,v 1.85 2017/11/20 21:11:36 kre Exp */ 36cdfca03SJohn Marino 46cdfca03SJohn Marino /*- 56cdfca03SJohn Marino * Copyright (c) 1996-2009 The NetBSD Foundation, Inc. 66cdfca03SJohn Marino * All rights reserved. 76cdfca03SJohn Marino * 86cdfca03SJohn Marino * This code is derived from software contributed to The NetBSD Foundation 96cdfca03SJohn Marino * by Luke Mewburn. 106cdfca03SJohn Marino * 116cdfca03SJohn Marino * Redistribution and use in source and binary forms, with or without 126cdfca03SJohn Marino * modification, are permitted provided that the following conditions 136cdfca03SJohn Marino * are met: 146cdfca03SJohn Marino * 1. Redistributions of source code must retain the above copyright 156cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer. 166cdfca03SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 176cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer in the 186cdfca03SJohn Marino * documentation and/or other materials provided with the distribution. 196cdfca03SJohn Marino * 206cdfca03SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 216cdfca03SJohn Marino * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 226cdfca03SJohn Marino * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 236cdfca03SJohn Marino * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 246cdfca03SJohn Marino * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 256cdfca03SJohn Marino * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 266cdfca03SJohn Marino * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 276cdfca03SJohn Marino * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 286cdfca03SJohn Marino * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 296cdfca03SJohn Marino * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 306cdfca03SJohn Marino * POSSIBILITY OF SUCH DAMAGE. 316cdfca03SJohn Marino */ 326cdfca03SJohn Marino 336cdfca03SJohn Marino /* 346cdfca03SJohn Marino * Copyright (c) 1985, 1989, 1993, 1994 356cdfca03SJohn Marino * The Regents of the University of California. All rights reserved. 366cdfca03SJohn Marino * 376cdfca03SJohn Marino * Redistribution and use in source and binary forms, with or without 386cdfca03SJohn Marino * modification, are permitted provided that the following conditions 396cdfca03SJohn Marino * are met: 406cdfca03SJohn Marino * 1. Redistributions of source code must retain the above copyright 416cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer. 426cdfca03SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 436cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer in the 446cdfca03SJohn Marino * documentation and/or other materials provided with the distribution. 456cdfca03SJohn Marino * 3. Neither the name of the University nor the names of its contributors 466cdfca03SJohn Marino * may be used to endorse or promote products derived from this software 476cdfca03SJohn Marino * without specific prior written permission. 486cdfca03SJohn Marino * 496cdfca03SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 506cdfca03SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 516cdfca03SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 526cdfca03SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 536cdfca03SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 546cdfca03SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 556cdfca03SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 566cdfca03SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 576cdfca03SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 586cdfca03SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 596cdfca03SJohn Marino * SUCH DAMAGE. 606cdfca03SJohn Marino * 616cdfca03SJohn Marino * @(#)ftp_var.h 8.4 (Berkeley) 10/9/94 626cdfca03SJohn Marino */ 636cdfca03SJohn Marino 646cdfca03SJohn Marino /* 656cdfca03SJohn Marino * Copyright (C) 1997 and 1998 WIDE Project. 666cdfca03SJohn Marino * All rights reserved. 676cdfca03SJohn Marino * 686cdfca03SJohn Marino * Redistribution and use in source and binary forms, with or without 696cdfca03SJohn Marino * modification, are permitted provided that the following conditions 706cdfca03SJohn Marino * are met: 716cdfca03SJohn Marino * 1. Redistributions of source code must retain the above copyright 726cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer. 736cdfca03SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 746cdfca03SJohn Marino * notice, this list of conditions and the following disclaimer in the 756cdfca03SJohn Marino * documentation and/or other materials provided with the distribution. 766cdfca03SJohn Marino * 3. Neither the name of the project nor the names of its contributors 776cdfca03SJohn Marino * may be used to endorse or promote products derived from this software 786cdfca03SJohn Marino * without specific prior written permission. 796cdfca03SJohn Marino * 806cdfca03SJohn Marino * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 816cdfca03SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 826cdfca03SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 836cdfca03SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 846cdfca03SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 856cdfca03SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 866cdfca03SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 876cdfca03SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 886cdfca03SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 896cdfca03SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 906cdfca03SJohn Marino * SUCH DAMAGE. 916cdfca03SJohn Marino */ 926cdfca03SJohn Marino 936cdfca03SJohn Marino /* 946cdfca03SJohn Marino * FTP global variables. 956cdfca03SJohn Marino */ 966cdfca03SJohn Marino 976cdfca03SJohn Marino #ifdef SMALL 986cdfca03SJohn Marino #undef NO_EDITCOMPLETE 996cdfca03SJohn Marino #define NO_EDITCOMPLETE 1006cdfca03SJohn Marino #undef NO_PROGRESS 1016cdfca03SJohn Marino #define NO_PROGRESS 1026cdfca03SJohn Marino #endif 1036cdfca03SJohn Marino 1046cdfca03SJohn Marino #if 0 /* tnftp */ 1056cdfca03SJohn Marino 1066cdfca03SJohn Marino #include <sys/param.h> 1076cdfca03SJohn Marino 1086cdfca03SJohn Marino #include <netinet/in.h> 1096cdfca03SJohn Marino #include <arpa/inet.h> 1106cdfca03SJohn Marino 1116cdfca03SJohn Marino #include <poll.h> 1126cdfca03SJohn Marino 1136cdfca03SJohn Marino #include <setjmp.h> 1146cdfca03SJohn Marino #include <stringlist.h> 1156cdfca03SJohn Marino 1166cdfca03SJohn Marino #endif /* tnftp */ 1176cdfca03SJohn Marino 1186cdfca03SJohn Marino #ifndef NO_EDITCOMPLETE 1196cdfca03SJohn Marino #include <histedit.h> 1206cdfca03SJohn Marino #endif /* !NO_EDITCOMPLETE */ 1216cdfca03SJohn Marino 1226cdfca03SJohn Marino #include "extern.h" 1236cdfca03SJohn Marino #include "progressbar.h" 1246cdfca03SJohn Marino 1256cdfca03SJohn Marino /* 1266cdfca03SJohn Marino * Format of command table. 1276cdfca03SJohn Marino */ 1286cdfca03SJohn Marino struct cmd { 1296cdfca03SJohn Marino const char *c_name; /* name of command */ 1306cdfca03SJohn Marino const char *c_help; /* help string */ 1316cdfca03SJohn Marino char c_bell; /* give bell when command completes */ 1326cdfca03SJohn Marino char c_conn; /* must be connected to use command */ 1336cdfca03SJohn Marino char c_proxy; /* proxy server may execute */ 1346cdfca03SJohn Marino #ifndef NO_EDITCOMPLETE 1356cdfca03SJohn Marino const char *c_complete; /* context sensitive completion list */ 1366cdfca03SJohn Marino #endif /* !NO_EDITCOMPLETE */ 1376cdfca03SJohn Marino void (*c_handler)(int, char **); /* function to call */ 1386cdfca03SJohn Marino }; 1396cdfca03SJohn Marino 1406cdfca03SJohn Marino #define MAX_C_NAME 12 /* maximum length of cmd.c_name */ 1416cdfca03SJohn Marino 1426cdfca03SJohn Marino /* 1436cdfca03SJohn Marino * Format of macro table 1446cdfca03SJohn Marino */ 1456cdfca03SJohn Marino struct macel { 1466cdfca03SJohn Marino char mac_name[9]; /* macro name */ 1476cdfca03SJohn Marino char *mac_start; /* start of macro in macbuf */ 1486cdfca03SJohn Marino char *mac_end; /* end of macro in macbuf */ 1496cdfca03SJohn Marino }; 1506cdfca03SJohn Marino 1516cdfca03SJohn Marino /* 1526cdfca03SJohn Marino * Format of option table 1536cdfca03SJohn Marino */ 1546cdfca03SJohn Marino struct option { 1556cdfca03SJohn Marino const char *name; 1566cdfca03SJohn Marino char *value; 1576cdfca03SJohn Marino }; 1586cdfca03SJohn Marino 1596cdfca03SJohn Marino /* 1606cdfca03SJohn Marino * Indices to features[]; an array containing status of remote server 1616cdfca03SJohn Marino * features; -1 not known (FEAT failed), 0 absent, 1 present. 1626cdfca03SJohn Marino */ 1636cdfca03SJohn Marino enum { 1646cdfca03SJohn Marino FEAT_FEAT = 0, /* FEAT, OPTS */ 1656cdfca03SJohn Marino FEAT_MDTM, /* MDTM */ 1666cdfca03SJohn Marino FEAT_MLST, /* MLSD, MLST */ 1676cdfca03SJohn Marino FEAT_REST_STREAM, /* RESTart STREAM */ 1686cdfca03SJohn Marino FEAT_SIZE, /* SIZE */ 1696cdfca03SJohn Marino FEAT_TVFS, /* TVFS (not used) */ 1706cdfca03SJohn Marino FEAT_max 1716cdfca03SJohn Marino }; 1726cdfca03SJohn Marino 1736cdfca03SJohn Marino 1746cdfca03SJohn Marino /* 1756cdfca03SJohn Marino * Global defines 1766cdfca03SJohn Marino */ 1776cdfca03SJohn Marino #define FTPBUFLEN (4 * MAXPATHLEN) 1786cdfca03SJohn Marino #define MAX_IN_PORT_T 0xffffU 1796cdfca03SJohn Marino 1806cdfca03SJohn Marino #define HASHBYTES 1024 /* default mark for `hash' command */ 1816cdfca03SJohn Marino #define DEFAULTINCR 1024 /* default increment for `rate' command */ 1826cdfca03SJohn Marino 1836cdfca03SJohn Marino #define FTP_PORT 21 /* default if ! getservbyname("ftp/tcp") */ 1846cdfca03SJohn Marino #define HTTP_PORT 80 /* default if ! getservbyname("http/tcp") */ 1856cdfca03SJohn Marino #define HTTPS_PORT 443 /* default if ! getservbyname("https/tcp") */ 1866cdfca03SJohn Marino #ifndef GATE_PORT 1876cdfca03SJohn Marino #define GATE_PORT 21 /* default if ! getservbyname("ftpgate/tcp") */ 1886cdfca03SJohn Marino #endif 1896cdfca03SJohn Marino #ifndef GATE_SERVER 1906cdfca03SJohn Marino #define GATE_SERVER "" /* default server */ 1916cdfca03SJohn Marino #endif 1926cdfca03SJohn Marino 1936cdfca03SJohn Marino #define DEFAULTPAGER "more" /* default pager if $PAGER isn't set */ 1946cdfca03SJohn Marino #define DEFAULTPROMPT "ftp> " /* default prompt if `set prompt' is empty */ 1956cdfca03SJohn Marino #define DEFAULTRPROMPT "" /* default rprompt if `set rprompt' is empty */ 1966cdfca03SJohn Marino 1976cdfca03SJohn Marino #define TMPFILE "ftpXXXXXXXXXX" 1986cdfca03SJohn Marino 1996cdfca03SJohn Marino 2006cdfca03SJohn Marino #ifndef GLOBAL 2016cdfca03SJohn Marino #define GLOBAL extern 2026cdfca03SJohn Marino #endif 2036cdfca03SJohn Marino 2046cdfca03SJohn Marino /* 2056cdfca03SJohn Marino * Options and other state info. 2066cdfca03SJohn Marino */ 2076cdfca03SJohn Marino GLOBAL int trace; /* trace packets exchanged */ 2086cdfca03SJohn Marino GLOBAL int hash; /* print # for each buffer transferred */ 2096cdfca03SJohn Marino GLOBAL int mark; /* number of bytes between hashes */ 2106cdfca03SJohn Marino GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */ 2116cdfca03SJohn Marino GLOBAL int connected; /* 1 = connected to server, -1 = logged in */ 2126cdfca03SJohn Marino GLOBAL int interactive; /* interactively prompt on m* cmds */ 2136cdfca03SJohn Marino GLOBAL int confirmrest; /* confirm rest of current m* cmd */ 2146cdfca03SJohn Marino GLOBAL int ftp_debug; /* debugging level */ 2156cdfca03SJohn Marino GLOBAL int bell; /* ring bell on cmd completion */ 2166cdfca03SJohn Marino GLOBAL int doglob; /* glob local file names */ 2176cdfca03SJohn Marino GLOBAL int autologin; /* establish user account on connection */ 2186cdfca03SJohn Marino GLOBAL int proxy; /* proxy server connection active */ 2196cdfca03SJohn Marino GLOBAL int proxflag; /* proxy connection exists */ 2206cdfca03SJohn Marino GLOBAL int gatemode; /* use gate-ftp */ 2216cdfca03SJohn Marino GLOBAL const char *gateserver; /* server to use for gate-ftp */ 2226cdfca03SJohn Marino GLOBAL int sunique; /* store files on server with unique name */ 2236cdfca03SJohn Marino GLOBAL int runique; /* store local files with unique name */ 2246cdfca03SJohn Marino GLOBAL int mcase; /* map upper to lower case for mget names */ 2256cdfca03SJohn Marino GLOBAL int ntflag; /* use ntin ntout tables for name translation */ 2266cdfca03SJohn Marino GLOBAL int mapflag; /* use mapin mapout templates on file names */ 2276cdfca03SJohn Marino GLOBAL int preserve; /* preserve modification time on files */ 2286cdfca03SJohn Marino GLOBAL int code; /* return/reply code for ftp command */ 2296cdfca03SJohn Marino GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */ 2306cdfca03SJohn Marino GLOBAL int passivemode; /* passive mode enabled */ 2316cdfca03SJohn Marino GLOBAL int activefallback; /* fall back to active mode if passive fails */ 2326cdfca03SJohn Marino GLOBAL char *altarg; /* argv[1] with no shell-like preprocessing */ 2336cdfca03SJohn Marino GLOBAL char ntin[17]; /* input translation table */ 2346cdfca03SJohn Marino GLOBAL char ntout[17]; /* output translation table */ 2356cdfca03SJohn Marino GLOBAL char mapin[MAXPATHLEN]; /* input map template */ 2366cdfca03SJohn Marino GLOBAL char mapout[MAXPATHLEN]; /* output map template */ 2376cdfca03SJohn Marino GLOBAL char typename[32]; /* name of file transfer type */ 2386cdfca03SJohn Marino GLOBAL int type; /* requested file transfer type */ 2396cdfca03SJohn Marino GLOBAL int curtype; /* current file transfer type */ 2406cdfca03SJohn Marino GLOBAL char structname[32]; /* name of file transfer structure */ 2416cdfca03SJohn Marino GLOBAL int stru; /* file transfer structure */ 2426cdfca03SJohn Marino GLOBAL char formname[32]; /* name of file transfer format */ 2436cdfca03SJohn Marino GLOBAL int form; /* file transfer format */ 2446cdfca03SJohn Marino GLOBAL char modename[32]; /* name of file transfer mode */ 2456cdfca03SJohn Marino GLOBAL int mode; /* file transfer mode */ 2466cdfca03SJohn Marino GLOBAL char bytename[32]; /* local byte size in ascii */ 2476cdfca03SJohn Marino GLOBAL int bytesize; /* local byte size in binary */ 2486cdfca03SJohn Marino GLOBAL int anonftp; /* automatic anonymous login */ 2496cdfca03SJohn Marino GLOBAL int dirchange; /* remote directory changed by cd command */ 2506cdfca03SJohn Marino GLOBAL int flushcache; /* set HTTP cache flush headers with request */ 2516cdfca03SJohn Marino GLOBAL int rate_get; /* maximum get xfer rate */ 2526cdfca03SJohn Marino GLOBAL int rate_get_incr; /* increment for get xfer rate */ 2536cdfca03SJohn Marino GLOBAL int rate_put; /* maximum put xfer rate */ 2546cdfca03SJohn Marino GLOBAL int rate_put_incr; /* increment for put xfer rate */ 2556cdfca03SJohn Marino GLOBAL int retry_connect; /* seconds between retrying connection */ 2566cdfca03SJohn Marino GLOBAL const char *tmpdir; /* temporary directory */ 2576cdfca03SJohn Marino GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */ 2586cdfca03SJohn Marino GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */ 2596cdfca03SJohn Marino GLOBAL int epsv6; /* use EPSV/EPRT on IPv6 connections */ 2606cdfca03SJohn Marino GLOBAL int epsv6bad; /* EPSV doesn't work on the current server */ 2616cdfca03SJohn Marino GLOBAL int editing; /* command line editing enabled */ 2626cdfca03SJohn Marino GLOBAL int features[FEAT_max]; /* remote FEATures supported */ 2636cdfca03SJohn Marino 2646cdfca03SJohn Marino #ifndef NO_EDITCOMPLETE 2656cdfca03SJohn Marino GLOBAL EditLine *el; /* editline(3) status structure */ 2666cdfca03SJohn Marino GLOBAL History *hist; /* editline(3) history structure */ 2676cdfca03SJohn Marino GLOBAL char *cursor_pos; /* cursor position we're looking for */ 2686cdfca03SJohn Marino GLOBAL size_t cursor_argc; /* location of cursor in margv */ 2696cdfca03SJohn Marino GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */ 2706cdfca03SJohn Marino #endif /* !NO_EDITCOMPLETE */ 2716cdfca03SJohn Marino 2726cdfca03SJohn Marino GLOBAL char *hostname; /* name of host connected to */ 2736cdfca03SJohn Marino GLOBAL int unix_server; /* server is unix, can use binary for ascii */ 2746cdfca03SJohn Marino GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */ 2756cdfca03SJohn Marino GLOBAL char localcwd[MAXPATHLEN]; /* local dir */ 2766cdfca03SJohn Marino GLOBAL char remotecwd[MAXPATHLEN]; /* remote dir */ 277*3a184c67SAntonio Huete Jimenez GLOBAL int remcwdvalid; /* remotecwd has been updated */ 2786cdfca03SJohn Marino GLOBAL char *username; /* name of user logged in as. (dynamic) */ 2796cdfca03SJohn Marino 2806cdfca03SJohn Marino GLOBAL sa_family_t family; /* address family to use for connections */ 2816cdfca03SJohn Marino GLOBAL const char *ftpport; /* port number to use for FTP connections */ 2826cdfca03SJohn Marino GLOBAL const char *httpport; /* port number to use for HTTP connections */ 2836cdfca03SJohn Marino #ifdef WITH_SSL 2846cdfca03SJohn Marino GLOBAL const char *httpsport; /* port number to use for HTTPS connections */ 2856cdfca03SJohn Marino #endif 2866cdfca03SJohn Marino GLOBAL const char *gateport; /* port number to use for gateftp connections */ 2876cdfca03SJohn Marino GLOBAL struct addrinfo *bindai; /* local address to bind as */ 2886cdfca03SJohn Marino 2896cdfca03SJohn Marino GLOBAL char *outfile; /* filename to output URLs to */ 2906cdfca03SJohn Marino GLOBAL int restartautofetch; /* restart auto-fetch */ 2916cdfca03SJohn Marino 2926cdfca03SJohn Marino GLOBAL char line[FTPBUFLEN]; /* input line buffer */ 2936cdfca03SJohn Marino GLOBAL char *stringbase; /* current scan point in line buffer */ 2946cdfca03SJohn Marino GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */ 2956cdfca03SJohn Marino GLOBAL char *argbase; /* current storage point in arg buffer */ 2966cdfca03SJohn Marino GLOBAL StringList *marg_sl; /* stringlist containing margv */ 2976cdfca03SJohn Marino GLOBAL int margc; /* count of arguments on input line */ 2986cdfca03SJohn Marino #define margv (marg_sl->sl_str) /* args parsed from input line */ 2996cdfca03SJohn Marino GLOBAL int cpend; /* flag: if != 0, then pending server reply */ 3006cdfca03SJohn Marino GLOBAL int mflag; /* flag: if != 0, then active multi command */ 3016cdfca03SJohn Marino 3026cdfca03SJohn Marino GLOBAL int options; /* used during socket creation */ 3036cdfca03SJohn Marino 3046cdfca03SJohn Marino GLOBAL int sndbuf_size; /* socket send buffer size */ 3056cdfca03SJohn Marino GLOBAL int rcvbuf_size; /* socket receive buffer size */ 3066cdfca03SJohn Marino 3076cdfca03SJohn Marino GLOBAL int macnum; /* number of defined macros */ 3086cdfca03SJohn Marino GLOBAL struct macel macros[16]; 3096cdfca03SJohn Marino GLOBAL char macbuf[4096]; 3106cdfca03SJohn Marino 3116cdfca03SJohn Marino GLOBAL char *localhome; /* local home directory */ 3126cdfca03SJohn Marino GLOBAL char *localname; /* local user name */ 3136cdfca03SJohn Marino GLOBAL char netrc[MAXPATHLEN]; /* path to .netrc file */ 3146cdfca03SJohn Marino GLOBAL char reply_string[BUFSIZ]; /* first line of previous reply */ 3156cdfca03SJohn Marino GLOBAL void (*reply_callback)(const char *); 3166cdfca03SJohn Marino /* 3176cdfca03SJohn Marino * function to call for each line in 3186cdfca03SJohn Marino * the server's reply except for the 3196cdfca03SJohn Marino * first (`xxx-') and last (`xxx ') 3206cdfca03SJohn Marino */ 3216cdfca03SJohn Marino 3226cdfca03SJohn Marino GLOBAL volatile sig_atomic_t sigint_raised; 3236cdfca03SJohn Marino 3246cdfca03SJohn Marino GLOBAL FILE *cin; 3256cdfca03SJohn Marino GLOBAL FILE *cout; 3266cdfca03SJohn Marino GLOBAL int data; 3276cdfca03SJohn Marino 3286cdfca03SJohn Marino extern struct cmd cmdtab[]; 3296cdfca03SJohn Marino extern struct option optiontab[]; 3306cdfca03SJohn Marino 3316cdfca03SJohn Marino 3326cdfca03SJohn Marino #define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0')) 3336cdfca03SJohn Marino #define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; } 3346cdfca03SJohn Marino 3356cdfca03SJohn Marino #ifdef BSD4_4 3366cdfca03SJohn Marino # define HAVE_STRUCT_SOCKADDR_IN_SIN_LEN 1 3376cdfca03SJohn Marino #endif 3386cdfca03SJohn Marino 3396cdfca03SJohn Marino #ifdef NO_LONG_LONG 3406cdfca03SJohn Marino # define STRTOLL(x,y,z) strtol(x,y,z) 3416cdfca03SJohn Marino #else 3426cdfca03SJohn Marino # define STRTOLL(x,y,z) strtoll(x,y,z) 3436cdfca03SJohn Marino #endif 3446cdfca03SJohn Marino 3456cdfca03SJohn Marino #ifdef NO_DEBUG 346*3a184c67SAntonio Huete Jimenez #define DPRINTF(...) (void)0 347*3a184c67SAntonio Huete Jimenez #define DWARN(...) (void)0 3486cdfca03SJohn Marino #else 349*3a184c67SAntonio Huete Jimenez #define DWFTP(a) do a; while (/*CONSTCOND*/0) 350*3a184c67SAntonio Huete Jimenez #define DPRINTF(...) DWFTP(if (ftp_debug) (void)fprintf(ttyout, __VA_ARGS__)) 351*3a184c67SAntonio Huete Jimenez #define DWARN(...) DWFTP(if (ftp_debug) warn(__VA_ARGS__)) 3526cdfca03SJohn Marino #endif 3536cdfca03SJohn Marino 3546cdfca03SJohn Marino #define STRorNULL(s) ((s) ? (s) : "<null>") 3556cdfca03SJohn Marino 3566cdfca03SJohn Marino #ifdef NO_USAGE 3576cdfca03SJohn Marino void xusage(void); 3586cdfca03SJohn Marino #define UPRINTF(...) xusage() 3596cdfca03SJohn Marino #else 3606cdfca03SJohn Marino #define UPRINTF(...) (void)fprintf(ttyout, __VA_ARGS__) 3616cdfca03SJohn Marino #endif 362