2000-05-01 14:35:16 +04:00
|
|
|
/* $NetBSD: ftp_var.h,v 1.54 2000/05/01 10:35:18 lukem Exp $ */
|
1999-10-05 05:16:11 +04:00
|
|
|
|
|
|
|
/*-
|
2000-05-01 13:44:53 +04:00
|
|
|
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
|
1999-10-05 05:16:11 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Luke Mewburn.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
1999-07-02 12:07:40 +04:00
|
|
|
|
|
|
|
/*
|
1999-10-01 03:51:26 +04:00
|
|
|
* Copyright (c) 1985, 1989, 1993, 1994
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
1999-07-02 12:07:40 +04:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
1999-10-01 03:51:26 +04:00
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
1999-07-02 12:07:40 +04:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
1999-10-01 03:51:26 +04:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
1999-07-02 12:07:40 +04:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
1999-10-01 03:51:26 +04:00
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
1999-07-02 12:07:40 +04:00
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
1999-10-01 03:51:26 +04:00
|
|
|
*
|
|
|
|
* @(#)ftp_var.h 8.4 (Berkeley) 10/9/94
|
1999-07-02 12:07:40 +04:00
|
|
|
*/
|
1995-09-08 05:05:59 +04:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1999-10-01 03:51:26 +04:00
|
|
|
* Copyright (C) 1997 and 1998 WIDE Project.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
1999-10-01 03:51:26 +04:00
|
|
|
* 3. Neither the name of the project nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
1999-10-01 03:51:26 +04:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
|
1993-03-21 12:45:37 +03:00
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
1999-10-01 03:51:26 +04:00
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
1993-03-21 12:45:37 +03:00
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FTP global variables.
|
|
|
|
*/
|
|
|
|
|
1999-06-21 02:07:28 +04:00
|
|
|
#ifdef SMALL
|
|
|
|
#undef NO_EDITCOMPLETE
|
|
|
|
#define NO_EDITCOMPLETE
|
|
|
|
#undef NO_PROGRESS
|
|
|
|
#define NO_PROGRESS
|
|
|
|
#endif
|
|
|
|
|
1994-08-25 07:47:50 +04:00
|
|
|
#include <sys/param.h>
|
1998-08-08 07:02:55 +04:00
|
|
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
1994-08-25 07:47:50 +04:00
|
|
|
#include <setjmp.h>
|
1997-01-19 17:19:02 +03:00
|
|
|
#include <stringlist.h>
|
|
|
|
|
1999-06-21 02:07:28 +04:00
|
|
|
#ifndef NO_EDITCOMPLETE
|
1997-01-19 17:19:02 +03:00
|
|
|
#include <histedit.h>
|
1999-06-21 02:07:28 +04:00
|
|
|
#endif /* !NO_EDITCOMPLETE */
|
1994-08-25 07:47:50 +04:00
|
|
|
|
2000-05-01 14:35:16 +04:00
|
|
|
typedef void (*sigfunc)(int);
|
2000-02-01 01:01:03 +03:00
|
|
|
|
1994-08-25 07:47:50 +04:00
|
|
|
#include "extern.h"
|
|
|
|
|
1999-10-01 10:18:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Format of command table.
|
|
|
|
*/
|
|
|
|
struct cmd {
|
|
|
|
char *c_name; /* name of command */
|
|
|
|
char *c_help; /* help string */
|
|
|
|
char c_bell; /* give bell when command completes */
|
|
|
|
char c_conn; /* must be connected to use command */
|
|
|
|
char c_proxy; /* proxy server may execute */
|
|
|
|
#ifndef NO_EDITCOMPLETE
|
|
|
|
char *c_complete; /* context sensitive completion list */
|
|
|
|
#endif /* !NO_EDITCOMPLETE */
|
2000-05-01 14:35:16 +04:00
|
|
|
void (*c_handler)(int, char **); /* function to call */
|
1999-10-01 10:18:32 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Format of macro table
|
|
|
|
*/
|
|
|
|
struct macel {
|
2000-05-01 14:35:16 +04:00
|
|
|
char mac_name[9]; /* macro name */
|
|
|
|
char *mac_start; /* start of macro in macbuf */
|
|
|
|
char *mac_end; /* end of macro in macbuf */
|
1999-10-01 10:18:32 +04:00
|
|
|
};
|
|
|
|
|
1999-10-24 16:31:36 +04:00
|
|
|
/*
|
|
|
|
* Format of option table
|
|
|
|
*/
|
|
|
|
struct option {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
};
|
|
|
|
|
1999-10-01 10:18:32 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Global defines
|
|
|
|
*/
|
1999-10-05 04:54:07 +04:00
|
|
|
#define FTPBUFLEN MAXPATHLEN + 200
|
|
|
|
#define MAX_IN_PORT_T 0xffffU
|
1996-11-25 08:13:18 +03:00
|
|
|
|
1999-10-05 04:54:07 +04:00
|
|
|
#define HASHBYTES 1024 /* default mark for `hash' command */
|
[fear this; more ftp hacking from lukem :-]
features:
---------
* transfer rate throttling with the new `rate' command. syntax:
rate direction [max [incr]]
where direction is `all', `get' or `put'.
if max is not supplied, the current settings are displayed.
if max is supplied, then transfers in the given direction will
be throttled to this value.
if incr is supplied, the increment for the `on-the-fly' scaling
will be set to that, otherwise `1024' is used.
currently implemented for binary get, binary put, and url fetches.
not yet supported for ascii get or put, or local file copies.
* on-the-fly scaling of the throttle based on signals:
- SIGUSR1 raises the throttle rate by the increment for that direction
- SIGUSR2 lowers the throttle rate by the increment for that direction
* -T dir,max[,incr] option to set rate from the command line
* `k', `m', `g' suffix support for bytecounts in the `hash', `rate',
`rcvbuf' and `sndbuf' commands)
bug fixes and code mods:
------------------------
* fix up ftp_login() so that ruserpass() is always called, even for
command-line url fetches.
* implement strsuftoi(), which parses a given number into a int with
suffix support. replaces getsockbufsize()
* implement parserate(), which does the argv parsing for -T and rate
* save and restore errno in signal handlers (may not be necessary, but
it doesn't hurt)
notes:
------
the rate command has had reasonable testing, but I'd like feedback
if it doesn't do the right thing, especially from people on slower
(i.e, modem) links.
I haven't tested the rate throttle against a http server which does
`transfer-encoding: chunked' because I couldn't find a server to
test against.
1999-06-29 14:43:16 +04:00
|
|
|
#define DEFAULTINCR 1024 /* default increment for `rate' command */
|
1999-10-05 04:54:07 +04:00
|
|
|
#define STALLTIME 5 /* # of seconds of no xfer before "stalling" */
|
[Yet Another Huge Ftp Commit - hopefully the last for a while,
barring any more little things people want added ...]
New features:
* progressmeter is now asynchronous, so "stalled" transfers can be
detected. "- stalled -" is displayed instead of the ETA in this case.
When the xfer resumes, the time that the xfer was stalled for is
factored out of the ETA. It is debatable whether this is better than
not factoring it out, but I like it this way (I.e, if it stalls for 8
seconds and the ETA was 30 seconds, when it resumes the ETA will still
be 30 seconds).
* verbosity can be disabled on the command line (-V), so that in auto-fetch
mode the only lines displayed will be a description of the file, and
the progress bar (if possible)
* if the screen is resized (and detected via the SIGWINCH signal), the
progress bar will rescale automatically.
Bugs fixed:
* progress bar will not use the last character on the line, as this can
cause problems on some terminals
* screen dimensions (via ioctl(TIOCWINSZ)) should use stdout not stdin
* progressmeter() used some vars before initialising them
* ^D will quit now. [fixes bin/3162]
* use hstrerror() to generate error message for host name lookup failure.
* use getcwd instead of getwd (it should have been OK, but why tempt fate?)
* auto-fetch transfers will always return a positive exit value upon failure
or interruption, relative to the file's position in argv[].
* remote completion of / will work, without putting a leading "///".
This is actually a bug in ftpd(1), where "NLST /" prefixes all names
with "//", but fixing every ftpd(1) is not an option...
1997-02-01 13:44:54 +03:00
|
|
|
|
1997-08-18 14:20:13 +04:00
|
|
|
#define FTP_PORT 21 /* default if ! getservbyname("ftp/tcp") */
|
|
|
|
#define HTTP_PORT 80 /* default if ! getservbyname("http/tcp") */
|
|
|
|
#ifndef GATE_PORT
|
|
|
|
#define GATE_PORT 21 /* default if ! getservbyname("ftpgate/tcp") */
|
|
|
|
#endif
|
|
|
|
#ifndef GATE_SERVER
|
|
|
|
#define GATE_SERVER "" /* default server */
|
|
|
|
#endif
|
1996-11-25 08:13:18 +03:00
|
|
|
|
1999-10-24 16:31:36 +04:00
|
|
|
#define DEFAULTPAGER "more" /* default pager if $PAGER isn't set */
|
1999-11-12 05:50:38 +03:00
|
|
|
#define DEFAULTPROMPT "ftp> " /* default prompt if `set prompt' is empty */
|
|
|
|
#define DEFAULTRPROMPT "" /* default rprompt if `set rprompt' is empty */
|
1997-03-13 09:23:11 +03:00
|
|
|
|
1999-10-01 10:18:32 +04:00
|
|
|
#define TMPFILE "ftpXXXXXXXXXX"
|
|
|
|
|
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
#ifndef GLOBAL
|
|
|
|
#define GLOBAL extern
|
|
|
|
#endif
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
|
|
|
* Options and other state info.
|
|
|
|
*/
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL int trace; /* trace packets exchanged */
|
|
|
|
GLOBAL int hash; /* print # for each buffer transferred */
|
|
|
|
GLOBAL int mark; /* number of bytes between hashes */
|
|
|
|
GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */
|
|
|
|
GLOBAL int verbose; /* print messages coming back from server */
|
|
|
|
GLOBAL int connected; /* 1 = connected to server, -1 = logged in */
|
|
|
|
GLOBAL int fromatty; /* input is from a terminal */
|
|
|
|
GLOBAL int interactive; /* interactively prompt on m* cmds */
|
|
|
|
GLOBAL int confirmrest; /* confirm rest of current m* cmd */
|
|
|
|
GLOBAL int debug; /* debugging level */
|
|
|
|
GLOBAL int bell; /* ring bell on cmd completion */
|
|
|
|
GLOBAL int doglob; /* glob local file names */
|
|
|
|
GLOBAL int autologin; /* establish user account on connection */
|
|
|
|
GLOBAL int proxy; /* proxy server connection active */
|
|
|
|
GLOBAL int proxflag; /* proxy connection exists */
|
|
|
|
GLOBAL int gatemode; /* use gate-ftp */
|
|
|
|
GLOBAL char *gateserver; /* server to use for gate-ftp */
|
|
|
|
GLOBAL int sunique; /* store files on server with unique name */
|
|
|
|
GLOBAL int runique; /* store local files with unique name */
|
|
|
|
GLOBAL int mcase; /* map upper to lower case for mget names */
|
|
|
|
GLOBAL int ntflag; /* use ntin ntout tables for name translation */
|
|
|
|
GLOBAL int mapflag; /* use mapin mapout templates on file names */
|
|
|
|
GLOBAL int preserve; /* preserve modification time on files */
|
|
|
|
GLOBAL int progress; /* display transfer progress bar */
|
|
|
|
GLOBAL int code; /* return/reply code for ftp command */
|
|
|
|
GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */
|
|
|
|
GLOBAL int passivemode; /* passive mode enabled */
|
|
|
|
GLOBAL int activefallback; /* fall back to active mode if passive fails */
|
|
|
|
GLOBAL char *altarg; /* argv[1] with no shell-like preprocessing */
|
|
|
|
GLOBAL char ntin[17]; /* input translation table */
|
|
|
|
GLOBAL char ntout[17]; /* output translation table */
|
|
|
|
GLOBAL char mapin[MAXPATHLEN]; /* input map template */
|
|
|
|
GLOBAL char mapout[MAXPATHLEN]; /* output map template */
|
|
|
|
GLOBAL char typename[32]; /* name of file transfer type */
|
|
|
|
GLOBAL int type; /* requested file transfer type */
|
|
|
|
GLOBAL int curtype; /* current file transfer type */
|
|
|
|
GLOBAL char structname[32]; /* name of file transfer structure */
|
|
|
|
GLOBAL int stru; /* file transfer structure */
|
|
|
|
GLOBAL char formname[32]; /* name of file transfer format */
|
|
|
|
GLOBAL int form; /* file transfer format */
|
|
|
|
GLOBAL char modename[32]; /* name of file transfer mode */
|
|
|
|
GLOBAL int mode; /* file transfer mode */
|
|
|
|
GLOBAL char bytename[32]; /* local byte size in ascii */
|
|
|
|
GLOBAL int bytesize; /* local byte size in binary */
|
|
|
|
GLOBAL int anonftp; /* automatic anonymous login */
|
|
|
|
GLOBAL int dirchange; /* remote directory changed by cd command */
|
|
|
|
GLOBAL int flushcache; /* set HTTP cache flush headers with request */
|
|
|
|
GLOBAL int rate_get; /* maximum get xfer rate */
|
|
|
|
GLOBAL int rate_get_incr; /* increment for get xfer rate */
|
|
|
|
GLOBAL int rate_put; /* maximum put xfer rate */
|
|
|
|
GLOBAL int rate_put_incr; /* increment for put xfer rate */
|
|
|
|
GLOBAL int retry_connect; /* seconds between retrying connection */
|
|
|
|
GLOBAL int ttywidth; /* width of tty */
|
|
|
|
GLOBAL char *tmpdir; /* temporary directory */
|
|
|
|
GLOBAL FILE *ttyout; /* stdout, or stderr if retrieving to stdout */
|
|
|
|
GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
|
1999-10-01 12:01:12 +04:00
|
|
|
GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
|
1999-10-05 04:54:07 +04:00
|
|
|
GLOBAL int editing; /* command line editing enabled */
|
1997-01-19 17:19:02 +03:00
|
|
|
|
1999-06-21 02:07:28 +04:00
|
|
|
#ifndef NO_EDITCOMPLETE
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL EditLine *el; /* editline(3) status structure */
|
|
|
|
GLOBAL History *hist; /* editline(3) history structure */
|
|
|
|
GLOBAL char *cursor_pos; /* cursor position we're looking for */
|
|
|
|
GLOBAL size_t cursor_argc; /* location of cursor in margv */
|
|
|
|
GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
|
1999-06-21 02:07:28 +04:00
|
|
|
#endif /* !NO_EDITCOMPLETE */
|
1997-01-19 17:19:02 +03:00
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL off_t bytes; /* current # of bytes read */
|
|
|
|
GLOBAL off_t filesize; /* size of file being transferred */
|
|
|
|
GLOBAL char *direction; /* direction transfer is occurring */
|
|
|
|
GLOBAL off_t restart_point; /* offset to restart transfer */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL char *hostname; /* name of host connected to */
|
|
|
|
GLOBAL int unix_server; /* server is unix, can use binary for ascii */
|
|
|
|
GLOBAL int unix_proxy; /* proxy is unix, can use binary for ascii */
|
1999-11-11 05:53:02 +03:00
|
|
|
GLOBAL char remotepwd[MAXPATHLEN]; /* remote dir */
|
|
|
|
GLOBAL char *username; /* name of user logged in as. (dynamic) */
|
1997-08-18 14:20:13 +04:00
|
|
|
|
1999-11-11 05:53:02 +03:00
|
|
|
GLOBAL char *ftpport; /* port number to use for FTP connections */
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL char *httpport; /* port number to use for HTTP connections */
|
|
|
|
GLOBAL char *gateport; /* port number to use for gateftp connections */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL char *outfile; /* filename to output URLs to */
|
|
|
|
GLOBAL int restartautofetch; /* restart auto-fetch */
|
1999-03-22 10:36:40 +03:00
|
|
|
|
1999-10-11 02:33:54 +04:00
|
|
|
GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL char line[FTPBUFLEN]; /* input line buffer */
|
|
|
|
GLOBAL char *stringbase; /* current scan point in line buffer */
|
|
|
|
GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */
|
|
|
|
GLOBAL char *argbase; /* current storage point in arg buffer */
|
|
|
|
GLOBAL StringList *marg_sl; /* stringlist containing margv */
|
|
|
|
GLOBAL int margc; /* count of arguments on input line */
|
1999-10-05 04:54:07 +04:00
|
|
|
#define margv (marg_sl->sl_str) /* args parsed from input line */
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL int cpend; /* flag: if != 0, then pending server reply */
|
|
|
|
GLOBAL int mflag; /* flag: if != 0, then active multi command */
|
|
|
|
|
|
|
|
GLOBAL int options; /* used during socket creation */
|
|
|
|
|
|
|
|
GLOBAL int sndbuf_size; /* socket send buffer size */
|
|
|
|
GLOBAL int rcvbuf_size; /* socket receive buffer size */
|
|
|
|
|
|
|
|
GLOBAL int macnum; /* number of defined macros */
|
|
|
|
GLOBAL struct macel macros[16];
|
|
|
|
GLOBAL char macbuf[4096];
|
|
|
|
|
|
|
|
GLOBAL char home[MAXPATHLEN]; /* home directory (for lcd) */
|
|
|
|
GLOBAL char reply_string[BUFSIZ]; /* first line of previous reply */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-11-11 05:53:02 +03:00
|
|
|
GLOBAL FILE *cin;
|
|
|
|
GLOBAL FILE *cout;
|
1999-10-01 10:55:44 +04:00
|
|
|
GLOBAL int data;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-10-24 16:31:36 +04:00
|
|
|
extern struct cmd cmdtab[];
|
|
|
|
extern struct option optiontab[];
|
1998-07-10 08:39:03 +04:00
|
|
|
|
1999-10-01 10:55:44 +04:00
|
|
|
extern char *__progname; /* from crt0.o */
|
1999-10-24 16:31:36 +04:00
|
|
|
|
|
|
|
|
|
|
|
#define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
|
|
|
|
#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
|