Import of LukeM's ftp client, version 1.5.
This commit is contained in:
commit
3b6e1b54e4
47
contrib/lukemftp/COPYING
Normal file
47
contrib/lukemftp/COPYING
Normal file
@ -0,0 +1,47 @@
|
||||
Copyright 1999, 2000 Luke Mewburn <lukem@netbsd.org>. All rights reserved.
|
||||
|
||||
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 Luke Mewburn.
|
||||
4. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
|
||||
This product also contains software developed by other people, and you
|
||||
are advised to read the various source files to read the full details
|
||||
of the other licenses. Those licenses also require the following
|
||||
acknowledgements:
|
||||
|
||||
This product includes software developed by the NetBSD Foundation,
|
||||
Inc. and its contributors. Those contributors include:
|
||||
- Jaromir Dolecek
|
||||
- Klaus Klein
|
||||
- Luke Mewburn
|
||||
- Jason R. Thorpe of the Numerical Aerospace Simulation
|
||||
Facility, NASA Ames Research Center.
|
||||
|
||||
This product includes software developed by the University of
|
||||
California, Berkeley and its contributors. Those contributors include:
|
||||
- Christos Zoulas of Cornell University.
|
||||
- Guido van Rossum.
|
||||
|
||||
This product includes software developed by Christos Zoulas.
|
||||
|
878
contrib/lukemftp/ChangeLog
Normal file
878
contrib/lukemftp/ChangeLog
Normal file
@ -0,0 +1,878 @@
|
||||
Wed Oct 11 14:06:19 EST 2000 lukem
|
||||
|
||||
* released version 1.5
|
||||
|
||||
Tue Oct 3 10:22:36 EST 2000 lukem
|
||||
|
||||
* crank to version 1.5 beta6
|
||||
|
||||
* merge ftp from NetBSD-current (20001003)
|
||||
- explicitly use SOCK_STREAM with socket() instead of
|
||||
res->ai_socktype, because it appears that linux with glibc
|
||||
doesn't set the latter correctly after one of getaddrinfo()
|
||||
or getnameinfo().
|
||||
- clarify that $ftp_proxy only works for full URLs and can't
|
||||
be used for interactive connections.
|
||||
|
||||
Mon Sep 25 21:52:12 EST 2000 lukem
|
||||
|
||||
* crank to version 1.5 beta5
|
||||
|
||||
Sun Sep 24 13:31:19 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000924)
|
||||
- since everything else here uses ANSI C, we might as well
|
||||
replace __STRING() with the ANSI C stringization stuff...
|
||||
- base64_encode should be static. picked up by hp/ux(!)
|
||||
compiler
|
||||
- It appears that whilst Apache 1.3.9 incorrectly puts a
|
||||
trailing space after the chunksize (before the \r\n),
|
||||
Apache 1.3.11 puts *multiple* trailing spaces after the
|
||||
chunksize. I 'm fairly certain that this is contrary to
|
||||
RFC 2068 section 3.6, but whatever...
|
||||
Found by David Brownlee <abs@mono.org>
|
||||
- always include <netdb.h>, not just when INET6 is defined.
|
||||
resolves PR [bin/10970] by Richard Earnshaw
|
||||
<rearnsha@cambridge.arm.com>>
|
||||
- in progressmeter() perform the check for foregroundproc() a
|
||||
little earlier
|
||||
- removed unused variable `items' in list_vertical()
|
||||
|
||||
Sat Sep 23 15:43:34 EST 2000 lukem
|
||||
|
||||
* remove unused sverrno in warnx() and errx()
|
||||
|
||||
* remove unused h_error in getnameinfo()
|
||||
|
||||
* in getaddrinfo(), don't bother declaring in6_addrany[] and
|
||||
in6_loopback #ifndef INET6
|
||||
|
||||
Thu Sep 21 11:26:35 EST 2000 lukem
|
||||
|
||||
* in getaddrinfo.c::str_isnumber(), use strtol() and check the
|
||||
result, instead of using strtoul() and not checking the result.
|
||||
|
||||
* define INADDRSZ if it's not found (e.g, HP/UX doesn't seem to have
|
||||
it in <arpa/nameser.h>)
|
||||
|
||||
Wed Sep 20 09:23:59 EST 2000 lukem
|
||||
|
||||
* crank to version 1.5 beta4
|
||||
|
||||
Mon Sep 18 18:19:54 EST 2000 lukem
|
||||
|
||||
* add AC_AIX test, which defines _ALL_SOURCE under AIX
|
||||
|
||||
* use ANSI # stringization instead of __STRING()
|
||||
|
||||
* define HAVE_RFC2553_NETDB if <netdb.h> defines AI_NUMERICHOST
|
||||
(et al) and has getaddrinfo(). (some systems only implement RFC2133)
|
||||
|
||||
* don't bother with AC_C_CONST as we depend upon ANSI C elsewhere
|
||||
|
||||
* when HAVE_RFC2553_NETDB isn't set, and we're #defining various EAI_,
|
||||
AI_, and NI_ items, #undef first incase a system partially implements
|
||||
these in <netdb.h>
|
||||
|
||||
* look for tgetent() in -ltinfo before -lncurses, because ncurses 5.0
|
||||
has been split up into multiple libraries.
|
||||
from Arkadiusz Miskiewicz <misiek@pld.org.pl>
|
||||
|
||||
Fri Sep 15 01:09:10 EST 2000 lukem
|
||||
|
||||
* don't bother defining __P() or __STRING() based on whether
|
||||
__STDC__ is available or not, since these aren't used any more
|
||||
|
||||
* fix mkstemp() prototype
|
||||
|
||||
* declare getpass() if necessary
|
||||
|
||||
* we don't need the readline xxgdb hack in libedit...
|
||||
|
||||
* convert to ansi declarations
|
||||
|
||||
* use ansi prototypes instead of __P()
|
||||
|
||||
* merge in changes from makelist 1.4 -> 1.6:
|
||||
- generate ansi prototypes instead of using __P(). noted by
|
||||
christos
|
||||
- fix a couple of comments
|
||||
- add -m option to makelist, which generates an mdoc table
|
||||
with the key bindings and their descriptions
|
||||
- manually add the output of 'sh ./makelist -m vi.c ed.c
|
||||
common.c' to a new section in editrc(5) called
|
||||
`EDITOR COMMANDS'
|
||||
|
||||
* merge libedit from NetBSD-current (20000915)
|
||||
* convert to new style guide, which includes:
|
||||
- ansi prototypes & features (such as stdargs)
|
||||
- 8 space indents
|
||||
* history_def_set has a `const int' as a third arg, not an
|
||||
`int'. picked up by the ultrix compiler, reported by
|
||||
simonb@ ...
|
||||
* generate ansi prototypes instead of using __P(). noted by
|
||||
christos. fix a couple of comments
|
||||
* make xxgdb and a gdb linked with libedit's readline emulation
|
||||
work properly together. xxgdb communicates with a gdb
|
||||
running on a pty that it sets to -echo,-onlcr prior to
|
||||
forking the gdb process. GNU readline preserves the -echo
|
||||
setting while libedit was undoing it (setting the tty to a
|
||||
sane state and totally confusing xxgdb's parser).
|
||||
this diff simply disables libedit if both readline emulation
|
||||
and "stty -echo" are used/set. that is enough to make
|
||||
xxgdb work once again, but (XXX) this is not how GNU readline
|
||||
handles stty -echo (it does not echo anything, but editing
|
||||
commands like ^A,^K, etc. still work), so the readline
|
||||
emulation isn't perfect.
|
||||
|
||||
Tue Aug 29 18:00:08 EST 2000 lukem
|
||||
|
||||
* don't bother testing for #if __STDC__; just assume we have it...
|
||||
|
||||
Mon Aug 28 22:45:08 EST 2000 lukem
|
||||
|
||||
* refine tests for IPv6 #defines (EAI_, AI_, NI_, ...).
|
||||
should improve portability on systems which implement
|
||||
RFC 2133 but not RFC 2553.
|
||||
|
||||
Wed Aug 9 02:12:51 EST 2000 lukem
|
||||
|
||||
* use #if __STDC__ instead of #ifdef __STDC__
|
||||
|
||||
* only test 'case NETDB_INTERNAL:' if it's defined
|
||||
|
||||
* fix support for --program-prefix et al
|
||||
|
||||
* only include <arpa/nameser.h> in the files that need it, because
|
||||
the DELETE define in some system's implementations causes name
|
||||
collisions in libedit.
|
||||
|
||||
Mon Aug 7 08:17:37 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000807)
|
||||
* implement parseport(), which takes a string and attempts to
|
||||
convert it to a numeric port number
|
||||
* use parseport() in parse_url() and hookup()
|
||||
* don't try and lookup the port number using getaddrinfo(),
|
||||
as it's too hard to separate a failed host name lookup from
|
||||
a failed service name lookup. this was causing lossage on
|
||||
systems that don't have `http' in services(5) (such as
|
||||
solaris), but only crept in when we started using
|
||||
getaddrinfo() unconditionally.
|
||||
|
||||
Wed Aug 2 23:43:50 EST 2000 lukem
|
||||
|
||||
* crank to version 1.5 beta3
|
||||
|
||||
* define NO_LONG_LONG not NO_QUAD
|
||||
|
||||
* detect if struct sockaddr.sa_len exists (rather than relying upon
|
||||
#ifdef BSD4_4)
|
||||
|
||||
* detect if socklen_t exists, and if not, typedef as unsigned int
|
||||
|
||||
* detect if struct addrinfo exists, and if not declare it and #define
|
||||
associated EAI_, AI_, and NI_ defines.
|
||||
|
||||
* look for & replace: getaddrinfo(), getnameinfo(), inet_ntop(),
|
||||
inet_pton()
|
||||
* look for gethostbyname2()
|
||||
|
||||
* don't bother looking for hstrerror() or inet_aton() anymore
|
||||
|
||||
* include <arpa/nameser.h> and <stddef.h>
|
||||
|
||||
* define USE_SELECT instead of __USE_SELECT
|
||||
|
||||
* always define HAVE_H_ERRNO
|
||||
|
||||
* add Brian Stark to THANKS, for lots of AIX porting feedback
|
||||
|
||||
* improve detection of sin_len for AIX (now part of sa_len test)
|
||||
|
||||
* add functions needed by recent ftp import:
|
||||
getaddrinfo(), getnameinfo(), inet_ntop(), inet_pton()
|
||||
remove functions not needed anymore:
|
||||
hstrerror(), inet_aton()
|
||||
|
||||
* use #if HAVE_ISSETUGID not #ifdef
|
||||
|
||||
* update from NetBSD-current (20000802):
|
||||
- rename NO_QUAD to NO_LONG_LONG, QUAD* -> LL* and add ULL*
|
||||
(unsigned) equivalents. name change suggested by Klaus
|
||||
Klein <kjk@netbsd.org>
|
||||
- change defined(BSD4_4) || HAVE_SIN_LEN tests into
|
||||
HAVE_SOCKADDR_SA_LEN, and set the latter if BSD4_4 exists
|
||||
|
||||
Mon Jul 31 10:59:10 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000731)
|
||||
- we can't just rename BSD4_4 -> HAVE_SIN_LEN, since bsd
|
||||
systems define BSD4_4; change tests to test for either
|
||||
defined(BSD4_4) or HAVE_SIN_LEN
|
||||
- more KNF
|
||||
|
||||
Sun Jul 30 16:55:09 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000730):
|
||||
- clean up NO_QUAD support: create helper #defines and use as
|
||||
appropriate:
|
||||
#define NOQUAD ! NOQUAD
|
||||
------- ------ - ------
|
||||
QUADF "%ld" "%lld"
|
||||
QUADFP(x) "%" x "ld" "%" x "lld"
|
||||
QUADT long long long
|
||||
STRTOL(x,y,z) strtol(x,y,z) strtoll(x,y,z)
|
||||
- always use getaddrinfo() and getnameinfo() instead of
|
||||
maintaining two code paths.
|
||||
- rename __USE_SELECT to USE_SELECT
|
||||
- rename BSD4_4 to HAVE_SIN_LEN
|
||||
- replace union sockunion {} with struct sockinet {}, and
|
||||
modify the code accordingly. this is possibly more portable,
|
||||
as it doesn't rely upon the structure alignment within the
|
||||
union for our own stuff.
|
||||
|
||||
Fri Jul 28 22:11:17 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000728):
|
||||
- no trailing , on last item (FEAT_max) in enum
|
||||
- rename "opts" to "remopts", so people used to "o host"
|
||||
don't get bitten
|
||||
|
||||
Wed Jul 26 18:59:19 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000726):
|
||||
- add support for FEAT and OPTS commands with `features' and
|
||||
`opts'. (from RFC 2389).
|
||||
- add support for MLST & MLSD (machine parseble listings)
|
||||
with 'mlst', 'mlsd' and 'pmlsd' (mlsd |$PAGER) commands.
|
||||
(from draft-ietf-ftpext-mlst-11)
|
||||
- rename remotesyst() to getremoteinfo(), and modify to parse
|
||||
the result from FEAT (if supported), and take into account
|
||||
the support for the various extensions such as MDTM, SIZE,
|
||||
REST (STREAM), MLSD, and FEAT/OPTS.
|
||||
- put each feature into one of the following categories:
|
||||
- known to work (explicit FEAT)
|
||||
- unknown but assume works until explicit failure,
|
||||
when it's then tagged as `known not to work'.
|
||||
- known not to work (FEAT succeeded but didn't return
|
||||
anything, or was unknown and then explicit failure)
|
||||
assign results into features[] matrix.
|
||||
- add support to getreply() so that an optional callback will
|
||||
be called for each line received from the server except for
|
||||
the first and last. this is used in FEAT (and MLST) parsing.
|
||||
- modify various commands to check if REST (STREAM), MDTM and
|
||||
SIZE are explicitly or implicitly supported before using.
|
||||
- fix `syst' when verbose is off.
|
||||
- minor knf (indent goto labels by one space, etc).
|
||||
- simply various command usage handlers by assuming that
|
||||
argv != NULL except for quit() and disconnect().
|
||||
- errx?/warnx? audit. do not pass variable alone, use %s.
|
||||
|
||||
* check for issetugid() and don't use in libedit if it doesn't exist.
|
||||
|
||||
* merge libedit from NetBSD-current (20000726):
|
||||
* Only look in home directory for .editrc. (Discussed
|
||||
with Christos.)
|
||||
|
||||
* in glob.c #undef TILDE before redefining, because some AIX systems
|
||||
#define TILDE in <sys/ioctl.h>
|
||||
|
||||
Mon Jul 10 00:28:51 EST 2000 lukem
|
||||
|
||||
* released lukemftp 1.4
|
||||
|
||||
Thu Jun 15 23:28:49 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000615):
|
||||
* migrate the SYST parsing from setpeer() into a separate
|
||||
remotesyst(). call remotesyst() only when login has been
|
||||
successful some servers don't let you run SYST until you've
|
||||
successfully logged in.
|
||||
* in fetch_ftp(), always call setpeer() with autologin
|
||||
disabled, and use the following ftp_login() to DTRT. this
|
||||
prevents ftp from trying to login a second time if the
|
||||
first autologin fails when connecting to a remote site
|
||||
anonymously using autofetch.
|
||||
* reset unix_proxy and unix_server in cleanuppeer()
|
||||
* missed a function conversion in the KNF sweep...
|
||||
|
||||
Mon Jun 12 01:16:12 EST 2000 lukem
|
||||
|
||||
* change lukemftp.h to check !HAVE_STRDUP instead of !HAVE_STRSUP.
|
||||
fixes compile problem on systems which have strdup() as a macro.
|
||||
|
||||
* merge ftp from NetBSD-current (20000612):
|
||||
from itojun: better fix for previous (doesn't need
|
||||
in_addr_t or u_int32_t)
|
||||
|
||||
Sun Jun 11 12:19:52 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000611):
|
||||
portability fixes for lukemftp:
|
||||
* initconn(): use in_addr_t instead of u_int32_t when
|
||||
manipulating IPv6 addresses (and assume anything with ipv6
|
||||
has in_addr_t; if not, i'll add an autoconf test for it)
|
||||
* ai_unmapped(): not all systems have sin_len; so only set
|
||||
#ifdef BSD4_4
|
||||
* fix some lint
|
||||
|
||||
Mon Jun 5 21:10:31 EST 2000 lukem
|
||||
|
||||
* released lukemftp 1.3
|
||||
|
||||
Mon Jun 5 19:53:49 EST 2000 lukem
|
||||
|
||||
* convert various support files to ANSI C
|
||||
|
||||
* look for strtoll() instead of strtoq()
|
||||
|
||||
* update COPYRIGHT, THANKS, NEWS
|
||||
|
||||
* merge ftp from NetBSD-current (20000605):
|
||||
- fix ai_unmapped() to be a no-op in the !def INET6 case
|
||||
- display `(-INET6)' at the end of the version string if
|
||||
!def INET6
|
||||
- clarify in the man page that IPv6 support may not be present
|
||||
(for lukemftp :)
|
||||
|
||||
* ensure <vis.h> has VIS_WHITE et al
|
||||
|
||||
Sun Jun 4 18:00:07 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000604):
|
||||
- Change `ls' to use the `LIST' and not `NLST' FTP protocol
|
||||
command. Now that after many years on not caring we find
|
||||
certain popular ftp servers are starting to obey RFC959 to
|
||||
the letter of the law and will only return a list of
|
||||
filenames (not directories or other filetypes) in the
|
||||
output of `NLST', then `LIST' is more useful in this case.
|
||||
(Note that the aforementioned pedanticness means that
|
||||
filename completion isn't as useful as it could be...)
|
||||
Fixes [bin/8937] by David A. Gatwood
|
||||
<dgatwood@deepspace.mklinux.org>
|
||||
- convert to ANSI KNF
|
||||
- Add support for `fget localfile', which reads a list of
|
||||
filenames to retrieve from localfile. Based on work by
|
||||
Darren Reed.
|
||||
- Update copyright dates.
|
||||
- s/strtoq/strtoll/ (the latter is standardised)
|
||||
- Add support for 'ftp -u url file ...', to upload a list of
|
||||
files to given url. Mostly based on [bin/10019] by Scott
|
||||
Aaron Bamford <sab@ansic.net>
|
||||
- convert IPv4 mapped address (::ffff:10.1.1.1) into real IPv4
|
||||
address before touching it. IPv4 mapped address complicates
|
||||
too many things in FTP protocol handling.
|
||||
- do not pass scoped IPv6 address notation on Host: directive,
|
||||
since scope identifier is local to the originating node.
|
||||
do not allow scoped IPv6 address notation in URL, if it is
|
||||
via proxy.
|
||||
- fixes from cgd:
|
||||
* sanity check a length (otherwise certain bogus responses
|
||||
can crash ftp)
|
||||
* allow a transfer encoding type of `binary'; certain
|
||||
firewall vendors return this bogus type...
|
||||
- make debugging output unambiguous on IPv6 numeric addrs
|
||||
(don't use host:port)
|
||||
- http://[::1]:8080/ is legal.
|
||||
- send Host: directive with RFC2732 bracket notation for IPv6
|
||||
numeric, otherwise "host:port" is ambiguous to servers
|
||||
(clarification will be submitted as update to RFC2732).
|
||||
- only use getaddrinfo() et al if both NI_NUMERICHOST *and*
|
||||
INET6 are defined... (allows --disable-ipv6 in lukemftp's
|
||||
configure script to disable this as well, which is good for
|
||||
testing when it appears getaddrinfo() is borken)
|
||||
- updated comment on IPv4 mapped address. sync with kame.
|
||||
- Fix examples on using pipes in local filenames. AFAICT,
|
||||
ftp has always required `dir . |more' not as `dir |more'
|
||||
treats `|more' as the remote filename. Resolves [bin/9922]
|
||||
by Geoff Wing <mason@primenet.com.au>
|
||||
- ftp(1): treats IPv4 mapped destination as IPv4 peer, not
|
||||
native IPv6 peer. this does not support network with SIIT
|
||||
translator.
|
||||
- inhibit too-noisy message for scoped address data transfer
|
||||
(will be enabled in "debug" mode).
|
||||
- only use IPTOS_ setsockopt()s if they're defined (e.g, SunOS
|
||||
doesn't). from Havard.Eidnes@runit.sintef.no
|
||||
- allow IPv6 extended numeric address in host part.
|
||||
(draft-ietf-ipngwg-scopedaddr-format-01.txt). fixes PR 9616.
|
||||
|
||||
* merge libedit from NetBSD-current (20000604):
|
||||
- use strtol() (instead of atoi()) for sane error detection
|
||||
|
||||
Wed May 31 19:24:53 EST 2000 lukem
|
||||
|
||||
* merge libedit from NetBSD-current (20000531):
|
||||
- Fix refresh glitches when using auto-margin.
|
||||
- Don't dump core on empty .editrc files.
|
||||
- el_insertstr takes a "const char *" not "char *" now as it
|
||||
doesn't modify the argument.
|
||||
|
||||
Thu Feb 3 20:19:40 EST 2000 lukem
|
||||
|
||||
* released lukemftp 1.2
|
||||
|
||||
Tue Feb 1 09:47:51 EST 2000 lukem
|
||||
|
||||
* add --enable-ipv6 and --disable-ipv6 to configure
|
||||
|
||||
* modify libedit/sig.? to use sigfunc instead of sig_t, and
|
||||
deprecate autoconf tests for retsigtype and sig_t.
|
||||
This fixes portability problems with Digital UNIX 5.0.
|
||||
|
||||
* merge ftp from NetBSD-current (20000201):
|
||||
- define private type `sigfunc' as
|
||||
typedef void (*sigfunc) __P((int));
|
||||
and replace use of sig_t and void (*)(int).
|
||||
certain other OSes define sig_t differently to that (they
|
||||
add extra arguments), and it causes problems due to
|
||||
function mismatches, etc...
|
||||
|
||||
Wed Jan 26 22:54:38 EST 2000 lukem
|
||||
|
||||
* search for tgetent() in -ltermcap then -lcurses and -lncurses
|
||||
|
||||
* merge ftp from NetBSD-current (20000126):
|
||||
- roll back to using sscanf() instead of strptime() to parse
|
||||
`yyyymmddhhmmss' strings, since the latter technically can't
|
||||
parse dates without non alphanumerics between the elements
|
||||
(even though NetBSD's strptime() copes).
|
||||
|
||||
Tue Jan 25 19:09:37 EST 2000 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (20000125):
|
||||
- complete_ambiguous(): be consistent about completing
|
||||
unambiguous matches; if the word is already complete then
|
||||
return CC_REFRESH so that the higher layer may append a
|
||||
suffix if necessary. Fix from Launey Thomas <ljt@alum.mit.edu>
|
||||
- change references from draft-ietf-ipngwg-url-literal-01.txt
|
||||
to RFC2732
|
||||
- work around bug in apache 1.3.9 which incorrectly puts a
|
||||
trailing space after the chunksize. noted by Jun-ichiro
|
||||
itojun Hagino <itojun@itojun.org> in [bin/9096]
|
||||
- work around lame ftpd's that don't return a correct post-Y2K
|
||||
date in the output of `MDTM'. obviously the programmer of
|
||||
aforementioned lame ftpd's did something like
|
||||
"19%02d", tm->tm_year
|
||||
instead of
|
||||
"%04d", tm->tm_year + TM_YEAR_BASE
|
||||
fixes [bin/9289] by jbernard@mines.edu
|
||||
|
||||
* merge libedit from NetBSD-current (20000125):
|
||||
- PR/9244: Kevin Schoedel: libedit dumps bindings
|
||||
inconsistently
|
||||
- PR/9243: Kevin Schoedel: libedit ignores repeat count
|
||||
- Add support for automatic and magic margins (from tcsh)
|
||||
This makes the rightmost column usable on all programs
|
||||
that use editline.
|
||||
|
||||
Tue Dec 21 08:59:22 EST 1999 lukem
|
||||
|
||||
* update INSTALL notes for some systems
|
||||
|
||||
* if sl_init() exists, check return value of sl_add() is int and
|
||||
compile in a replacement copy if it's not the case
|
||||
|
||||
* don't look for <stringlist.h> - always use local prototypes; older
|
||||
NetBSD systems may have conflicting prototypes
|
||||
|
||||
Mon Dec 20 11:21:28 EST 1999 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (19991220):
|
||||
- Move version from ftp_var.h to version.h
|
||||
- Fix chunked support; probably broke after rate limiting was added.
|
||||
Problem noticed/debugging assisted by giles lean
|
||||
<giles@nemeton.com.au>.
|
||||
- remove unnecessary freeaddrinfo(res), since res0 was changed to be
|
||||
freed earlier in itojun's last commit. fixes [bin/8948].
|
||||
- remove `const char *reason'; it was being assigned but not used.
|
||||
- fix memory leak in fetch_url (no freeaddrinfo was there).
|
||||
sync with recent KAME.
|
||||
- separate out the main `data pump' loop into two: one that supports
|
||||
rate limiting and one that doesn't. simplifies the code, and speeds
|
||||
up the latter case a bit, at the expense of duplicating a few
|
||||
lines...
|
||||
|
||||
Sun Nov 28 18:20:41 EST 1999 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (19991128):
|
||||
- implement xsl_init() and xsl_add(); error checking forms of
|
||||
sl_{init,add}()
|
||||
- fix bug where the second press of <TAB> on an empty word (i.e, list
|
||||
all options) may have resulted in an strncmp() against NULL.
|
||||
(detected by _DIAGASSERT())
|
||||
- in cleanuppeer(), reset username to NULL after free()ing it.
|
||||
fixes [bin/8870] by Wolfgang Rupprecht <wolfgang@wsrcc.com>
|
||||
- complete_remote(): use remglob("", ...) instead of remglob(".", ...),
|
||||
for listings of the current working directory; some ftp servers don't
|
||||
like `NLST .'.
|
||||
[noted by Giles Lean <giles@nemeton.com.au>]
|
||||
- recvrequest(): treat remote=="" as remote==NULL when calling
|
||||
command(). (to support the above change)
|
||||
- support `[user@]' in `[user@]host' and `[user@]host[:][path]'.
|
||||
[based on idea (and initial code) from David Maxwell <david@fundy.ca>]
|
||||
- `idle' may be invoked without any args
|
||||
- reformat some comments
|
||||
- reformat usage string in program and man page
|
||||
- call updateremotepwd() after successful login, not after successful
|
||||
connect
|
||||
- always call setsockopt(, IPPROTO_IP, IP_TOS, ) (et al); using #if
|
||||
defined(IPPROTO_IP) doesn't work on certain foreign systems where
|
||||
enums instead of #defines are used...
|
||||
[noted by Matthias Pfaller <leo@dachau.marco.de>]
|
||||
|
||||
Mon Nov 15 23:01:58 EST 1999 lukem
|
||||
|
||||
* released lukemftp 1.1
|
||||
|
||||
Mon Nov 15 09:07:01 EST 1999 lukem
|
||||
|
||||
* merge libedit from NetBSD-current (19991115):
|
||||
- instead of using a private coord_t global variable to store
|
||||
the size of the rprompt, use the previously unused coord_t
|
||||
el->el_rprompt.p_pos
|
||||
|
||||
Sat Nov 13 14:42:22 EST 1999 lukem
|
||||
|
||||
* support caching of results in AC_MSG_TRY_{COMPILE,LINK}
|
||||
autoconf tests
|
||||
|
||||
* add NEWS file
|
||||
|
||||
* clarify copyright statement in COPYING
|
||||
|
||||
* merge ftp from NetBSD-current (19991113):
|
||||
- implement `set rprompt'; right side version of `set prompt'.
|
||||
depends on EL_RPROMPT support i added to editline(3).
|
||||
- allow $FTPPROMPT and $FTPRPROMPT to override defaults for
|
||||
the relevant prompts
|
||||
- move `%' formatting code from prompt() to expandbuf().
|
||||
- implement `%.' and `%c', similar to the same % codes in
|
||||
tcsh(1) (functionality I added to tcsh nearly 6 years ago),
|
||||
except that `%.' always does `...trailing' and `%c' always
|
||||
does `/<x>trailing'.
|
||||
- unknown `%foo' codes get printed as `%foo'
|
||||
- implement updateremotepwd(); update the global variable
|
||||
`remotepwd' to contain the remote working directory.
|
||||
- add `set prompt', a user configurable prompt. (defaults to
|
||||
`ftp> '). the following escape characters a la tcsh(1) are
|
||||
supported: %/, %m, %M, and %n.
|
||||
- add global var `username'; used by prompt code
|
||||
- fix a couple of minor memory leaks
|
||||
- bump version
|
||||
- prevent minor memory leak (unnecessary strdup)
|
||||
- implement restarting file:/// non-proxied http:// URLs
|
||||
(with -R).
|
||||
- fix a semicolono which stopped file:/// from working
|
||||
- split the version string into product and version
|
||||
- be consistent about reporting the version between:
|
||||
+ status command
|
||||
+ about:version URL fetch
|
||||
+ User-agent sent in http requests
|
||||
- hookup(): when using getservbyname() (when getaddrinfo()
|
||||
isn't available), if the provided port is a valid number
|
||||
use that rather than trying to do getservbyname() against
|
||||
it. fixes a problem on foreign systems noted by Chuck
|
||||
Silvers <chuq@chuq.com>
|
||||
- support `about:version'. also display the version in the
|
||||
output of `status'.
|
||||
|
||||
* merge libedit from NetBSD-current (19991113):
|
||||
- implement printing a right-side prompt. code derived from
|
||||
similar work I wrote for tcsh(1) three years ago.
|
||||
- implement EL_RPROMPT, which allows a setting/getting of a
|
||||
function which returns a string to be used as the
|
||||
right-side prompt.
|
||||
|
||||
* replace manually managed config.h.in with acconfig.h and use
|
||||
autoheader to generate the former.
|
||||
|
||||
* add missing entry for `#undef write' in acconfig.h (for SOCKS)
|
||||
|
||||
* configure.in:
|
||||
- use `LL' suffix on long long constant used to test
|
||||
snprintf("%lld")
|
||||
- test for EL_RPROMPT instead of EL_EDITMODE, since the
|
||||
former is is a newer required feature
|
||||
|
||||
* in makelist, set LC_ALL="C", in case the locale confuses awk.
|
||||
problem noted by Peter Seebach <seebs@plethora.net>
|
||||
|
||||
Wed Oct 27 07:00:00 UTC 1999 lukem
|
||||
|
||||
* released 1.0
|
||||
|
||||
* removed libedit/TEST/test.c; no need to distribute it
|
||||
|
||||
Mon Oct 25 21:59:54 EST 1999 lukem
|
||||
|
||||
* released 1.0b7
|
||||
|
||||
* put VERSION string into lukemftp.h, and display with the `status'
|
||||
command
|
||||
|
||||
Mon Oct 25 11:36:59 EST 1999 lukem
|
||||
|
||||
* merge ftp from NetBSD-current (19991025):
|
||||
- fix up confirm() (broke `a' and `p' in last commit)
|
||||
- simplify main loop (don't need `top' variable any more)
|
||||
- use a struct sockaddr_in6.sin6_addr for the result from inet_pton(),
|
||||
rather than u_char buf[16]
|
||||
- add a few more comments
|
||||
|
||||
new features:
|
||||
- add `usage'; displays the usage of a command.
|
||||
implemented by calling the c_handler() with argc = 0, argv =
|
||||
"funcname".
|
||||
- add `passive auto'; does the same as $FTPMODE=auto.
|
||||
- add `set [option value]'; display all options, or set an option to
|
||||
a value.
|
||||
- add `unset option'; unset an option.
|
||||
- add getoptionvalue() to retrieve an option's value, and replace a few
|
||||
global variables with calls to this.
|
||||
- implement cleanuppeer(), which resets various bits of state back to
|
||||
`disconnected'. call in disconnect() and lostpeer().
|
||||
- support completing on `options'.
|
||||
- improve recovery after a SIGINT may have closed the connection.
|
||||
XXX: there's still a couple to fix
|
||||
|
||||
other stuff:
|
||||
- various consistency fixes in the man page.
|
||||
- ensure that the command usage strings in the code and man page
|
||||
match reality.
|
||||
- mput/mget: check that the connection still exists before each xfer.
|
||||
- minor cosmetic changes in confirm().
|
||||
- set code correctly in sizecmd() and modtime()
|
||||
- don't need \n in err() strings.
|
||||
- change lostpeer to take an argument (rather than casting
|
||||
(sig_t)lostpeer in signal handlers)
|
||||
- knf and whitespace police.
|
||||
|
||||
Sun Oct 24 17:02:59 EST 1999 lukem
|
||||
|
||||
* merge libedit from NetBSD-current (19991024):
|
||||
- don't assume locales are not working - it may not be
|
||||
the case
|
||||
- re_refresh(): cast the character passed to re_addc() to
|
||||
unsigned char, so we don't end up calling isprint() with
|
||||
negative value when chars are signed and character value
|
||||
is >= 128
|
||||
- Fix pointer arithmatic (caused problems on LP64, including
|
||||
ftp dumping core when `edit' was turned off then on).
|
||||
Problem solved by David Huggins-Daines <dhd@eradicator.org>
|
||||
|
||||
Tue Oct 12 18:05:21 EST 1999 lukem
|
||||
|
||||
* install man page from ${srcdir} not from .
|
||||
|
||||
Tue Oct 12 17:00:41 EST 1999 lukem
|
||||
|
||||
* released 1.0b6
|
||||
|
||||
* merge from NetBSD-current (19991012):
|
||||
a few user interface and cosmetic tweaks:
|
||||
- confirm(): move from util.c to cmds.c. display mnemonic
|
||||
string in its prompt. add support for `q' (terminate
|
||||
current xfer), `?' (show help list)
|
||||
- in various signal handlers, output a linefeed only if
|
||||
fromatty.
|
||||
- if fgets(stdin) returned NULL (i.e, EOF), clearerr(stdin)
|
||||
because you don't want future fgets to fail. this is not
|
||||
done for the fgets() in the main command loop, since ftp
|
||||
will quit at that point.
|
||||
- unless ftp is invoked with -a, don't retain the anonftp
|
||||
setting between hosts (`ftp somehost:' sets anonftp, but
|
||||
you don't want that to `stick' if you close that connection
|
||||
and open a new one).
|
||||
|
||||
Mon Oct 11 23:06:38 EST 1999 lukem
|
||||
|
||||
* check for working const
|
||||
|
||||
* reorganise addition of -lukem to LIBS (was being added twice)
|
||||
|
||||
* merge from netbsd-current:
|
||||
- use sigjmp_buf instead of jmp_buf for sigsetjmp() buffer
|
||||
|
||||
* libedit: don't bother generating & compiling editline.c, since
|
||||
its component parts are compiled anyway.
|
||||
|
||||
Sun Oct 10 12:08:39 EST 1999 lukem
|
||||
|
||||
* released 1.0b5
|
||||
|
||||
* in libedit, use xsignal_restart() (from src/util.c) instead of
|
||||
signal(); the isn't guaranteed to work on some foreign systems
|
||||
(e.g, IRIX) if sigaction() is used in the same program.
|
||||
|
||||
* merge from netbsd-current:
|
||||
- use sigsetjmp()/siglongjump() instead of setjmp()/longjmp();
|
||||
the latter don't save the signal mask on some foreign systems.
|
||||
- ensure signal handlers don't use stdio and do reset errno
|
||||
if they don't exit with siglongjmp()
|
||||
- use a common SIGINT handler for {send,recv}request()
|
||||
- allow a second SIGINT during the "xfer aborted. waiting for
|
||||
remote to finish abort." stage. if this occurs, just call
|
||||
lostpeer() to close the connection. whilst this might be
|
||||
considered brutal, it's also extremely handy if you're
|
||||
impatient or there's lossage at the remote end.
|
||||
|
||||
* add preformatted manual page
|
||||
|
||||
* fix --enable-editline
|
||||
|
||||
Wed Oct 6 10:19:00 EST 1999 lukem
|
||||
|
||||
* released 1.0b4
|
||||
|
||||
* don't defining SIGINFO to SIGQUIT if the former doesn't exist; the
|
||||
code now supports both as a method of getting the transfer stats
|
||||
|
||||
* rototill signal handling in the actual data xfer routines, and
|
||||
specifically set SIGQUIT to psummary in each one, to override
|
||||
editline's handler
|
||||
|
||||
Tue Oct 5 23:48:29 EST 1999 lukem
|
||||
|
||||
* factor out SIGINFO setting into a handler that is always active
|
||||
(but only prints out info if bytes > 0). only set the handler if
|
||||
SIGINFO is defined
|
||||
|
||||
* hijack SIGQUIT to be the same as SIGINFO
|
||||
|
||||
* in {recv,send}request(), factor a lot of duplicated code out into
|
||||
a `cleanup' section at the end
|
||||
|
||||
* rework shell() a bit
|
||||
|
||||
* enhancments from Marc Horowitz <marc@mit.edu> to improve
|
||||
connection timeouts:
|
||||
- implement xsignal_restart(), which only sets the SA_RESTART
|
||||
flag if specifically requested
|
||||
- xsignal() is now a wrapper to xsignal_restart(). INFO,
|
||||
USR1, USR2 and WINCH are restartable, ALRM, INT, PIPE and
|
||||
QUIT are not
|
||||
- improve getreply()'s timeout code to take advantage of the
|
||||
above
|
||||
|
||||
* improve wording of how globbing works for `classic' URLs (host:path)
|
||||
suggested by John Refling <johnr@imageworks.com> in relation to PRs
|
||||
[bin/8519] and [bin/8520]
|
||||
|
||||
* always compile in the `edit' command even if NO_EDITCOMPLETE defined
|
||||
it's just a no-op in the latter case, which is more consistent to
|
||||
the users
|
||||
|
||||
* always compile in about: support (i.e, remove NO_ABOUT). i'm
|
||||
entitled to some vanity in this program...
|
||||
|
||||
* update copyrights
|
||||
|
||||
Mon Oct 4 10:57:41 EST 1999 lukem
|
||||
|
||||
* Invoke ar with `cr' not `cq'
|
||||
|
||||
* Use AC_PROG_RANLIB to find ranlib, and use it on the libraries
|
||||
|
||||
* Remove `makelist' from dependency list for libedit files; re-running
|
||||
configure shouldn't result in rebuilding libedit
|
||||
|
||||
* Add support for --{en,dis}able-editcomplete (defaults to enabled),
|
||||
which prevents libedit support from being compiled in.
|
||||
From Chris G. Demetriou <cgd@netbsd.org>
|
||||
|
||||
Sun Oct 3 16:49:01 EST 1999 lukem
|
||||
|
||||
* touch up the README
|
||||
|
||||
* add COPYING, INSTALL, THANKS
|
||||
|
||||
* whitespace consistency
|
||||
|
||||
* in config.h, replace NO_QUAD with HAVE_QUAD_SUPPORT, and in
|
||||
lukemftp.h define the former if the latter is non zero
|
||||
|
||||
* change test against GETPGRP_VOID from #ifdef to #if
|
||||
|
||||
* snprintf(): in the truncation case, ensure that the length
|
||||
returned is the actual length, not the needed length
|
||||
|
||||
Sat Oct 2 00:41:34 EST 1999 lukem
|
||||
|
||||
* fix more lossage with $(srcdir) / $(VPATH) stuff; seems to work now
|
||||
when configured in a separate directory
|
||||
|
||||
* actually test the correct variable when determining whether to run
|
||||
AC_FUNC_GETPGRP
|
||||
|
||||
Fri Oct 1 19:32:22 EST 1999 lukem
|
||||
|
||||
* released 1.0b3
|
||||
|
||||
* use AC_PROG_MAKE_SET
|
||||
|
||||
* determine setting of NO_QUAD with configure not lukemftp.h
|
||||
|
||||
* if have long long and have snprintf, test that snprintf
|
||||
supports %lld. if it doesn't use private version
|
||||
|
||||
* change strtoq from returning off_t to returning long long
|
||||
|
||||
* updates from NetBSD mainline:
|
||||
- only try epsv once per connection (i.e, don't bother again
|
||||
if it fails)
|
||||
- improve description of rate command
|
||||
- fix up global vars; they're now externed in ftp_var.h
|
||||
except when main.c includes it
|
||||
- remove "pathnames.h"
|
||||
|
||||
Fri Oct 1 10:08:43 EST 1999 lukem
|
||||
|
||||
* updates from NetBSD mainline:
|
||||
- fix determining of homedir
|
||||
- parse_url(): fix checking of portnum
|
||||
- move kame copyrights after bsd/tnfi ones
|
||||
|
||||
* released 1.0b2
|
||||
|
||||
* add %lld and %qd support to snprintf() for displaying long long's
|
||||
|
||||
* support VPATH and srcdir
|
||||
|
||||
Thu Sep 30 17:19:35 EST 1999 lukem
|
||||
|
||||
* released 1.0b1
|
||||
|
||||
* fix from NetBSD mainline: in empty() FD_ZERO the correct variable
|
||||
|
||||
Wed Sep 29 23:34:33 EST 1999 lukem
|
||||
|
||||
* major rework; reimport code from NetBSD-current 1999/09/29 into
|
||||
separate subdirectories and build from there. organisation is now:
|
||||
libedit replacement libedit
|
||||
libukem replacements for missing functions
|
||||
src main ftp source
|
||||
|
||||
Mon Sep 27 00:43:12 EST 1999 lukem
|
||||
|
||||
* released 1.0 a6
|
||||
|
||||
Sun Sep 26 17:17:05 EST 1999 lukem
|
||||
|
||||
* released 1.0 a5
|
||||
|
||||
Sat Sep 25 00:58:28 EST 1999 lukem
|
||||
|
||||
* released 1.0 a4
|
||||
|
||||
Fri Sep 24 17:07:07 EST 1999 lukem
|
||||
|
||||
* released 1.0 a3
|
||||
|
||||
Fri Sep 24 16:18:29 EST 1999 lukem
|
||||
|
||||
* released 1.0 a2
|
||||
|
||||
Tue Sep 21 11:38:49 EST 1999 lukem
|
||||
|
||||
* import usr.src/bin/ftp and usr.src/lib/libedit sources from NetBSD
|
213
contrib/lukemftp/INSTALL
Normal file
213
contrib/lukemftp/INSTALL
Normal file
@ -0,0 +1,213 @@
|
||||
INSTALLATION INTRODUCTION
|
||||
-------------------------
|
||||
|
||||
This file describes how to compile and install lukemftp on your
|
||||
system.
|
||||
|
||||
============================================
|
||||
= =
|
||||
= NOTE: You will need an ANSI C compiler. =
|
||||
= =
|
||||
============================================
|
||||
|
||||
|
||||
For most systems, execute the following to compile and install
|
||||
lukemftp:
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
A preformatted manual page (src/ftp.cat1) is also installed. If
|
||||
you wish to install the source (src/ftp.1), ensure that your system
|
||||
has up-to-date mandoc macros. groff ships with this macro suite,
|
||||
but it has bugs. Try:
|
||||
ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/tmac/
|
||||
for a more recent version.
|
||||
|
||||
|
||||
CONFIGURATION OPTIONS
|
||||
---------------------
|
||||
|
||||
lukemftp is configured using an `autoconf' generated `configure'
|
||||
script. `configure' supports the following options:
|
||||
|
||||
* The standard `autoconf configure' options, including:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[/usr/local]
|
||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[same as prefix]
|
||||
--srcdir=DIR find the sources in DIR [configure dir or ..]
|
||||
BSD or GNU make may be required for this to work.
|
||||
|
||||
* Specific options:
|
||||
--enable-editcomplete Turn on command line editing and completion.
|
||||
--disable-editcomplete Turn off command line editing and completion
|
||||
[default: enabled].
|
||||
--enable-ipv6 Enable IPv6 support (if your OS supports it)
|
||||
--disable-ipv6 Disable IPv6 support (even if your OS supports it.)
|
||||
[default: enabled].
|
||||
--with-socks Compile with SOCKS firewall traversal support.
|
||||
--with-socks5[=PATH] Compile with SOCKS5 firewall traversal support.
|
||||
--with-socks4[=PATH] Compile with SOCKS4 firewall traversal support.
|
||||
|
||||
The following environment variables can be set to override various
|
||||
compiler related settings.
|
||||
CC=compiler specify name of the C compiler (default: gcc or cc)
|
||||
CFLAGS=flags specify flags to C compiler (default: -O -g or just -O)
|
||||
LDFLAGS=flags specify flags to linker (default: none)
|
||||
|
||||
This can be achieved with:
|
||||
env CC="compiler" CFLAGS="flags" LDFLAGS="flags" ./configure
|
||||
|
||||
|
||||
============================================
|
||||
= =
|
||||
= NOTE: You will need an ANSI C compiler. =
|
||||
= =
|
||||
============================================
|
||||
|
||||
|
||||
PLATFORM SPECIFIC NOTES
|
||||
-----------------------
|
||||
|
||||
The following platforms & compilers have been tested:
|
||||
|
||||
- AIX 4.1.5:
|
||||
- AIX 4.2.1:
|
||||
- Compiler: cc -qlanglvl=ansi
|
||||
version: xlC 3.1.4.10 -- C for AIX Compiler
|
||||
|
||||
Configure with:
|
||||
env CC="cc -qlanglvl=ansi" ./configure
|
||||
|
||||
- BSD/OS 4.0.1 (x86)
|
||||
- BSD/OS 4.1 (x86)
|
||||
- BSD/OS 4.1 (sparc)
|
||||
- BSD/OS 4.2 (x86)
|
||||
- Compiler: /bin/cc
|
||||
version: gcc 2.7.2.1
|
||||
version: gcc version 2.95.2 19991024
|
||||
|
||||
- Digital UNIX 4.0b
|
||||
- Digital UNIX 4.0d
|
||||
- Digital UNIX 4.0f
|
||||
- Compiler: cc -std
|
||||
version: DEC C V5.2-036 on Digital UNIX V4.0 (Rev. 564)
|
||||
version: DEC C V5.9-005 on Digital UNIX V4.0 (Rev. 1229)
|
||||
|
||||
Configure with
|
||||
env CC="cc -std" ./configure
|
||||
|
||||
- Compiler: gcc
|
||||
version: 2.95.1
|
||||
|
||||
- Digital UNIX 5.0
|
||||
- Compiler: cc
|
||||
version: Compaq C V6.1-011 on Digital UNIX V5.0 (Rev. 910)
|
||||
|
||||
- FreeBSD 3.4 (i386):
|
||||
- FreeBSD 3.5 (i386):
|
||||
- FreeBSD 4.1 (i386):
|
||||
- Compiler: cc
|
||||
version: gcc version 2.7.2.3
|
||||
version: gcc version 2.95.2 19991024
|
||||
|
||||
- HP/UX 10.20:
|
||||
- HP/UX 11.00:
|
||||
- Compiler: /opt/ansic/bin/cc -Ae
|
||||
version: A.10.32.03
|
||||
|
||||
Configure with
|
||||
env CC="cc -Ae" ./configure
|
||||
|
||||
To generate code that will run on old architectures you
|
||||
may need to add "+DAportable" to CC.
|
||||
|
||||
|
||||
- IRIX 6.5.4
|
||||
- IRIX 6.5.8
|
||||
Compiler: /bin/cc
|
||||
version: MIPSpro Compilers: Version 7.2.1
|
||||
Compiler:
|
||||
version: gcc version 2.95.2
|
||||
|
||||
- HP/UX 11.00:
|
||||
- HP/UX 11.00 64 bit:
|
||||
- Compiler: /opt/ansic/bin/cc -Ae
|
||||
version: A.11.01.00
|
||||
|
||||
Configure with
|
||||
env CC="cc -Ae" ./configure
|
||||
|
||||
- NetBSD 1.3.3 (i386)
|
||||
Compiler: /usr/bin/cc
|
||||
Compiler: /usr/bin/cc
|
||||
|
||||
Ignore warnings about ``passing arg 3 of `tputs' from
|
||||
incompatible pointer type''.
|
||||
|
||||
- RedHat Linux 5.1 (?? i386)
|
||||
- RedHat Linux 5.2 (?? i386)
|
||||
- RedHat Linux 6.0 (Linux 2.2.10 i686)
|
||||
- RedHat Linux 6.1 (Linux 2.2.5-15 i686)
|
||||
- RedHat Linux 6.2 (Linux 2.2.16-3smp i686)
|
||||
- Compiler: cc
|
||||
version: egcs-1.1.2
|
||||
|
||||
- Slackware (Linux 2.0.35 i686)
|
||||
- Compiler: cc
|
||||
version: 2.7.2.3
|
||||
|
||||
- Solaris 2.6 (sparc)
|
||||
- Solaris 7 (sparc)
|
||||
- Compiler: /opt/SUNWspro/bin/cc
|
||||
version: WorkShop Compilers 5.0
|
||||
|
||||
- Compiler: gcc
|
||||
version: egcs-1.1.2
|
||||
|
||||
=============
|
||||
= OLD NOTES =
|
||||
=============
|
||||
|
||||
XXX: clean up to match reality
|
||||
------------------------------
|
||||
|
||||
- AIX 4.3.2:
|
||||
Compiler: cc
|
||||
version: ibmcxx 3.6.6.1 -- IBM C and C++ Compilers
|
||||
|
||||
- RedHat Linux 5.0 (i386)
|
||||
Compiler: cc
|
||||
|
||||
- Solaris 2.5 (sparc)
|
||||
- Solaris 7 (x86)
|
||||
Compiler: /opt/SUNWspro/bin/cc
|
||||
version: SC3.0 15 Dec 1993
|
||||
version: WorkShop Compilers 5.0
|
||||
Compiler: gcc
|
||||
version: egcs-1.1.2
|
||||
version: gcc 2.8.1
|
||||
version: gcc 2.95.1
|
||||
|
||||
- Solaris 7 (sparc) 64 bit
|
||||
Compiler: /opt/SUNWspro/bin/cc -xarch=v9
|
||||
version: WorkShop Compilers 5.0
|
||||
|
||||
- SunOS 4
|
||||
Compiler: gcc -lresolv
|
||||
version:
|
||||
|
||||
- SuSE Linux
|
||||
Compiler: gcc
|
||||
version:
|
||||
|
||||
/usr/bin/ftp on SuSE Linux 6.4 is this ftp client.
|
||||
|
||||
May need `gcc -L/usr/lib/termcap' if tgetent() et al aren't found.
|
||||
|
||||
- Ultrix 4.5
|
||||
Compiler: cc
|
||||
version: MIPS C Compiler 3.0
|
||||
Compiler: gcc
|
||||
version: 2.7.2.2
|
33
contrib/lukemftp/Makefile.in
Normal file
33
contrib/lukemftp/Makefile.in
Normal file
@ -0,0 +1,33 @@
|
||||
# $Id: Makefile.in,v 1.6 1999/11/13 01:18:22 lukem Exp $
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
SHELL = /bin/sh
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
SUBDIRS = libedit libukem src
|
||||
|
||||
all: ftp
|
||||
|
||||
ftp: @LIBEDIT@ @LIBUKEM@
|
||||
( cd src; ${MAKE} )
|
||||
|
||||
libedit.a:
|
||||
( cd libedit; ${MAKE} )
|
||||
|
||||
libukem.a:
|
||||
( cd libukem; ${MAKE} )
|
||||
|
||||
install clean:
|
||||
@for i in ${SUBDIRS}; do \
|
||||
( echo "$@ ===> $$i" ; cd $$i ; ${MAKE} $@ ); \
|
||||
done
|
||||
|
||||
distclean: clean
|
||||
@for i in ${SUBDIRS}; do \
|
||||
( echo "$@ ===> $$i" ; cd $$i ; ${MAKE} $@ ); \
|
||||
done
|
||||
rm -f Makefile config.cache config.log config.status config.h
|
84
contrib/lukemftp/NEWS
Normal file
84
contrib/lukemftp/NEWS
Normal file
@ -0,0 +1,84 @@
|
||||
This is a brief description of the new features and fixes added to
|
||||
lukemftp-1.5 since the release of lukemftp-1.4. As always, the manual
|
||||
page (src/ftp.cat1) is the place to look for complete descriptions.
|
||||
|
||||
* Add new commands:
|
||||
features list remote features supported by servers
|
||||
mlsd machine parseable directory listing
|
||||
mlst machine parseable file listing
|
||||
remopts set options on remote features
|
||||
|
||||
These require support in the remote server for the ftp extensions
|
||||
described in RFC 2389 and draft-ietf-ftpext-mlst-11.
|
||||
|
||||
* Fix support for the --program-prefix and --program-suffix configure
|
||||
options.
|
||||
|
||||
---
|
||||
This is a brief description of the new features and fixes added to
|
||||
lukemftp-1.4 since the release of lukemftp-1.3. As always, the manual
|
||||
page (src/ftp.cat1) is the place to look for complete descriptions.
|
||||
|
||||
* Fix compilation problems on various non 4.4BSD derived platforms which
|
||||
support IPv6, and on Linux systems which have strdup() as a macro.
|
||||
|
||||
* During auto-fetch, don't attempt to autologin a second time if the first
|
||||
time failed.
|
||||
|
||||
---
|
||||
This is a brief description of the new features and fixes added to
|
||||
lukemftp-1.3 since the release of lukemftp-1.2. As always, the manual
|
||||
page (src/ftp.cat1) is the place to look for complete descriptions.
|
||||
|
||||
* The `ls' command now uses the `LIST' directive instead of `NLST',
|
||||
in order to be compatible with RFC959.
|
||||
|
||||
* Add fget command, which reads a list of filenames to retrieve from
|
||||
the given file.
|
||||
|
||||
* Add support for uploading files on the command-line with `ftp -u'.
|
||||
|
||||
* Various fixes to the IPv6 support.
|
||||
|
||||
---
|
||||
This is a brief description of the new features and fixes added to
|
||||
lukemftp-1.2 since the release of lukemftp-1.1. As always, the manual
|
||||
page (src/ftp.cat1) is the place to look for complete descriptions.
|
||||
|
||||
* During remote completion, only send ``NLST'' instead of ``NLST .''
|
||||
when reading the list of files from the remote server; some servers
|
||||
don't like the trailing `.'.
|
||||
|
||||
* Support a leading ``[user@]'' for ``[user@]host[:][path]'' auto-fetches
|
||||
and ``[user@]host'' connections.
|
||||
|
||||
* Always compile in support for setting the type of service on transfers.
|
||||
Should speed up transfers on Linux systems.
|
||||
|
||||
* Improve performance of non-rate-limited transfers.
|
||||
|
||||
* Work around ftp servers that aren't Y2K compliant in returning the
|
||||
modification time of a file.
|
||||
|
||||
* Update the libedit library to support automatic and magic margins,
|
||||
allowing ftp's rprompt to move an extra character to the right.
|
||||
|
||||
---
|
||||
This is a brief description of the new features and fixes added to
|
||||
lukemftp-1.1 since the release of lukemftp-1.0. As always, the manual
|
||||
page (src/ftp.cat1) is the place to look for complete descriptions.
|
||||
|
||||
* Implemented `set prompt' and `set rprompt', which allow you to
|
||||
configure the prompt and right side prompt (respectively).
|
||||
Some tcsh(1) style `%' escapes are supported, including
|
||||
%. %c %/ %m %M %n
|
||||
|
||||
* Implemented restarting of file:/// and non-proxied http:// URLs
|
||||
(using -R)
|
||||
|
||||
* Correctly parse remote ports given as numbers that don't appear in
|
||||
the services(5) database.
|
||||
|
||||
* Prevent a couple of minor memory leaks
|
||||
|
||||
* Add missing compilation setting for SOCKS
|
61
contrib/lukemftp/README
Normal file
61
contrib/lukemftp/README
Normal file
@ -0,0 +1,61 @@
|
||||
WHAT IS LUKEMFTP?
|
||||
-----------------
|
||||
|
||||
`lukemftp' is what many users affectionately call the enhanced ftp
|
||||
client in NetBSD (http://www.netbsd.org). The `lukem' comes from
|
||||
the account name of the NetBSD developer who wrote most of the
|
||||
enhancements: Luke Mewburn <lukem@netbsd.org>.
|
||||
|
||||
This package is a `port' of the NetBSD ftp client to other systems.
|
||||
|
||||
The enhancements over the standard ftp client in 4.4BSD (and
|
||||
derivatives) include:
|
||||
* command-line editing within ftp
|
||||
* command-line fetching of URLS, including support for:
|
||||
- http proxies (c.f: $http_proxy, $ftp_proxy)
|
||||
- authentication
|
||||
* configurable prompt
|
||||
* context sensitive command and filename completion
|
||||
* dynamic progress bar
|
||||
* feature negotiation extensions from RFC 2389
|
||||
(c.f: `feat' and `remopts')
|
||||
* extensions to ftp from the IETF ftpext working group
|
||||
(c.f: `mlsd' and `mlst')
|
||||
* IPv6 support (from the WIDE project)
|
||||
* modification time preservation
|
||||
* paging of local and remote files, and of directory listings
|
||||
(c.f: `lpage', `page', `pdir')
|
||||
* passive mode support, with fallback to active mode
|
||||
* retrieval of filenames listed in a given file (c.f: `fget')
|
||||
* `set option' override of ftp environment variables
|
||||
* socks4/socks5 support
|
||||
* TIS Firewall Toolkit gate ftp proxy support (c.f: `gate')
|
||||
* transfer-rate throttling (c.f: `-T', `rate')
|
||||
* uploading of files on the command line (c.f: `-u')
|
||||
|
||||
|
||||
INSTALLATION
|
||||
------------
|
||||
|
||||
Refer to `INSTALL' for more information on how to compile and install
|
||||
lukemftp.
|
||||
|
||||
|
||||
FEEDBACK / BUG REPORTS
|
||||
----------------------
|
||||
|
||||
Please email feedback back to the maintainer: <lukem@netbsd.org>.
|
||||
|
||||
|
||||
COPYRIGHT
|
||||
---------
|
||||
|
||||
lukemftp is covered by a BSD-style copyright notice. Please refer to
|
||||
the file `COPYING' for more information.
|
||||
|
||||
|
||||
AVAILABILITY
|
||||
------------
|
||||
|
||||
The primary ftp site for lukemftp is:
|
||||
ftp://ftp.netbsd.org/pub/NetBSD/misc/lukemftp/
|
30
contrib/lukemftp/THANKS
Normal file
30
contrib/lukemftp/THANKS
Normal file
@ -0,0 +1,30 @@
|
||||
Whilst a lot of the work in lukemftp (both the original sources in NetBSD
|
||||
and this port) was done by me (Luke Mewburn), it would not be as useable
|
||||
without the enhancements, fixes, or input from the following people:
|
||||
|
||||
Brian Stark <bstark@siemens-psc.com>
|
||||
Chris G. Demetriou <cgd@netbsd.org>
|
||||
Christos Zoulas <christos@netbsd.org>
|
||||
Dan Winship <danw@mit.edu>
|
||||
Darren Reed <darrenr@pobox.com>
|
||||
David Carrel <carrel@netbsd.org>
|
||||
Giles Lean <giles@nemeton.com.au>
|
||||
Havard Eidnes <Havard.Eidnes@runit.sintef.no>
|
||||
ITOH Yasufumi <itohy@netbsd.org>
|
||||
Jason R. Thorpe <thorpej@netbsd.org>
|
||||
John Hawkinson <jhawk@mit.edu>
|
||||
Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
Jun-ichiro itojun Hagino <itojun@netbsd.org>
|
||||
Kimmo Suominen <kim@tac.nyc.ny.us>
|
||||
Klaus Klein <kleink@netbsd.org>
|
||||
Luke Mewburn <lukem@netbsd.org>
|
||||
Marc Horowitz <marc@mit.edu>
|
||||
Matthew R. Green <mrg@eterna.com.au>
|
||||
Matthias Pfaller <leo@dachau.marco.de>
|
||||
Matthias Scheler <tron@zhadum.de>
|
||||
Michael L. Hitch <osymh@terra.oscs.montana.edu>
|
||||
Scott Aaron Bamford <sab@ansic.net>
|
||||
Simon Burge <simonb@thistledown.com.au>
|
||||
Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
|
||||
Apologies to anyone I've missed.
|
89
contrib/lukemftp/acconfig.h
Normal file
89
contrib/lukemftp/acconfig.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* $Id: acconfig.h,v 1.6 2000/09/17 23:29:12 lukem Exp $ */
|
||||
|
||||
@TOP@
|
||||
@BOTTOM@
|
||||
|
||||
/* Define if your compiler supports `long long' */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define if in_port_t exists */
|
||||
#undef HAVE_IN_PORT_T
|
||||
|
||||
/* Define if struct sockaddr.sa_len exists (implies sockaddr_in.sin_len, etc) */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define if socklen_t exists */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if AF_INET6 exists in <sys/socket.h> */
|
||||
#undef HAVE_AF_INET6
|
||||
|
||||
/* Define if `struct sockaddr_in6' exists in <netinet/in.h> */
|
||||
#undef HAVE_SOCKADDR_IN6
|
||||
|
||||
/* Define if `struct addrinfo' exists in <netdb.h> */
|
||||
#undef HAVE_ADDRINFO
|
||||
|
||||
/*
|
||||
* Define if <netdb.h> contains AI_NUMERICHOST et al.
|
||||
* Systems which only implement RFC2133 will need this.
|
||||
*/
|
||||
#undef HAVE_RFC2553_NETDB
|
||||
|
||||
/* Define if `struct direct' has a d_namlen element */
|
||||
#undef HAVE_D_NAMLEN
|
||||
|
||||
/* Define if GLOB_BRACE exists in <glob.h> */
|
||||
#undef HAVE_GLOB_BRACE
|
||||
|
||||
/* Define if h_errno exists in <netdb.h> */
|
||||
#undef HAVE_H_ERRNO_D
|
||||
|
||||
/* Define if fclose() is declared in <stdio.h> */
|
||||
#undef HAVE_FCLOSE_D
|
||||
|
||||
/* Define if getpass() is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_GETPASS_D
|
||||
|
||||
/* Define if optarg is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTARG_D
|
||||
|
||||
/* Define if optind is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTIND_D
|
||||
|
||||
/* Define if pclose() is declared in <stdio.h> */
|
||||
#undef HAVE_PCLOSE_D
|
||||
|
||||
/* Define if `long long' is supported and sizeof(off_t) >= 8 */
|
||||
#undef HAVE_QUAD_SUPPORT
|
||||
|
||||
/* Define if strptime() is declared in <time.h> */
|
||||
#undef HAVE_STRPTIME_D
|
||||
|
||||
/*
|
||||
* Define this if compiling with SOCKS (the firewall traversal library).
|
||||
* Also, you must define connect, getsockname, bind, accept, listen, and
|
||||
* select to their R-versions.
|
||||
*/
|
||||
#undef SOCKS
|
||||
#undef SOCKS4
|
||||
#undef SOCKS5
|
||||
#undef connect
|
||||
#undef getsockname
|
||||
#undef bind
|
||||
#undef accept
|
||||
#undef listen
|
||||
#undef select
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fclose
|
||||
#undef gethostbyname
|
||||
#undef getpeername
|
||||
#undef read
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef rresvport
|
||||
#undef send
|
||||
#undef sendto
|
||||
#undef shutdown
|
||||
#undef write
|
257
contrib/lukemftp/aclocal.m4
vendored
Normal file
257
contrib/lukemftp/aclocal.m4
vendored
Normal file
@ -0,0 +1,257 @@
|
||||
dnl $Id: aclocal.m4,v 1.5 1999/11/13 10:50:39 lukem Exp $
|
||||
dnl
|
||||
|
||||
dnl
|
||||
dnl AC_MSG_TRY_COMPILE
|
||||
dnl
|
||||
dnl Written by Luke Mewburn <lukem@netbsd.org>
|
||||
dnl
|
||||
dnl Usage:
|
||||
dnl AC_MSG_TRY_COMPILE(Message, CacheVar, Includes, Code,
|
||||
dnl ActionPass [,ActionFail] )
|
||||
dnl
|
||||
dnl effectively does:
|
||||
dnl AC_CACHE_CHECK(Message, CacheVar,
|
||||
dnl AC_TRY_COMPILE(Includes, Code, CacheVar = yes, CacheVar = no)
|
||||
dnl if CacheVar == yes
|
||||
dnl AC_MESSAGE_RESULT(yes)
|
||||
dnl ActionPass
|
||||
dnl else
|
||||
dnl AC_MESSAGE_RESULT(no)
|
||||
dnl ActionFail
|
||||
dnl )
|
||||
dnl
|
||||
AC_DEFUN(AC_MSG_TRY_COMPILE, [
|
||||
AC_CACHE_CHECK($1, $2, [
|
||||
AC_TRY_COMPILE([ $3 ], [ $4; ], [ $2=yes ], [ $2=no ])
|
||||
])
|
||||
if test "x[$]$2" = "xyes"; then
|
||||
$5
|
||||
else
|
||||
$6
|
||||
:
|
||||
fi
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl AC_MSG_TRY_LINK
|
||||
dnl
|
||||
dnl Usage:
|
||||
dnl AC_MSG_TRY_LINK(Message, CacheVar, Includes, Code,
|
||||
dnl ActionPass [,ActionFail] )
|
||||
dnl
|
||||
dnl as AC_MSG_TRY_COMPILE, but uses AC_TRY_LINK instead of AC_TRY_COMPILE
|
||||
dnl
|
||||
AC_DEFUN(AC_MSG_TRY_LINK, [
|
||||
AC_CACHE_CHECK($1, $2, [
|
||||
AC_TRY_LINK([ $3 ], [ $4; ], [ $2=yes ], [ $2=no ])
|
||||
])
|
||||
if test "x[$]$2" = "xyes"; then
|
||||
$5
|
||||
else
|
||||
$6
|
||||
:
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl
|
||||
dnl AC_LIBRARY_NET: #Id: net.m4,v 1.5 1997/11/09 21:36:54 jhawk Exp #
|
||||
dnl
|
||||
dnl Written by John Hawkinson <jhawk@mit.edu>. This code is in the Public
|
||||
dnl Domain.
|
||||
dnl
|
||||
dnl This test is for network applications that need socket() and
|
||||
dnl gethostbyname() -ish functions. Under Solaris, those applications need to
|
||||
dnl link with "-lsocket -lnsl". Under IRIX, they should *not* link with
|
||||
dnl "-lsocket" because libsocket.a breaks a number of things (for instance:
|
||||
dnl gethostbyname() under IRIX 5.2, and snoop sockets under most versions of
|
||||
dnl IRIX).
|
||||
dnl
|
||||
dnl Unfortunately, many application developers are not aware of this, and
|
||||
dnl mistakenly write tests that cause -lsocket to be used under IRIX. It is
|
||||
dnl also easy to write tests that cause -lnsl to be used under operating
|
||||
dnl systems where neither are necessary (or useful), such as SunOS 4.1.4, which
|
||||
dnl uses -lnsl for TLI.
|
||||
dnl
|
||||
dnl This test exists so that every application developer does not test this in
|
||||
dnl a different, and subtly broken fashion.
|
||||
dnl
|
||||
dnl It has been argued that this test should be broken up into two seperate
|
||||
dnl tests, one for the resolver libraries, and one for the libraries necessary
|
||||
dnl for using Sockets API. Unfortunately, the two are carefully intertwined and
|
||||
dnl allowing the autoconf user to use them independantly potentially results in
|
||||
dnl unfortunate ordering dependancies -- as such, such component macros would
|
||||
dnl have to carefully use indirection and be aware if the other components were
|
||||
dnl executed. Since other autoconf macros do not go to this trouble, and almost
|
||||
dnl no applications use sockets without the resolver, this complexity has not
|
||||
dnl been implemented.
|
||||
dnl
|
||||
dnl The check for libresolv is in case you are attempting to link statically
|
||||
dnl and happen to have a libresolv.a lying around (and no libnsl.a).
|
||||
dnl
|
||||
AC_DEFUN(AC_LIBRARY_NET, [
|
||||
# Most operating systems have gethostbyname() in the default searched
|
||||
# libraries (i.e. libc):
|
||||
AC_CHECK_FUNC(gethostbyname, ,
|
||||
# Some OSes (eg. Solaris) place it in libnsl:
|
||||
AC_CHECK_LIB(nsl, gethostbyname, ,
|
||||
# Some strange OSes (SINIX) have it in libsocket:
|
||||
AC_CHECK_LIB(socket, gethostbyname, ,
|
||||
# Unfortunately libsocket sometimes depends on libnsl.
|
||||
# AC_CHECK_LIB's API is essentially broken so the following
|
||||
# ugliness is necessary:
|
||||
AC_CHECK_LIB(socket, gethostbyname,
|
||||
LIBS="-lsocket -lnsl $LIBS",
|
||||
AC_CHECK_LIB(resolv, gethostbyname),
|
||||
-lnsl)
|
||||
)
|
||||
)
|
||||
)
|
||||
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
|
||||
AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl)))
|
||||
])
|
||||
|
||||
|
||||
dnl Checks for SOCKS firewall support.
|
||||
dnl
|
||||
dnl Written by Matthew R. Green <mrg@eterna.com.au>
|
||||
dnl
|
||||
AC_DEFUN(AC_LIBRARY_SOCKS, [
|
||||
AC_MSG_CHECKING(whether to support SOCKS)
|
||||
AC_ARG_WITH(socks,
|
||||
[ --with-socks Compile with SOCKS firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_CHECK_LIB(socks5, SOCKSconnect, [
|
||||
socks=5
|
||||
LIBS="-lsocks5 $LIBS"], [
|
||||
AC_CHECK_LIB(socks, Rconnect, [
|
||||
socks=4
|
||||
LIBS="-lsocks $LIBS"], [
|
||||
AC_MSG_ERROR(Could not find socks library. You must first install socks.) ] ) ] )
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
if test "x$socks" = "x"; then
|
||||
AC_MSG_CHECKING(whether to support SOCKS5)
|
||||
AC_ARG_WITH(socks5,
|
||||
[ --with-socks5[=PATH] Compile with SOCKS5 firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
socks=5
|
||||
if test "x$withval" = "xyes"; then
|
||||
withval="-lsocks5"
|
||||
else
|
||||
if test -d "$withval"; then
|
||||
if test -d "$withval/include"; then
|
||||
CFLAGS="$CFLAGS -I$withval/include"
|
||||
else
|
||||
CFLAGS="$CFLAGS -I$withval"
|
||||
fi
|
||||
if test -d "$withval/lib"; then
|
||||
withval="-L$withval/lib -lsocks5"
|
||||
else
|
||||
withval="-L$withval -lsocks5"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
LIBS="$withval $LIBS"
|
||||
# If Socks was compiled with Kerberos support, we will need
|
||||
# to link against kerberos libraries. Temporarily append
|
||||
# to LIBS. This is harmless if there is no kerberos support.
|
||||
TMPLIBS="$LIBS"
|
||||
LIBS="$LIBS $KERBEROS_LIBS"
|
||||
AC_TRY_LINK([],
|
||||
[ SOCKSconnect(); ],
|
||||
[],
|
||||
[ AC_MSG_ERROR(Could not find the $withval library. You must first install socks5.) ])
|
||||
LIBS="$TMPLIBS"
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x"; then
|
||||
AC_MSG_CHECKING(whether to support SOCKS4)
|
||||
AC_ARG_WITH(socks4,
|
||||
[ --with-socks4[=PATH] Compile with SOCKS4 firewall traversal support.],
|
||||
[
|
||||
case "$withval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
socks=4
|
||||
if test "x$withval" = "xyes"; then
|
||||
withval="-lsocks"
|
||||
else
|
||||
if test -d "$withval"; then
|
||||
withval="-L$withval -lsocks"
|
||||
fi
|
||||
fi
|
||||
LIBS="$withval $LIBS"
|
||||
AC_TRY_LINK([],
|
||||
[ Rconnect(); ],
|
||||
[],
|
||||
[ AC_MSG_ERROR(Could not find the $withval library. You must first install socks.) ])
|
||||
;;
|
||||
esac
|
||||
],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x4"; then
|
||||
AC_DEFINE(SOCKS)
|
||||
AC_DEFINE(SOCKS4)
|
||||
AC_DEFINE(connect, Rconnect)
|
||||
AC_DEFINE(getsockname, Rgetsockname)
|
||||
AC_DEFINE(bind, Rbind)
|
||||
AC_DEFINE(accept, Raccept)
|
||||
AC_DEFINE(listen, Rlisten)
|
||||
AC_DEFINE(select, Rselect)
|
||||
fi
|
||||
|
||||
if test "x$socks" = "x5"; then
|
||||
AC_DEFINE(SOCKS)
|
||||
AC_DEFINE(SOCKS5)
|
||||
AC_DEFINE(connect,SOCKSconnect)
|
||||
AC_DEFINE(getsockname,SOCKSgetsockname)
|
||||
AC_DEFINE(getpeername,SOCKSgetpeername)
|
||||
AC_DEFINE(bind,SOCKSbind)
|
||||
AC_DEFINE(accept,SOCKSaccept)
|
||||
AC_DEFINE(listen,SOCKSlisten)
|
||||
AC_DEFINE(select,SOCKSselect)
|
||||
AC_DEFINE(recvfrom,SOCKSrecvfrom)
|
||||
AC_DEFINE(sendto,SOCKSsendto)
|
||||
AC_DEFINE(recv,SOCKSrecv)
|
||||
AC_DEFINE(send,SOCKSsend)
|
||||
AC_DEFINE(read,SOCKSread)
|
||||
AC_DEFINE(write,SOCKSwrite)
|
||||
AC_DEFINE(rresvport,SOCKSrresvport)
|
||||
AC_DEFINE(shutdown,SOCKSshutdown)
|
||||
AC_DEFINE(listen,SOCKSlisten)
|
||||
AC_DEFINE(close,SOCKSclose)
|
||||
AC_DEFINE(dup,SOCKSdup)
|
||||
AC_DEFINE(dup2,SOCKSdup2)
|
||||
AC_DEFINE(fclose,SOCKSfclose)
|
||||
AC_DEFINE(gethostbyname,SOCKSgethostbyname)
|
||||
fi
|
||||
])
|
266
contrib/lukemftp/config.h.in
Normal file
266
contrib/lukemftp/config.h.in
Normal file
@ -0,0 +1,266 @@
|
||||
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/* $Id: config.h.in,v 1.24 2000/09/18 00:40:12 lukem Exp $ */
|
||||
|
||||
|
||||
/* Define if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
#undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
#undef CLOSEDIR_VOID
|
||||
|
||||
/* Define if the `getpgrp' function takes no argument. */
|
||||
#undef GETPGRP_VOID
|
||||
|
||||
/* Define if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */
|
||||
#undef F77_NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define to the type of arg1 for select(). */
|
||||
#undef SELECT_TYPE_ARG1
|
||||
|
||||
/* Define to the type of args 2, 3 and 4 for select(). */
|
||||
#undef SELECT_TYPE_ARG234
|
||||
|
||||
/* Define to the type of arg5 for select(). */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
#undef VOID_CLOSEDIR
|
||||
|
||||
/* The number of bytes in a off_t. */
|
||||
#undef SIZEOF_OFF_T
|
||||
|
||||
/* Define if you have the err function. */
|
||||
#undef HAVE_ERR
|
||||
|
||||
/* Define if you have the fgetln function. */
|
||||
#undef HAVE_FGETLN
|
||||
|
||||
/* Define if you have the fparseln function. */
|
||||
#undef HAVE_FPARSELN
|
||||
|
||||
/* Define if you have the getaddrinfo function. */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the gethostbyname2 function. */
|
||||
#undef HAVE_GETHOSTBYNAME2
|
||||
|
||||
/* Define if you have the getnameinfo function. */
|
||||
#undef HAVE_GETNAMEINFO
|
||||
|
||||
/* Define if you have the getpassphrase function. */
|
||||
#undef HAVE_GETPASSPHRASE
|
||||
|
||||
/* Define if you have the getpgrp function. */
|
||||
#undef HAVE_GETPGRP
|
||||
|
||||
/* Define if you have the glob function. */
|
||||
#undef HAVE_GLOB
|
||||
|
||||
/* Define if you have the inet_ntop function. */
|
||||
#undef HAVE_INET_NTOP
|
||||
|
||||
/* Define if you have the inet_pton function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define if you have the issetugid function. */
|
||||
#undef HAVE_ISSETUGID
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the mkstemp function. */
|
||||
#undef HAVE_MKSTEMP
|
||||
|
||||
/* Define if you have the poll function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define if you have the sl_init function. */
|
||||
#undef HAVE_SL_INIT
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
|
||||
/* Define if you have the strlcat function. */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcpy function. */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strptime function. */
|
||||
#undef HAVE_STRPTIME
|
||||
|
||||
/* Define if you have the strsep function. */
|
||||
#undef HAVE_STRSEP
|
||||
|
||||
/* Define if you have the strtoll function. */
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
/* Define if you have the strunvis function. */
|
||||
#undef HAVE_STRUNVIS
|
||||
|
||||
/* Define if you have the strvis function. */
|
||||
#undef HAVE_STRVIS
|
||||
|
||||
/* Define if you have the timegm function. */
|
||||
#undef HAVE_TIMEGM
|
||||
|
||||
/* Define if you have the usleep function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#undef HAVE_ERR_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define if you have the <poll.h> header file. */
|
||||
#undef HAVE_POLL_H
|
||||
|
||||
/* Define if you have the <regex.h> header file. */
|
||||
#undef HAVE_REGEX_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define if you have the <termcap.h> header file. */
|
||||
#undef HAVE_TERMCAP_H
|
||||
|
||||
/* Define if you have the <util.h> header file. */
|
||||
#undef HAVE_UTIL_H
|
||||
|
||||
/* Define if you have the <vis.h> header file. */
|
||||
#undef HAVE_VIS_H
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define if you have the tinfo library (-ltinfo). */
|
||||
#undef HAVE_LIBTINFO
|
||||
|
||||
/* Define if you have the util library (-lutil). */
|
||||
#undef HAVE_LIBUTIL
|
||||
|
||||
/* Define if your compiler supports `long long' */
|
||||
#undef HAVE_LONG_LONG
|
||||
|
||||
/* Define if in_port_t exists */
|
||||
#undef HAVE_IN_PORT_T
|
||||
|
||||
/* Define if struct sockaddr.sa_len exists (implies sockaddr_in.sin_len, etc) */
|
||||
#undef HAVE_SOCKADDR_SA_LEN
|
||||
|
||||
/* Define if socklen_t exists */
|
||||
#undef HAVE_SOCKLEN_T
|
||||
|
||||
/* Define if AF_INET6 exists in <sys/socket.h> */
|
||||
#undef HAVE_AF_INET6
|
||||
|
||||
/* Define if `struct sockaddr_in6' exists in <netinet/in.h> */
|
||||
#undef HAVE_SOCKADDR_IN6
|
||||
|
||||
/* Define if `struct addrinfo' exists in <netdb.h> */
|
||||
#undef HAVE_ADDRINFO
|
||||
|
||||
/*
|
||||
* Define if <netdb.h> contains AI_NUMERICHOST et al.
|
||||
* Systems which only implement RFC2133 will need this.
|
||||
*/
|
||||
#undef HAVE_RFC2553_NETDB
|
||||
|
||||
/* Define if `struct direct' has a d_namlen element */
|
||||
#undef HAVE_D_NAMLEN
|
||||
|
||||
/* Define if GLOB_BRACE exists in <glob.h> */
|
||||
#undef HAVE_GLOB_BRACE
|
||||
|
||||
/* Define if h_errno exists in <netdb.h> */
|
||||
#undef HAVE_H_ERRNO_D
|
||||
|
||||
/* Define if fclose() is declared in <stdio.h> */
|
||||
#undef HAVE_FCLOSE_D
|
||||
|
||||
/* Define if getpass() is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_GETPASS_D
|
||||
|
||||
/* Define if optarg is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTARG_D
|
||||
|
||||
/* Define if optind is declared in <stdlib.h> or <unistd.h> */
|
||||
#undef HAVE_OPTIND_D
|
||||
|
||||
/* Define if pclose() is declared in <stdio.h> */
|
||||
#undef HAVE_PCLOSE_D
|
||||
|
||||
/* Define if `long long' is supported and sizeof(off_t) >= 8 */
|
||||
#undef HAVE_QUAD_SUPPORT
|
||||
|
||||
/* Define if strptime() is declared in <time.h> */
|
||||
#undef HAVE_STRPTIME_D
|
||||
|
||||
/*
|
||||
* Define this if compiling with SOCKS (the firewall traversal library).
|
||||
* Also, you must define connect, getsockname, bind, accept, listen, and
|
||||
* select to their R-versions.
|
||||
*/
|
||||
#undef SOCKS
|
||||
#undef SOCKS4
|
||||
#undef SOCKS5
|
||||
#undef connect
|
||||
#undef getsockname
|
||||
#undef bind
|
||||
#undef accept
|
||||
#undef listen
|
||||
#undef select
|
||||
#undef dup
|
||||
#undef dup2
|
||||
#undef fclose
|
||||
#undef gethostbyname
|
||||
#undef getpeername
|
||||
#undef read
|
||||
#undef recv
|
||||
#undef recvfrom
|
||||
#undef rresvport
|
||||
#undef send
|
||||
#undef sendto
|
||||
#undef shutdown
|
||||
#undef write
|
4129
contrib/lukemftp/configure
vendored
Executable file
4129
contrib/lukemftp/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
283
contrib/lukemftp/configure.in
Normal file
283
contrib/lukemftp/configure.in
Normal file
@ -0,0 +1,283 @@
|
||||
dnl $Id: configure.in,v 1.32 2000/09/18 00:10:43 lukem Exp $
|
||||
dnl
|
||||
dnl configure.in --
|
||||
dnl process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_REVISION($Revision: 1.32 $)dnl
|
||||
|
||||
AC_INIT(lukemftp.h)
|
||||
|
||||
dnl Arguments for which features are included
|
||||
dnl
|
||||
AC_ARG_PROGRAM
|
||||
AC_ARG_ENABLE(editcomplete, [\
|
||||
--enable-editcomplete Turn on command line editing and completion.
|
||||
--disable-editcomplete Turn off command line editing and completion
|
||||
[default: enabled].],
|
||||
opt_editcomplete=$enableval,
|
||||
opt_editcomplete=yes)
|
||||
AC_ARG_ENABLE(ipv6, [\
|
||||
--enable-ipv6 Enable IPv6 support (if your OS supports it).
|
||||
--disable-ipv6 Disable IPv6 support (even if your OS supports it)
|
||||
[default: enabled].],
|
||||
opt_ipv6=$enableval,
|
||||
opt_ipv6=yes)
|
||||
|
||||
dnl Checks for programs.
|
||||
dnl
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_CC
|
||||
AC_PROG_AWK
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
AC_CHECK_PROGS(AR, ar)
|
||||
AC_AIX
|
||||
|
||||
|
||||
dnl Checks for libraries.
|
||||
dnl
|
||||
dnl XXX: we check fparseln twice; probably best to fix that
|
||||
AC_CHECK_LIB(util, fparseln)
|
||||
if test $opt_editcomplete = yes; then
|
||||
AC_CHECK_LIB(tinfo, tgetent, ,
|
||||
AC_CHECK_LIB(termcap, tgetent, ,
|
||||
AC_CHECK_LIB(curses, tgetent, ,
|
||||
AC_CHECK_LIB(ncurses, tgetent))))
|
||||
AC_SEARCH_LIBS(el_init, edit, have_libedit=yes, have_libedit=no)
|
||||
fi
|
||||
AC_LIBRARY_NET
|
||||
AC_LIBRARY_SOCKS
|
||||
|
||||
|
||||
dnl Checks for header files.
|
||||
dnl
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(err.h regex.h paths.h poll.h sys/poll.h termcap.h util.h vis.h)
|
||||
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl
|
||||
AC_HEADER_TIME
|
||||
AC_TYPE_OFF_T
|
||||
AC_CHECK_SIZEOF(off_t, 0)
|
||||
AC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [
|
||||
#include <sys/types.h>] , [
|
||||
long long X = 2, Y = 1, Z;
|
||||
Z = X / Y; ], [
|
||||
AC_DEFINE(HAVE_LONG_LONG, 1)
|
||||
have_long_long=yes], [have_long_long=no])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h> ], [
|
||||
struct sockaddr_in sin;
|
||||
int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)])
|
||||
|
||||
if test $opt_ipv6 = yes; then
|
||||
|
||||
AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h> ],
|
||||
[ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h> ],
|
||||
[ struct sockaddr_in6 X ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)])
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h> ],
|
||||
[ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# define dirent direct
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif ], [
|
||||
struct dirent dp;
|
||||
int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for GLOB_BRACE, ftp_cv_have_glob_brace, [
|
||||
#include <glob.h> ], [ int X = GLOB_BRACE ], [:])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for h_errno declaration, ftp_cv_HAVE_H_ERRNO_D, [
|
||||
#include <netdb.h> ], [ int X = h_errno ], [AC_DEFINE(HAVE_H_ERRNO_D, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [
|
||||
#include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for getpass() declaration, ftp_cv_HAVE_GETPASS_D, [
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> ], [ char *(*X)() = getpass ], [
|
||||
AC_DEFINE(HAVE_GETPASS_D, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])
|
||||
|
||||
AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [
|
||||
#include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)])
|
||||
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl
|
||||
AC_REPLACE_FUNCS(err fgetln fparseln getaddrinfo getnameinfo glob inet_ntop \
|
||||
inet_pton mkstemp sl_init snprintf strdup strerror strlcat \
|
||||
strlcpy strptime strsep strunvis strvis timegm usleep)
|
||||
AC_CHECK_FUNCS(gethostbyname2 getpassphrase getpgrp issetugid memmove poll \
|
||||
select)
|
||||
if test $ac_cv_func_getpgrp = yes; then
|
||||
AC_FUNC_GETPGRP
|
||||
fi
|
||||
|
||||
if test $ac_cv_func_strptime = yes; then
|
||||
AC_MSG_TRY_COMPILE(for strptime() declaration, ftp_cv_HAVE_STRPTIME_D, [
|
||||
#include <time.h> ], [ char *X = strptime("", "", NULL) ],
|
||||
[AC_DEFINE(HAVE_STRPTIME_D, 1)])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for GLOB_BRACE support in glob)
|
||||
if test $ftp_cv_have_glob_brace = yes; then
|
||||
AC_DEFINE(HAVE_GLOB_BRACE, 1)
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT([no, using my own])
|
||||
LIBOBJS="$LIBOBJS glob.o"
|
||||
fi
|
||||
|
||||
if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then
|
||||
AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
|
||||
AC_REPLACE_FUNCS(strtoll)
|
||||
AC_MSG_CHECKING(snprintf support for %lld)
|
||||
if test $ac_cv_func_snprintf = yes; then
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
int main() {
|
||||
char buf[100];
|
||||
snprintf(buf, sizeof(buf), "%lld",
|
||||
4294967300LL);
|
||||
return (strcmp(buf, "4294967300"));
|
||||
}
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
have_snprintf_lld=yes
|
||||
], [
|
||||
AC_MSG_RESULT(no, using local version)
|
||||
have_snprintf_lld=no
|
||||
], [
|
||||
AC_MSG_RESULT(cross-compiling, using local version)
|
||||
have_snprintf_lld=no
|
||||
])
|
||||
if test $have_snprintf_lld = no; then
|
||||
LIBOBJS="$LIBOBJS snprintf.o"
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(using local version)
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test $opt_editcomplete = yes; then
|
||||
if test $have_libedit = yes; then
|
||||
AC_MSG_TRY_COMPILE(for EL_RPROMPT in libedit,
|
||||
ftp_cv_have_libedit, [
|
||||
#include <histedit.h> ], [ int X = EL_RPROMPT ], [:],
|
||||
have_libedit=no )
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for working libedit)
|
||||
if test $have_libedit = no; then
|
||||
AC_MSG_RESULT([no, using my own])
|
||||
INCLUDES="-I\${srcdir}/../libedit $INCLUDES"
|
||||
LDFLAGS="-L../libedit $LDFLAGS"
|
||||
LIBS="-ledit $LIBS"
|
||||
LIBEDIT=libedit.a
|
||||
LIBDEPENDS="$LIBDEPENDS ../libedit/libedit.a"
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
fi
|
||||
else
|
||||
CFLAGS="-DNO_EDITCOMPLETE $CFLAGS"
|
||||
fi
|
||||
|
||||
if test $ac_cv_func_sl_init = yes; then
|
||||
AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [
|
||||
#include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ],
|
||||
[:] , [LIBOBJS="$LIBOBJS sl_init.o"])
|
||||
fi
|
||||
|
||||
|
||||
have_rfc2553_netdb=no
|
||||
if test $ac_cv_func_getaddrinfo = yes; then
|
||||
AC_MSG_TRY_COMPILE(for AI_NUMERICHOST, ftp_cv_have_ai_numerichost, [
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h> ],
|
||||
[ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ])
|
||||
fi
|
||||
if test $have_rfc2553_netdb = yes; then
|
||||
AC_DEFINE(HAVE_RFC2553_NETDB, 1)
|
||||
else
|
||||
if test $ac_cv_func_getaddrinfo = yes; then
|
||||
LIBOBJS="$LIBOBJS getaddrinfo.o"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test $ac_cv_header_vis_h = yes; then
|
||||
AC_MSG_TRY_COMPILE(for VIS_WHITE in vis.h,
|
||||
ftp_cv_have_vis_white, [
|
||||
#include <sys/types.h>
|
||||
#include <vis.h> ], [ int X = VIS_WHITE ], [:],
|
||||
ac_cv_header_vis_h=no )
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$LIBOBJS"; then
|
||||
INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
|
||||
LDFLAGS="$LDFLAGS -L../libukem"
|
||||
LIBS="$LIBS -lukem"
|
||||
LIBUKEM=libukem.a
|
||||
LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
|
||||
fi
|
||||
|
||||
dnl Create the Makefiles
|
||||
dnl
|
||||
|
||||
AC_SUBST(INCLUDES)
|
||||
AC_SUBST(LIBEDIT)
|
||||
AC_SUBST(LIBUKEM)
|
||||
AC_SUBST(LIBDEPENDS)
|
||||
|
||||
AC_OUTPUT(Makefile libedit/Makefile libedit/makelist libukem/Makefile \
|
||||
src/Makefile)
|
251
contrib/lukemftp/install-sh
Executable file
251
contrib/lukemftp/install-sh
Executable file
@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
379
contrib/lukemftp/lukemftp.h
Normal file
379
contrib/lukemftp/lukemftp.h
Normal file
@ -0,0 +1,379 @@
|
||||
/* $Id: lukemftp.h,v 1.36 2000/10/11 03:07:36 lukem Exp $ */
|
||||
|
||||
#define FTP_PRODUCT "lukemftp"
|
||||
#define FTP_VERSION "1.5"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <arpa/ftp.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <netdb.h>
|
||||
#include <pwd.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_POLL
|
||||
# if HAVE_POLL_H
|
||||
# include <poll.h>
|
||||
# elif HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
# endif
|
||||
#elif HAVE_SELECT
|
||||
# define USE_SELECT
|
||||
#else
|
||||
# error "no poll() or select() found"
|
||||
#endif
|
||||
|
||||
#if HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#else
|
||||
# define dirent direct
|
||||
# if HAVE_SYS_NDIR_H
|
||||
# include <sys/ndir.h>
|
||||
# endif
|
||||
# if HAVE_SYS_DIR_H
|
||||
# include <sys/dir.h>
|
||||
# endif
|
||||
# if HAVE_NDIR_H
|
||||
# include <ndir.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if TIME_WITH_SYS_TIME
|
||||
# include <sys/time.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
# if HAVE_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
# else
|
||||
# include <time.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if HAVE_ERR_H
|
||||
# include <err.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_GLOB_BRACE
|
||||
# include <glob.h>
|
||||
#else
|
||||
# include "ftpglob.h"
|
||||
#endif
|
||||
|
||||
#if HAVE_PATHS_H
|
||||
# include <paths.h>
|
||||
#else
|
||||
# define _PATH_BSHELL "/bin/sh"
|
||||
# define _PATH_TMP "/tmp/"
|
||||
#endif
|
||||
|
||||
typedef struct _stringlist {
|
||||
char **sl_str;
|
||||
size_t sl_max;
|
||||
size_t sl_cur;
|
||||
} StringList;
|
||||
|
||||
StringList *sl_init(void);
|
||||
int sl_add(StringList *, char *);
|
||||
void sl_free(StringList *, int);
|
||||
char *sl_find(StringList *, char *);
|
||||
|
||||
#if HAVE_TERMCAP_H
|
||||
# include <termcap.h>
|
||||
#else
|
||||
int tgetent(char *, const char *);
|
||||
char *tgetstr(const char *, char **);
|
||||
int tgetflag(const char *);
|
||||
int tgetnum(const char *);
|
||||
char *tgoto(const char *, int, int);
|
||||
void tputs(const char *, int, int (*)(int));
|
||||
#endif
|
||||
|
||||
#if HAVE_UTIL_H
|
||||
# include <util.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_VIS_H
|
||||
# include <vis.h>
|
||||
#else
|
||||
# include "ftpvis.h"
|
||||
#endif
|
||||
|
||||
#if ! HAVE_IN_PORT_T
|
||||
typedef unsigned short in_port_t;
|
||||
#endif
|
||||
|
||||
#if ! HAVE_SOCKLEN_T
|
||||
typedef unsigned int socklen_t;
|
||||
#endif
|
||||
|
||||
#if HAVE_AF_INET6 && HAVE_SOCKADDR_IN6
|
||||
# define INET6
|
||||
#endif
|
||||
|
||||
|
||||
#if ! HAVE_RFC2553_NETDB
|
||||
|
||||
/* RFC 2553 */
|
||||
#undef EAI_ADDRFAMILY
|
||||
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
|
||||
#undef EAI_AGAIN
|
||||
#define EAI_AGAIN 2 /* temporary failure in name resolution */
|
||||
#undef EAI_BADFLAGS
|
||||
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
||||
#undef EAI_FAIL
|
||||
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
|
||||
#undef EAI_FAMILY
|
||||
#define EAI_FAMILY 5 /* ai_family not supported */
|
||||
#undef EAI_MEMORY
|
||||
#define EAI_MEMORY 6 /* memory allocation failure */
|
||||
#undef EAI_NODATA
|
||||
#define EAI_NODATA 7 /* no address associated with hostname */
|
||||
#undef EAI_NONAME
|
||||
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
|
||||
#undef EAI_SERVICE
|
||||
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
|
||||
#undef EAI_SOCKTYPE
|
||||
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
||||
#undef EAI_SYSTEM
|
||||
#define EAI_SYSTEM 11 /* system error returned in errno */
|
||||
|
||||
/* KAME extensions? */
|
||||
#undef EAI_BADHINTS
|
||||
#define EAI_BADHINTS 12
|
||||
#undef EAI_PROTOCOL
|
||||
#define EAI_PROTOCOL 13
|
||||
#undef EAI_MAX
|
||||
#define EAI_MAX 14
|
||||
|
||||
/* RFC 2553 */
|
||||
#undef NI_MAXHOST
|
||||
#define NI_MAXHOST 1025
|
||||
#undef NI_MAXSERV
|
||||
#define NI_MAXSERV 32
|
||||
|
||||
#undef NI_NOFQDN
|
||||
#define NI_NOFQDN 0x00000001
|
||||
#undef NI_NUMERICHOST
|
||||
#define NI_NUMERICHOST 0x00000002
|
||||
#undef NI_NAMEREQD
|
||||
#define NI_NAMEREQD 0x00000004
|
||||
#undef NI_NUMERICSERV
|
||||
#define NI_NUMERICSERV 0x00000008
|
||||
#undef NI_DGRAM
|
||||
#define NI_DGRAM 0x00000010
|
||||
|
||||
/* RFC 2553 */
|
||||
#undef AI_PASSIVE
|
||||
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
|
||||
#undef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
|
||||
|
||||
/* KAME extensions ? */
|
||||
#undef AI_NUMERICHOST
|
||||
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
|
||||
#undef AI_MASK
|
||||
#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
|
||||
|
||||
/* RFC 2553 */
|
||||
#undef AI_ALL
|
||||
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
|
||||
#undef AI_V4MAPPED_CFG
|
||||
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
|
||||
#undef AI_ADDRCONFIG
|
||||
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
|
||||
#undef AI_V4MAPPED
|
||||
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
|
||||
|
||||
#endif /* ! HAVE_RFC2553_NETDB */
|
||||
|
||||
|
||||
#if ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO
|
||||
|
||||
struct addrinfo {
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
size_t ai_addrlen; /* length of ai_addr */
|
||||
char *ai_canonname; /* canonical name for hostname */
|
||||
struct sockaddr *ai_addr; /* binary address */
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
|
||||
int getaddrinfo(const char *, const char *,
|
||||
const struct addrinfo *, struct addrinfo **);
|
||||
int getnameinfo(const struct sockaddr *, socklen_t, char *,
|
||||
size_t, char *, size_t, int);
|
||||
void freeaddrinfo(struct addrinfo *);
|
||||
char *gai_strerror(int);
|
||||
|
||||
#endif /* ! HAVE_RFC2553_NETDB && ! HAVE_ADDRINFO */
|
||||
|
||||
|
||||
#if ! HAVE_D_NAMLEN
|
||||
# define DIRENT_MISSING_D_NAMLEN
|
||||
#endif
|
||||
|
||||
#if ! HAVE_H_ERRNO_D
|
||||
extern int h_errno;
|
||||
#endif
|
||||
#define HAVE_H_ERRNO 1 /* XXX: an assumption for now... */
|
||||
|
||||
#if ! HAVE_FCLOSE_D
|
||||
int fclose(FILE *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_GETPASS_D
|
||||
char *getpass(const char *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_OPTARG_D
|
||||
extern char *optarg;
|
||||
#endif
|
||||
|
||||
#if ! HAVE_OPTIND_D
|
||||
extern int optind;
|
||||
#endif
|
||||
|
||||
#if ! HAVE_PCLOSE_D
|
||||
int pclose(FILE *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_ERR
|
||||
void err(int, const char *, ...);
|
||||
void errx(int, const char *, ...);
|
||||
void warn(const char *, ...);
|
||||
void warnx(const char *, ...);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_FGETLN
|
||||
char *fgetln(FILE *, size_t *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_FPARSELN
|
||||
# define FPARSELN_UNESCESC 0x01
|
||||
# define FPARSELN_UNESCCONT 0x02
|
||||
# define FPARSELN_UNESCCOMM 0x04
|
||||
# define FPARSELN_UNESCREST 0x08
|
||||
# define FPARSELN_UNESCALL 0x0f
|
||||
char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_INET_NTOP
|
||||
const char *inet_ntop(int, const void *, char *, size_t);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_MKSTEMP
|
||||
int mkstemp(char *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_SNPRINTF
|
||||
int snprintf(char *, size_t, const char *, ...);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRDUP
|
||||
char *strdup(const char *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRERROR
|
||||
char *strerror(int);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRPTIME || ! HAVE_STRPTIME_D
|
||||
char *strptime(const char *, const char *, struct tm *);
|
||||
#endif
|
||||
|
||||
#if HAVE_QUAD_SUPPORT
|
||||
# if ! HAVE_STRTOLL && HAVE_LONG_LONG
|
||||
long long strtoll(const char *, char **, int);
|
||||
# if ! defined(QUAD_MIN)
|
||||
# define QUAD_MIN (-0x7fffffffffffffffL-1)
|
||||
# endif
|
||||
# if ! defined(QUAD_MAX)
|
||||
# define QUAD_MAX (0x7fffffffffffffffL)
|
||||
# endif
|
||||
# endif
|
||||
#else /* ! HAVE_QUAD_SUPPORT */
|
||||
# define NO_LONG_LONG 1
|
||||
#endif /* ! HAVE_QUAD_SUPPORT */
|
||||
|
||||
#if ! HAVE_TIMEGM
|
||||
time_t timegm(struct tm *);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_HSTRERROR
|
||||
char *strerror(int);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRLCAT
|
||||
size_t strlcat(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRLCPY
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_STRSEP
|
||||
char *strsep(char **stringp, const char *delim);
|
||||
#endif
|
||||
|
||||
#if ! HAVE_MEMMOVE
|
||||
# define memmove(a,b,c) bcopy((b),(a),(c))
|
||||
/* XXX: add others #defines for borken systems? */
|
||||
#endif
|
||||
|
||||
#if HAVE_GETPASSPHRASE
|
||||
# define getpass getpassphrase
|
||||
#endif
|
||||
|
||||
#if ! defined(MIN)
|
||||
# define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#if ! defined(MAX)
|
||||
# define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
#if ! defined(timersub)
|
||||
# define timersub(tvp, uvp, vvp) \
|
||||
do { \
|
||||
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
|
||||
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
|
||||
if ((vvp)->tv_usec < 0) { \
|
||||
(vvp)->tv_sec--; \
|
||||
(vvp)->tv_usec += 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#if ! defined(S_ISLNK)
|
||||
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
|
||||
#endif
|
||||
|
||||
#define EPOCH_YEAR 1970
|
||||
#define SECSPERHOUR 3600
|
||||
#define SECSPERDAY 86400
|
||||
#define TM_YEAR_BASE 1900
|
43
contrib/lukemftp/src/Makefile.in
Normal file
43
contrib/lukemftp/src/Makefile.in
Normal file
@ -0,0 +1,43 @@
|
||||
#
|
||||
# $Id: Makefile.in,v 1.8 2000/08/08 07:04:27 lukem Exp $
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
SHELL = /bin/sh
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = @bindir@
|
||||
mandir = @mandir@
|
||||
transform = @program_transform_name@
|
||||
|
||||
mandircat1 = ${mandir}/cat1
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = -I${srcdir} -I${srcdir}/.. -I. -I.. @INCLUDES@ @CFLAGS@
|
||||
LIBS = @LIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
PROG = ftp
|
||||
OBJS = cmds.o cmdtab.o complete.o domacro.o fetch.o ftp.o main.o \
|
||||
ruserpass.o util.o
|
||||
|
||||
all: ${PROG}
|
||||
|
||||
install: all
|
||||
-mkdir -p ${bindir}
|
||||
${INSTALL} -m 555 ${PROG} ${bindir}/`echo ${PROG}|sed '$(transform)'`
|
||||
-mkdir -p ${mandircat1}
|
||||
${INSTALL} -m 444 ${srcdir}/${PROG}.cat1 ${mandircat1}/`echo ${PROG}|sed '$(transform)'`.1
|
||||
|
||||
${PROG}: ${OBJS} @LIBDEPENDS@
|
||||
${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f core ${PROG} ${OBJS}
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
2673
contrib/lukemftp/src/cmds.c
Normal file
2673
contrib/lukemftp/src/cmds.c
Normal file
File diff suppressed because it is too large
Load Diff
291
contrib/lukemftp/src/cmdtab.c
Normal file
291
contrib/lukemftp/src/cmdtab.c
Normal file
@ -0,0 +1,291 @@
|
||||
/* $NetBSD: cmdtab.c,v 1.38 2000/09/14 13:48:33 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include "lukemftp.h"
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
/*
|
||||
* User FTP -- Command Tables.
|
||||
*/
|
||||
|
||||
char accounthelp[] = "send account command to remote server";
|
||||
char appendhelp[] = "append to a file";
|
||||
char asciihelp[] = "set ascii transfer type";
|
||||
char beephelp[] = "beep when command completed";
|
||||
char binaryhelp[] = "set binary transfer type";
|
||||
char casehelp[] = "toggle mget upper/lower case id mapping";
|
||||
char cdhelp[] = "change remote working directory";
|
||||
char cduphelp[] = "change remote working directory to parent directory";
|
||||
char chmodhelp[] = "change file permissions of remote file";
|
||||
char connecthelp[] = "connect to remote ftp server";
|
||||
char crhelp[] = "toggle carriage return stripping on ascii gets";
|
||||
char debughelp[] = "toggle/set debugging mode";
|
||||
char deletehelp[] = "delete remote file";
|
||||
char disconhelp[] = "terminate ftp session";
|
||||
char domachelp[] = "execute macro";
|
||||
char edithelp[] = "toggle command line editing";
|
||||
char epsv4help[] = "toggle use of EPSV/EPRT on IPv4 ftp";
|
||||
char feathelp[] = "show FEATures supported by remote system";
|
||||
char formhelp[] = "set file transfer format";
|
||||
char gatehelp[] = "toggle gate-ftp; specify host[:port] to change proxy";
|
||||
char globhelp[] = "toggle metacharacter expansion of local file names";
|
||||
char hashhelp[] = "toggle printing `#' marks; specify number to set size";
|
||||
char helphelp[] = "print local help information";
|
||||
char idlehelp[] = "get (set) idle timer on remote side";
|
||||
char lcdhelp[] = "change local working directory";
|
||||
char lpagehelp[] = "view a local file through your pager";
|
||||
char lpwdhelp[] = "print local working directory";
|
||||
char lshelp[] = "list contents of remote path";
|
||||
char macdefhelp[] = "define a macro";
|
||||
char mdeletehelp[] = "delete multiple files";
|
||||
char mgethelp[] = "get multiple files";
|
||||
char fgethelp[] = "get files using a localfile as a source of names";
|
||||
char mkdirhelp[] = "make directory on the remote machine";
|
||||
char mlshelp[] = "list contents of multiple remote directories";
|
||||
char mlsdhelp[] = "list contents of remote directory in a machine "
|
||||
"parsable form";
|
||||
char mlsthelp[] = "list remote path in a machine parsable form";
|
||||
char modehelp[] = "set file transfer mode";
|
||||
char modtimehelp[] = "show last modification time of remote file";
|
||||
char mputhelp[] = "send multiple files";
|
||||
char newerhelp[] = "get file if remote file is newer than local file ";
|
||||
char nmaphelp[] = "set templates for default file name mapping";
|
||||
char ntranshelp[] = "set translation table for default file name mapping";
|
||||
char optshelp[] = "show or set options for remote commands";
|
||||
char pagehelp[] = "view a remote file through your pager";
|
||||
char passivehelp[] = "enter passive transfer mode";
|
||||
char plshelp[] = "list contents of remote path through your pager";
|
||||
char pmlsdhelp[] = "list contents of remote directory in a machine "
|
||||
"parsable form through your pager";
|
||||
char porthelp[] = "toggle use of PORT/LPRT cmd for each data connection";
|
||||
char preservehelp[] ="toggle preservation of modification time of "
|
||||
"retrieved files";
|
||||
char progresshelp[] ="toggle transfer progress meter";
|
||||
char prompthelp[] = "force interactive prompting on multiple commands";
|
||||
char proxyhelp[] = "issue command on alternate connection";
|
||||
char pwdhelp[] = "print working directory on remote machine";
|
||||
char quithelp[] = "terminate ftp session and exit";
|
||||
char quotehelp[] = "send arbitrary ftp command";
|
||||
char ratehelp[] = "set transfer rate limit (in bytes/second)";
|
||||
char receivehelp[] = "receive file";
|
||||
char regethelp[] = "get file restarting at end of local file";
|
||||
char remotehelp[] = "get help from remote server";
|
||||
char renamehelp[] = "rename file";
|
||||
char resethelp[] = "clear queued command replies";
|
||||
char restarthelp[]= "restart file transfer at bytecount";
|
||||
char rmdirhelp[] = "remove directory on the remote machine";
|
||||
char rmtstatushelp[]="show status of remote machine";
|
||||
char runiquehelp[] = "toggle store unique for local files";
|
||||
char sendhelp[] = "send one file";
|
||||
char sethelp[] = "set or display options";
|
||||
char shellhelp[] = "escape to the shell";
|
||||
char sitehelp[] = "send site specific command to remote server\n"
|
||||
"\t\tTry \"rhelp site\" or \"site help\" "
|
||||
"for more information";
|
||||
char sizecmdhelp[] = "show size of remote file";
|
||||
char statushelp[] = "show current status";
|
||||
char structhelp[] = "set file transfer structure";
|
||||
char suniquehelp[] = "toggle store unique on remote machine";
|
||||
char systemhelp[] = "show remote system type";
|
||||
char tenexhelp[] = "set tenex file transfer type";
|
||||
char tracehelp[] = "toggle packet tracing";
|
||||
char typehelp[] = "set file transfer type";
|
||||
char umaskhelp[] = "get (set) umask on remote side";
|
||||
char unsethelp[] = "unset an option";
|
||||
char usagehelp[] = "show command usage";
|
||||
char userhelp[] = "send new user information";
|
||||
char verbosehelp[] = "toggle verbose mode";
|
||||
char xferbufhelp[] = "set socket send/receive buffer size";
|
||||
|
||||
#ifdef NO_EDITCOMPLETE
|
||||
#define CMPL(x)
|
||||
#define CMPL0
|
||||
#else /* !NO_EDITCOMPLETE */
|
||||
#define CMPL(x) #x,
|
||||
#define CMPL0 "",
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
struct cmd cmdtab[] = {
|
||||
{ "!", shellhelp, 0, 0, 0, CMPL0 shell },
|
||||
{ "$", domachelp, 1, 0, 0, CMPL0 domacro },
|
||||
{ "account", accounthelp, 0, 1, 1, CMPL0 account},
|
||||
{ "append", appendhelp, 1, 1, 1, CMPL(lr) put },
|
||||
{ "ascii", asciihelp, 0, 1, 1, CMPL0 setascii },
|
||||
{ "bell", beephelp, 0, 0, 0, CMPL0 setbell },
|
||||
{ "binary", binaryhelp, 0, 1, 1, CMPL0 setbinary },
|
||||
{ "bye", quithelp, 0, 0, 0, CMPL0 quit },
|
||||
{ "case", casehelp, 0, 0, 1, CMPL0 setcase },
|
||||
{ "cd", cdhelp, 0, 1, 1, CMPL(r) cd },
|
||||
{ "cdup", cduphelp, 0, 1, 1, CMPL0 cdup },
|
||||
{ "chmod", chmodhelp, 0, 1, 1, CMPL(nr) do_chmod },
|
||||
{ "close", disconhelp, 0, 1, 1, CMPL0 disconnect },
|
||||
{ "cr", crhelp, 0, 0, 0, CMPL0 setcr },
|
||||
{ "debug", debughelp, 0, 0, 0, CMPL0 setdebug },
|
||||
{ "delete", deletehelp, 0, 1, 1, CMPL(r) delete },
|
||||
{ "dir", lshelp, 1, 1, 1, CMPL(rl) ls },
|
||||
{ "disconnect", disconhelp, 0, 1, 1, CMPL0 disconnect },
|
||||
{ "edit", edithelp, 0, 0, 0, CMPL0 setedit },
|
||||
{ "epsv4", epsv4help, 0, 0, 0, CMPL0 setepsv4 },
|
||||
{ "exit", quithelp, 0, 0, 0, CMPL0 quit },
|
||||
{ "features", feathelp, 0, 1, 1, CMPL0 feat },
|
||||
{ "fget", fgethelp, 1, 1, 1, CMPL(l) fget },
|
||||
{ "form", formhelp, 0, 1, 1, CMPL0 setform },
|
||||
{ "ftp", connecthelp, 0, 0, 1, CMPL0 setpeer },
|
||||
{ "gate", gatehelp, 0, 0, 0, CMPL0 setgate },
|
||||
{ "get", receivehelp, 1, 1, 1, CMPL(rl) get },
|
||||
{ "glob", globhelp, 0, 0, 0, CMPL0 setglob },
|
||||
{ "hash", hashhelp, 0, 0, 0, CMPL0 sethash },
|
||||
{ "help", helphelp, 0, 0, 1, CMPL(C) help },
|
||||
{ "idle", idlehelp, 0, 1, 1, CMPL0 idlecmd },
|
||||
{ "image", binaryhelp, 0, 1, 1, CMPL0 setbinary },
|
||||
{ "lcd", lcdhelp, 0, 0, 0, CMPL(l) lcd },
|
||||
{ "less", pagehelp, 1, 1, 1, CMPL(r) page },
|
||||
{ "lpage", lpagehelp, 0, 0, 0, CMPL(l) lpage },
|
||||
{ "lpwd", lpwdhelp, 0, 0, 0, CMPL0 lpwd },
|
||||
{ "ls", lshelp, 1, 1, 1, CMPL(rl) ls },
|
||||
{ "macdef", macdefhelp, 0, 0, 0, CMPL0 macdef },
|
||||
{ "mdelete", mdeletehelp, 1, 1, 1, CMPL(R) mdelete },
|
||||
{ "mdir", mlshelp, 1, 1, 1, CMPL(R) mls },
|
||||
{ "mget", mgethelp, 1, 1, 1, CMPL(R) mget },
|
||||
{ "mkdir", mkdirhelp, 0, 1, 1, CMPL(r) makedir },
|
||||
{ "mls", mlshelp, 1, 1, 1, CMPL(R) mls },
|
||||
{ "mlsd", mlsdhelp, 1, 1, 1, CMPL(r) ls },
|
||||
{ "mlst", mlsthelp, 1, 1, 1, CMPL(r) mlst },
|
||||
{ "mode", modehelp, 0, 1, 1, CMPL0 setftmode },
|
||||
{ "modtime", modtimehelp, 0, 1, 1, CMPL(r) modtime },
|
||||
{ "more", pagehelp, 1, 1, 1, CMPL(r) page },
|
||||
{ "mput", mputhelp, 1, 1, 1, CMPL(L) mput },
|
||||
{ "msend", mputhelp, 1, 1, 1, CMPL(L) mput },
|
||||
{ "newer", newerhelp, 1, 1, 1, CMPL(r) newer },
|
||||
{ "nlist", lshelp, 1, 1, 1, CMPL(rl) ls },
|
||||
{ "nmap", nmaphelp, 0, 0, 1, CMPL0 setnmap },
|
||||
{ "ntrans", ntranshelp, 0, 0, 1, CMPL0 setntrans },
|
||||
{ "open", connecthelp, 0, 0, 1, CMPL0 setpeer },
|
||||
{ "page", pagehelp, 1, 1, 1, CMPL(r) page },
|
||||
{ "passive", passivehelp, 0, 0, 0, CMPL0 setpassive },
|
||||
{ "pdir", plshelp, 1, 1, 1, CMPL(r) ls },
|
||||
{ "pls", plshelp, 1, 1, 1, CMPL(r) ls },
|
||||
{ "pmlsd", pmlsdhelp, 1, 1, 1, CMPL(r) ls },
|
||||
{ "preserve", preservehelp, 0, 0, 0, CMPL0 setpreserve },
|
||||
{ "progress", progresshelp, 0, 0, 0, CMPL0 setprogress },
|
||||
{ "prompt", prompthelp, 0, 0, 0, CMPL0 setprompt },
|
||||
{ "proxy", proxyhelp, 0, 0, 1, CMPL(c) doproxy },
|
||||
{ "put", sendhelp, 1, 1, 1, CMPL(lr) put },
|
||||
{ "pwd", pwdhelp, 0, 1, 1, CMPL0 pwd },
|
||||
{ "quit", quithelp, 0, 0, 0, CMPL0 quit },
|
||||
{ "quote", quotehelp, 1, 1, 1, CMPL0 quote },
|
||||
{ "rate", ratehelp, 0, 0, 0, CMPL0 setrate },
|
||||
{ "rcvbuf", xferbufhelp, 0, 0, 0, CMPL0 setxferbuf },
|
||||
{ "recv", receivehelp, 1, 1, 1, CMPL(rl) get },
|
||||
{ "reget", regethelp, 1, 1, 1, CMPL(rl) reget },
|
||||
{ "remopts", optshelp, 0, 1, 1, CMPL0 opts },
|
||||
{ "rename", renamehelp, 0, 1, 1, CMPL(rr) renamefile },
|
||||
{ "reset", resethelp, 0, 1, 1, CMPL0 reset },
|
||||
{ "restart", restarthelp, 1, 1, 1, CMPL0 restart },
|
||||
{ "rhelp", remotehelp, 0, 1, 1, CMPL0 rmthelp },
|
||||
{ "rmdir", rmdirhelp, 0, 1, 1, CMPL(r) removedir },
|
||||
{ "rstatus", rmtstatushelp, 0, 1, 1, CMPL(r) rmtstatus },
|
||||
{ "runique", runiquehelp, 0, 0, 1, CMPL0 setrunique },
|
||||
{ "send", sendhelp, 1, 1, 1, CMPL(lr) put },
|
||||
{ "sendport", porthelp, 0, 0, 0, CMPL0 setport },
|
||||
{ "set", sethelp, 0, 0, 0, CMPL(o) setoption },
|
||||
{ "site", sitehelp, 0, 1, 1, CMPL0 site },
|
||||
{ "size", sizecmdhelp, 1, 1, 1, CMPL(r) sizecmd },
|
||||
{ "sndbuf", xferbufhelp, 0, 0, 0, CMPL0 setxferbuf },
|
||||
{ "status", statushelp, 0, 0, 1, CMPL0 status },
|
||||
{ "struct", structhelp, 0, 1, 1, CMPL0 setstruct },
|
||||
{ "sunique", suniquehelp, 0, 0, 1, CMPL0 setsunique },
|
||||
{ "system", systemhelp, 0, 1, 1, CMPL0 syst },
|
||||
{ "tenex", tenexhelp, 0, 1, 1, CMPL0 settenex },
|
||||
{ "throttle", ratehelp, 0, 0, 0, CMPL0 setrate },
|
||||
{ "trace", tracehelp, 0, 0, 0, CMPL0 settrace },
|
||||
{ "type", typehelp, 0, 1, 1, CMPL0 settype },
|
||||
{ "umask", umaskhelp, 0, 1, 1, CMPL0 do_umask },
|
||||
{ "unset", unsethelp, 0, 0, 0, CMPL(o) unsetoption },
|
||||
{ "usage", usagehelp, 0, 0, 1, CMPL(C) help },
|
||||
{ "user", userhelp, 0, 1, 1, CMPL0 user },
|
||||
{ "verbose", verbosehelp, 0, 0, 0, CMPL0 setverbose },
|
||||
{ "xferbuf", xferbufhelp, 0, 0, 0, CMPL0 setxferbuf },
|
||||
{ "?", helphelp, 0, 0, 1, CMPL(C) help },
|
||||
{ 0 },
|
||||
};
|
||||
|
||||
struct option optiontab[] = {
|
||||
{ "anonpass", NULL },
|
||||
{ "ftp_proxy", NULL },
|
||||
{ "http_proxy", NULL },
|
||||
{ "no_proxy", NULL },
|
||||
{ "pager", NULL },
|
||||
{ "prompt", NULL },
|
||||
{ "rprompt", NULL },
|
||||
{ 0 },
|
||||
};
|
423
contrib/lukemftp/src/complete.c
Normal file
423
contrib/lukemftp/src/complete.c
Normal file
@ -0,0 +1,423 @@
|
||||
/* $NetBSD: complete.c,v 1.38 2000/05/01 10:35:17 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FTP user program - command and file completion routines
|
||||
*/
|
||||
|
||||
#include "lukemftp.h"
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
|
||||
static int comparstr (const void *, const void *);
|
||||
static unsigned char complete_ambiguous (char *, int, StringList *);
|
||||
static unsigned char complete_command (char *, int);
|
||||
static unsigned char complete_local (char *, int);
|
||||
static unsigned char complete_option (char *, int);
|
||||
static unsigned char complete_remote (char *, int);
|
||||
|
||||
static int
|
||||
comparstr(const void *a, const void *b)
|
||||
{
|
||||
return (strcmp(*(const char **)a, *(const char **)b));
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine if complete is ambiguous. If unique, insert.
|
||||
* If no choices, error. If unambiguous prefix, insert that.
|
||||
* Otherwise, list choices. words is assumed to be filtered
|
||||
* to only contain possible choices.
|
||||
* Args:
|
||||
* word word which started the match
|
||||
* list list by default
|
||||
* words stringlist containing possible matches
|
||||
* Returns a result as per el_set(EL_ADDFN, ...)
|
||||
*/
|
||||
static unsigned char
|
||||
complete_ambiguous(char *word, int list, StringList *words)
|
||||
{
|
||||
char insertstr[MAXPATHLEN];
|
||||
char *lastmatch, *p;
|
||||
int i, j;
|
||||
size_t matchlen, wordlen;
|
||||
|
||||
wordlen = strlen(word);
|
||||
if (words->sl_cur == 0)
|
||||
return (CC_ERROR); /* no choices available */
|
||||
|
||||
if (words->sl_cur == 1) { /* only once choice available */
|
||||
p = words->sl_str[0] + wordlen;
|
||||
if (*p == '\0') /* at end of word? */
|
||||
return (CC_REFRESH);
|
||||
ftpvis(insertstr, sizeof(insertstr), p, strlen(p));
|
||||
if (el_insertstr(el, insertstr) == -1)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
|
||||
if (!list) {
|
||||
matchlen = 0;
|
||||
lastmatch = words->sl_str[0];
|
||||
matchlen = strlen(lastmatch);
|
||||
for (i = 1 ; i < words->sl_cur ; i++) {
|
||||
for (j = wordlen ; j < strlen(words->sl_str[i]); j++)
|
||||
if (lastmatch[j] != words->sl_str[i][j])
|
||||
break;
|
||||
if (j < matchlen)
|
||||
matchlen = j;
|
||||
}
|
||||
if (matchlen > wordlen) {
|
||||
ftpvis(insertstr, sizeof(insertstr),
|
||||
lastmatch + wordlen, matchlen - wordlen);
|
||||
if (el_insertstr(el, insertstr) == -1)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_REFRESH_BEEP);
|
||||
}
|
||||
}
|
||||
|
||||
putc('\n', ttyout);
|
||||
qsort(words->sl_str, words->sl_cur, sizeof(char *), comparstr);
|
||||
list_vertical(words);
|
||||
return (CC_REDISPLAY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Complete a command
|
||||
*/
|
||||
static unsigned char
|
||||
complete_command(char *word, int list)
|
||||
{
|
||||
struct cmd *c;
|
||||
StringList *words;
|
||||
size_t wordlen;
|
||||
unsigned char rv;
|
||||
|
||||
words = xsl_init();
|
||||
wordlen = strlen(word);
|
||||
|
||||
for (c = cmdtab; c->c_name != NULL; c++) {
|
||||
if (wordlen > strlen(c->c_name))
|
||||
continue;
|
||||
if (strncmp(word, c->c_name, wordlen) == 0)
|
||||
xsl_add(words, c->c_name);
|
||||
}
|
||||
|
||||
rv = complete_ambiguous(word, list, words);
|
||||
if (rv == CC_REFRESH) {
|
||||
if (el_insertstr(el, " ") == -1)
|
||||
rv = CC_ERROR;
|
||||
}
|
||||
sl_free(words, 0);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Complete a local file
|
||||
*/
|
||||
static unsigned char
|
||||
complete_local(char *word, int list)
|
||||
{
|
||||
StringList *words;
|
||||
char dir[MAXPATHLEN];
|
||||
char *file;
|
||||
DIR *dd;
|
||||
struct dirent *dp;
|
||||
unsigned char rv;
|
||||
size_t len;
|
||||
|
||||
if ((file = strrchr(word, '/')) == NULL) {
|
||||
dir[0] = '.';
|
||||
dir[1] = '\0';
|
||||
file = word;
|
||||
} else {
|
||||
if (file == word) {
|
||||
dir[0] = '/';
|
||||
dir[1] = '\0';
|
||||
} else
|
||||
(void)strlcpy(dir, word, file - word + 1);
|
||||
file++;
|
||||
}
|
||||
if (dir[0] == '~') {
|
||||
char *p;
|
||||
|
||||
if ((p = globulize(dir)) == NULL)
|
||||
return (CC_ERROR);
|
||||
(void)strlcpy(dir, p, sizeof(dir));
|
||||
free(p);
|
||||
}
|
||||
|
||||
if ((dd = opendir(dir)) == NULL)
|
||||
return (CC_ERROR);
|
||||
|
||||
words = xsl_init();
|
||||
len = strlen(file);
|
||||
|
||||
for (dp = readdir(dd); dp != NULL; dp = readdir(dd)) {
|
||||
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
|
||||
continue;
|
||||
|
||||
#if defined(DIRENT_MISSING_D_NAMLEN)
|
||||
if (len > strlen(dp->d_name))
|
||||
continue;
|
||||
#else
|
||||
if (len > dp->d_namlen)
|
||||
continue;
|
||||
#endif
|
||||
if (strncmp(file, dp->d_name, len) == 0) {
|
||||
char *tcp;
|
||||
|
||||
tcp = xstrdup(dp->d_name);
|
||||
xsl_add(words, tcp);
|
||||
}
|
||||
}
|
||||
closedir(dd);
|
||||
|
||||
rv = complete_ambiguous(file, list, words);
|
||||
if (rv == CC_REFRESH) {
|
||||
struct stat sb;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
(void)strlcpy(path, dir, sizeof(path));
|
||||
(void)strlcat(path, "/", sizeof(path));
|
||||
(void)strlcat(path, words->sl_str[0], sizeof(path));
|
||||
|
||||
if (stat(path, &sb) >= 0) {
|
||||
char suffix[2] = " ";
|
||||
|
||||
if (S_ISDIR(sb.st_mode))
|
||||
suffix[0] = '/';
|
||||
if (el_insertstr(el, suffix) == -1)
|
||||
rv = CC_ERROR;
|
||||
}
|
||||
}
|
||||
sl_free(words, 1);
|
||||
return (rv);
|
||||
}
|
||||
/*
|
||||
* Complete an option
|
||||
*/
|
||||
static unsigned char
|
||||
complete_option(char *word, int list)
|
||||
{
|
||||
struct option *o;
|
||||
StringList *words;
|
||||
size_t wordlen;
|
||||
unsigned char rv;
|
||||
|
||||
words = xsl_init();
|
||||
wordlen = strlen(word);
|
||||
|
||||
for (o = optiontab; o->name != NULL; o++) {
|
||||
if (wordlen > strlen(o->name))
|
||||
continue;
|
||||
if (strncmp(word, o->name, wordlen) == 0)
|
||||
xsl_add(words, o->name);
|
||||
}
|
||||
|
||||
rv = complete_ambiguous(word, list, words);
|
||||
if (rv == CC_REFRESH) {
|
||||
if (el_insertstr(el, " ") == -1)
|
||||
rv = CC_ERROR;
|
||||
}
|
||||
sl_free(words, 0);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Complete a remote file
|
||||
*/
|
||||
static unsigned char
|
||||
complete_remote(char *word, int list)
|
||||
{
|
||||
static StringList *dirlist;
|
||||
static char lastdir[MAXPATHLEN];
|
||||
StringList *words;
|
||||
char dir[MAXPATHLEN];
|
||||
char *file, *cp;
|
||||
int i;
|
||||
unsigned char rv;
|
||||
|
||||
char *dummyargv[] = { "complete", NULL, NULL };
|
||||
dummyargv[1] = dir;
|
||||
|
||||
if ((file = strrchr(word, '/')) == NULL) {
|
||||
dir[0] = '\0';
|
||||
file = word;
|
||||
} else {
|
||||
cp = file;
|
||||
while (*cp == '/' && cp > word)
|
||||
cp--;
|
||||
(void)strlcpy(dir, word, cp - word + 2);
|
||||
file++;
|
||||
}
|
||||
|
||||
if (dirchange || dirlist == NULL ||
|
||||
strcmp(dir, lastdir) != 0) { /* dir not cached */
|
||||
char *emesg;
|
||||
|
||||
if (dirlist != NULL)
|
||||
sl_free(dirlist, 1);
|
||||
dirlist = xsl_init();
|
||||
|
||||
mflag = 1;
|
||||
emesg = NULL;
|
||||
while ((cp = remglob(dummyargv, 0, &emesg)) != NULL) {
|
||||
char *tcp;
|
||||
|
||||
if (!mflag)
|
||||
continue;
|
||||
if (*cp == '\0') {
|
||||
mflag = 0;
|
||||
continue;
|
||||
}
|
||||
tcp = strrchr(cp, '/');
|
||||
if (tcp)
|
||||
tcp++;
|
||||
else
|
||||
tcp = cp;
|
||||
tcp = xstrdup(tcp);
|
||||
xsl_add(dirlist, tcp);
|
||||
}
|
||||
if (emesg != NULL) {
|
||||
fprintf(ttyout, "\n%s\n", emesg);
|
||||
return (CC_REDISPLAY);
|
||||
}
|
||||
(void)strlcpy(lastdir, dir, sizeof(lastdir));
|
||||
dirchange = 0;
|
||||
}
|
||||
|
||||
words = xsl_init();
|
||||
for (i = 0; i < dirlist->sl_cur; i++) {
|
||||
cp = dirlist->sl_str[i];
|
||||
if (strlen(file) > strlen(cp))
|
||||
continue;
|
||||
if (strncmp(file, cp, strlen(file)) == 0)
|
||||
xsl_add(words, cp);
|
||||
}
|
||||
rv = complete_ambiguous(file, list, words);
|
||||
sl_free(words, 0);
|
||||
return (rv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic complete routine
|
||||
*/
|
||||
unsigned char
|
||||
complete(EditLine *el, int ch)
|
||||
{
|
||||
static char word[FTPBUFLEN];
|
||||
static int lastc_argc, lastc_argo;
|
||||
|
||||
struct cmd *c;
|
||||
const LineInfo *lf;
|
||||
int celems, dolist, cmpltype;
|
||||
size_t len;
|
||||
|
||||
lf = el_line(el);
|
||||
len = lf->lastchar - lf->buffer;
|
||||
if (len >= sizeof(line))
|
||||
return (CC_ERROR);
|
||||
(void)strlcpy(line, lf->buffer, len + 1);
|
||||
cursor_pos = line + (lf->cursor - lf->buffer);
|
||||
lastc_argc = cursor_argc; /* remember last cursor pos */
|
||||
lastc_argo = cursor_argo;
|
||||
makeargv(); /* build argc/argv of current line */
|
||||
|
||||
if (cursor_argo >= sizeof(word))
|
||||
return (CC_ERROR);
|
||||
|
||||
dolist = 0;
|
||||
/* if cursor and word is same, list alternatives */
|
||||
if (lastc_argc == cursor_argc && lastc_argo == cursor_argo
|
||||
&& strncmp(word, margv[cursor_argc] ? margv[cursor_argc] : "",
|
||||
cursor_argo) == 0)
|
||||
dolist = 1;
|
||||
else if (cursor_argc < margc)
|
||||
(void)strlcpy(word, margv[cursor_argc], cursor_argo + 1);
|
||||
word[cursor_argo] = '\0';
|
||||
|
||||
if (cursor_argc == 0)
|
||||
return (complete_command(word, dolist));
|
||||
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1 || c == 0)
|
||||
return (CC_ERROR);
|
||||
celems = strlen(c->c_complete);
|
||||
|
||||
/* check for 'continuation' completes (which are uppercase) */
|
||||
if ((cursor_argc > celems) && (celems > 0)
|
||||
&& isupper((unsigned char) c->c_complete[celems-1]))
|
||||
cursor_argc = celems;
|
||||
|
||||
if (cursor_argc > celems)
|
||||
return (CC_ERROR);
|
||||
|
||||
cmpltype = c->c_complete[cursor_argc - 1];
|
||||
switch (cmpltype) {
|
||||
case 'c': /* command complete */
|
||||
case 'C':
|
||||
return (complete_command(word, dolist));
|
||||
case 'l': /* local complete */
|
||||
case 'L':
|
||||
return (complete_local(word, dolist));
|
||||
case 'n': /* no complete */
|
||||
case 'N': /* no complete */
|
||||
return (CC_ERROR);
|
||||
case 'o': /* local complete */
|
||||
case 'O':
|
||||
return (complete_option(word, dolist));
|
||||
case 'r': /* remote complete */
|
||||
case 'R':
|
||||
if (connected != -1) {
|
||||
fputs("\nMust be logged in to complete.\n",
|
||||
ttyout);
|
||||
return (CC_REDISPLAY);
|
||||
}
|
||||
return (complete_remote(word, dolist));
|
||||
default:
|
||||
errx(1, "unknown complete type `%c'", cmpltype);
|
||||
return (CC_ERROR);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
#endif /* !NO_EDITCOMPLETE */
|
133
contrib/lukemftp/src/domacro.c
Normal file
133
contrib/lukemftp/src/domacro.c
Normal file
@ -0,0 +1,133 @@
|
||||
/* $NetBSD: domacro.c,v 1.17 2000/07/18 06:45:03 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include "lukemftp.h"
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
void
|
||||
domacro(int argc, char *argv[])
|
||||
{
|
||||
int i, j, count = 2, loopflg = 0;
|
||||
char *cp1, *cp2, line2[200];
|
||||
struct cmd *c;
|
||||
|
||||
if ((argc == 0 && argv != NULL) ||
|
||||
(argc < 2 && !another(&argc, &argv, "macro name"))) {
|
||||
fprintf(ttyout, "usage: %s macro_name [args]\n", argv[0]);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < macnum; ++i) {
|
||||
if (!strncmp(argv[1], macros[i].mac_name, 9))
|
||||
break;
|
||||
}
|
||||
if (i == macnum) {
|
||||
fprintf(ttyout, "'%s' macro not found.\n", argv[1]);
|
||||
code = -1;
|
||||
return;
|
||||
}
|
||||
(void)strcpy(line2, line);
|
||||
TOP:
|
||||
cp1 = macros[i].mac_start;
|
||||
while (cp1 != macros[i].mac_end) {
|
||||
while (isspace((unsigned char)*cp1))
|
||||
cp1++;
|
||||
cp2 = line;
|
||||
while (*cp1 != '\0') {
|
||||
switch(*cp1) {
|
||||
case '\\':
|
||||
*cp2++ = *++cp1;
|
||||
break;
|
||||
case '$':
|
||||
if (isdigit((unsigned char)*(cp1+1))) {
|
||||
j = 0;
|
||||
while (isdigit((unsigned char)*++cp1))
|
||||
j = 10*j + *cp1 - '0';
|
||||
cp1--;
|
||||
if (argc - 2 >= j) {
|
||||
(void)strcpy(cp2, argv[j+1]);
|
||||
cp2 += strlen(argv[j+1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (*(cp1+1) == 'i') {
|
||||
loopflg = 1;
|
||||
cp1++;
|
||||
if (count < argc) {
|
||||
(void)strcpy(cp2, argv[count]);
|
||||
cp2 += strlen(argv[count]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* intentional drop through */
|
||||
default:
|
||||
*cp2++ = *cp1;
|
||||
break;
|
||||
}
|
||||
if (*cp1 != '\0')
|
||||
cp1++;
|
||||
}
|
||||
*cp2 = '\0';
|
||||
makeargv();
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
fputs("?Ambiguous command.\n", ttyout);
|
||||
code = -1;
|
||||
} else if (c == 0) {
|
||||
fputs("?Invalid command.\n", ttyout);
|
||||
code = -1;
|
||||
} else if (c->c_conn && !connected) {
|
||||
fputs("Not connected.\n", ttyout);
|
||||
code = -1;
|
||||
} else {
|
||||
if (verbose) {
|
||||
fputs(line, ttyout);
|
||||
putc('\n', ttyout);
|
||||
}
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell)
|
||||
(void)putc('\007', ttyout);
|
||||
(void)strcpy(line, line2);
|
||||
makeargv();
|
||||
argc = margc;
|
||||
argv = margv;
|
||||
}
|
||||
if (cp1 != macros[i].mac_end)
|
||||
cp1++;
|
||||
}
|
||||
if (loopflg && ++count < argc)
|
||||
goto TOP;
|
||||
}
|
266
contrib/lukemftp/src/extern.h
Normal file
266
contrib/lukemftp/src/extern.h
Normal file
@ -0,0 +1,266 @@
|
||||
/* $NetBSD: extern.h,v 1.59 2000/08/06 08:51:22 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)extern.h 8.3 (Berkeley) 10/9/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
|
||||
*/
|
||||
|
||||
struct sockaddr;
|
||||
struct tm;
|
||||
struct addrinfo;
|
||||
|
||||
void abort_remote(FILE *);
|
||||
void abort_squared(int);
|
||||
void abortpt(int);
|
||||
void abortxfer(int);
|
||||
void account(int, char **);
|
||||
void ai_unmapped(struct addrinfo *);
|
||||
void alarmtimer(int);
|
||||
int another(int *, char ***, const char *);
|
||||
int auto_fetch(int, char **);
|
||||
int auto_put(int, char **, const char *);
|
||||
void blkfree(char **);
|
||||
void cd(int, char **);
|
||||
void cdup(int, char **);
|
||||
void changetype(int, int);
|
||||
void cleanuppeer(void);
|
||||
void cmdabort(int);
|
||||
void cmdtimeout(int);
|
||||
void cmdscanner(void);
|
||||
int command(const char *, ...);
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
unsigned char complete(EditLine *, int);
|
||||
void controlediting(void);
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
void crankrate(int);
|
||||
FILE *dataconn(const char *);
|
||||
void delete(int, char **);
|
||||
void disconnect(int, char **);
|
||||
void do_chmod(int, char **);
|
||||
void do_umask(int, char **);
|
||||
char *docase(char *);
|
||||
void domacro(int, char **);
|
||||
char *domap(char *);
|
||||
void doproxy(int, char **);
|
||||
char *dotrans(char *);
|
||||
void feat(int, char **);
|
||||
void fget(int, char **);
|
||||
int foregroundproc(void);
|
||||
void formatbuf(char *, size_t, const char *);
|
||||
void ftpvis(char *, size_t, const char *, size_t);
|
||||
int ftp_login(const char *, const char *, const char *);
|
||||
void get(int, char **);
|
||||
struct cmd *getcmd(const char *);
|
||||
int getit(int, char **, int, const char *);
|
||||
struct option *getoption(const char *);
|
||||
char *getoptionvalue(const char *);
|
||||
void getremoteinfo(void);
|
||||
int getreply(int);
|
||||
char *globulize(const char *);
|
||||
char *gunique(const char *);
|
||||
void help(int, char **);
|
||||
char *hookup(char *, char *);
|
||||
void idlecmd(int, char **);
|
||||
int initconn(void);
|
||||
void intr(int);
|
||||
int isipv6addr(const char *);
|
||||
void list_vertical(StringList *);
|
||||
void lcd(int, char **);
|
||||
void lostpeer(int);
|
||||
void lpage(int, char **);
|
||||
void lpwd(int, char **);
|
||||
void ls(int, char **);
|
||||
void mabort(void);
|
||||
void macdef(int, char **);
|
||||
void makeargv(void);
|
||||
void makedir(int, char **);
|
||||
void mdelete(int, char **);
|
||||
void mget(int, char **);
|
||||
void mintr(int);
|
||||
void mls(int, char **);
|
||||
void mlst(int, char **);
|
||||
void modtime(int, char **);
|
||||
void mput(int, char **);
|
||||
char *onoff(int);
|
||||
void opts(int, char **);
|
||||
void newer(int, char **);
|
||||
void page(int, char **);
|
||||
int parseport(const char *, int);
|
||||
int parserate(int, char **, int);
|
||||
void progressmeter(int);
|
||||
char *prompt(void);
|
||||
void proxabort(int);
|
||||
void proxtrans(const char *, const char *, const char *);
|
||||
void psabort(int);
|
||||
void psummary(int);
|
||||
void pswitch(int);
|
||||
void ptransfer(int);
|
||||
void put(int, char **);
|
||||
void pwd(int, char **);
|
||||
void quit(int, char **);
|
||||
void quote(int, char **);
|
||||
void quote1(const char *, int, char **);
|
||||
void recvrequest(const char *, const char *, const char *,
|
||||
const char *, int, int);
|
||||
void reget(int, char **);
|
||||
char *remglob(char **, int, char **);
|
||||
time_t remotemodtime(const char *, int);
|
||||
off_t remotesize(const char *, int);
|
||||
void removedir(int, char **);
|
||||
void renamefile(int, char **);
|
||||
void reset(int, char **);
|
||||
void restart(int, char **);
|
||||
void rmthelp(int, char **);
|
||||
void rmtstatus(int, char **);
|
||||
char *rprompt(void);
|
||||
int ruserpass(const char *, const char **, const char **,
|
||||
const char **);
|
||||
void sendrequest(const char *, const char *, const char *, int);
|
||||
void setascii(int, char **);
|
||||
void setbell(int, char **);
|
||||
void setbinary(int, char **);
|
||||
void setcase(int, char **);
|
||||
void setcr(int, char **);
|
||||
void setdebug(int, char **);
|
||||
void setedit(int, char **);
|
||||
void setepsv4(int, char **);
|
||||
void setform(int, char **);
|
||||
void setftmode(int, char **);
|
||||
void setgate(int, char **);
|
||||
void setglob(int, char **);
|
||||
void sethash(int, char **);
|
||||
void setnmap(int, char **);
|
||||
void setntrans(int, char **);
|
||||
void setoption(int, char **);
|
||||
void setpassive(int, char **);
|
||||
void setpeer(int, char **);
|
||||
void setport(int, char **);
|
||||
void setpreserve(int, char **);
|
||||
void setprogress(int, char **);
|
||||
void setprompt(int, char **);
|
||||
void setrate(int, char **);
|
||||
void setrunique(int, char **);
|
||||
void setstruct(int, char **);
|
||||
void setsunique(int, char **);
|
||||
void settenex(int, char **);
|
||||
void settrace(int, char **);
|
||||
void setttywidth(int);
|
||||
void settype(int, char **);
|
||||
void setupsockbufsize(int);
|
||||
void setverbose(int, char **);
|
||||
void setxferbuf(int, char **);
|
||||
void shell(int, char **);
|
||||
void site(int, char **);
|
||||
void sizecmd(int, char **);
|
||||
char *slurpstring(void);
|
||||
void status(int, char **);
|
||||
int strsuftoi(const char *);
|
||||
void syst(int, char **);
|
||||
int togglevar(int, char **, int *, const char *);
|
||||
void unsetoption(int, char **);
|
||||
void updateremotepwd(void);
|
||||
void usage(void);
|
||||
void user(int, char **);
|
||||
int xconnect(int, const struct sockaddr *, int);
|
||||
int xlisten(int, int);
|
||||
void *xmalloc(size_t);
|
||||
StringList *xsl_init(void);
|
||||
void xsl_add(StringList *, char *);
|
||||
char *xstrdup(const char *);
|
||||
sigfunc xsignal(int, sigfunc);
|
||||
sigfunc xsignal_restart(int, sigfunc, int);
|
1738
contrib/lukemftp/src/fetch.c
Normal file
1738
contrib/lukemftp/src/fetch.c
Normal file
File diff suppressed because it is too large
Load Diff
2049
contrib/lukemftp/src/ftp.1
Normal file
2049
contrib/lukemftp/src/ftp.1
Normal file
File diff suppressed because it is too large
Load Diff
2100
contrib/lukemftp/src/ftp.c
Normal file
2100
contrib/lukemftp/src/ftp.c
Normal file
File diff suppressed because it is too large
Load Diff
353
contrib/lukemftp/src/ftp_var.h
Normal file
353
contrib/lukemftp/src/ftp_var.h
Normal file
@ -0,0 +1,353 @@
|
||||
/* $NetBSD: ftp_var.h,v 1.58 2000/08/01 22:47:28 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*
|
||||
* @(#)ftp_var.h 8.4 (Berkeley) 10/9/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FTP global variables.
|
||||
*/
|
||||
|
||||
#ifdef SMALL
|
||||
#undef NO_EDITCOMPLETE
|
||||
#define NO_EDITCOMPLETE
|
||||
#undef NO_PROGRESS
|
||||
#define NO_PROGRESS
|
||||
#endif
|
||||
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
#include <histedit.h>
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
typedef void (*sigfunc)(int);
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
|
||||
/*
|
||||
* 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 */
|
||||
void (*c_handler)(int, char **); /* function to call */
|
||||
};
|
||||
|
||||
/*
|
||||
* Format of macro table
|
||||
*/
|
||||
struct macel {
|
||||
char mac_name[9]; /* macro name */
|
||||
char *mac_start; /* start of macro in macbuf */
|
||||
char *mac_end; /* end of macro in macbuf */
|
||||
};
|
||||
|
||||
/*
|
||||
* Format of option table
|
||||
*/
|
||||
struct option {
|
||||
char *name;
|
||||
char *value;
|
||||
};
|
||||
|
||||
/*
|
||||
* Indices to features[]; an array containing status of remote server
|
||||
* features; -1 not known (FEAT failed), 0 absent, 1 present.
|
||||
*/
|
||||
enum {
|
||||
FEAT_FEAT = 0, /* FEAT, OPTS */
|
||||
FEAT_MDTM, /* MDTM */
|
||||
FEAT_MLST, /* MLSD, MLST */
|
||||
FEAT_REST_STREAM, /* RESTart STREAM */
|
||||
FEAT_SIZE, /* SIZE */
|
||||
FEAT_TVFS, /* TVFS (not used) */
|
||||
FEAT_max
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Global defines
|
||||
*/
|
||||
#define FTPBUFLEN MAXPATHLEN + 200
|
||||
#define MAX_IN_PORT_T 0xffffU
|
||||
|
||||
#define HASHBYTES 1024 /* default mark for `hash' command */
|
||||
#define DEFAULTINCR 1024 /* default increment for `rate' command */
|
||||
#define STALLTIME 5 /* # of seconds of no xfer before "stalling" */
|
||||
|
||||
#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
|
||||
|
||||
#define DEFAULTPAGER "more" /* default pager if $PAGER isn't set */
|
||||
#define DEFAULTPROMPT "ftp> " /* default prompt if `set prompt' is empty */
|
||||
#define DEFAULTRPROMPT "" /* default rprompt if `set rprompt' is empty */
|
||||
|
||||
#define TMPFILE "ftpXXXXXXXXXX"
|
||||
|
||||
|
||||
#ifndef GLOBAL
|
||||
#define GLOBAL extern
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Options and other state info.
|
||||
*/
|
||||
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 */
|
||||
GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
|
||||
GLOBAL int editing; /* command line editing enabled */
|
||||
GLOBAL int features[FEAT_max]; /* remote FEATures supported */
|
||||
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
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] */
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
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 */
|
||||
|
||||
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 */
|
||||
GLOBAL char remotepwd[MAXPATHLEN]; /* remote dir */
|
||||
GLOBAL char *username; /* name of user logged in as. (dynamic) */
|
||||
|
||||
GLOBAL char *ftpport; /* port number to use for FTP connections */
|
||||
GLOBAL char *httpport; /* port number to use for HTTP connections */
|
||||
GLOBAL char *gateport; /* port number to use for gateftp connections */
|
||||
|
||||
GLOBAL char *outfile; /* filename to output URLs to */
|
||||
GLOBAL int restartautofetch; /* restart auto-fetch */
|
||||
|
||||
GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
|
||||
|
||||
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 */
|
||||
#define margv (marg_sl->sl_str) /* args parsed from input line */
|
||||
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 */
|
||||
GLOBAL void (*reply_callback)(const char *);
|
||||
/*
|
||||
* function to call for each line in
|
||||
* the server's reply except for the
|
||||
* first (`xxx-') and last (`xxx ')
|
||||
*/
|
||||
|
||||
|
||||
GLOBAL FILE *cin;
|
||||
GLOBAL FILE *cout;
|
||||
GLOBAL int data;
|
||||
|
||||
extern struct cmd cmdtab[];
|
||||
extern struct option optiontab[];
|
||||
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
|
||||
#define EMPTYSTRING(x) ((x) == NULL || (*(x) == '\0'))
|
||||
#define FREEPTR(x) if ((x) != NULL) { free(x); (x) = NULL; }
|
||||
|
||||
#ifdef BSD4_4
|
||||
# define HAVE_SOCKADDR_SA_LEN 1
|
||||
#endif
|
||||
|
||||
#ifdef NO_LONG_LONG
|
||||
# define LLF "%ld"
|
||||
# define LLFP(x) "%" x "ld"
|
||||
# define LLT long
|
||||
# define ULLF "%lu"
|
||||
# define ULLFP(x) "%" x "lu"
|
||||
# define ULLT unsigned long
|
||||
# define STRTOLL(x,y,z) strtol(x,y,z)
|
||||
#else
|
||||
# define LLF "%lld"
|
||||
# define LLFP(x) "%" x "lld"
|
||||
# define LLT long long
|
||||
# define ULLF "%llu"
|
||||
# define ULLFP(x) "%" x "llu"
|
||||
# define ULLT unsigned long long
|
||||
# define STRTOLL(x,y,z) strtoll(x,y,z)
|
||||
#endif
|
965
contrib/lukemftp/src/main.c
Normal file
965
contrib/lukemftp/src/main.c
Normal file
@ -0,0 +1,965 @@
|
||||
/* $NetBSD: main.c,v 1.73 2000/07/18 07:16:56 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1989, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 and 1998 WIDE Project.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* FTP User Program -- Command Interface.
|
||||
*/
|
||||
|
||||
#include "lukemftp.h"
|
||||
|
||||
#define GLOBAL /* force GLOBAL decls in ftp_var.h to be declared */
|
||||
#include "ftp_var.h"
|
||||
|
||||
#define FTP_PROXY "ftp_proxy" /* env var with FTP proxy location */
|
||||
#define HTTP_PROXY "http_proxy" /* env var with HTTP proxy location */
|
||||
#define NO_PROXY "no_proxy" /* env var with list of non-proxied
|
||||
* hosts, comma or space separated */
|
||||
|
||||
char * __progname;
|
||||
|
||||
static void setupoption(char *, char *, char *);
|
||||
int main(int, char *[]);
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, rval;
|
||||
struct passwd *pw = NULL;
|
||||
char *cp, *ep, *anonuser, *anonpass, *upload_path;
|
||||
int dumbterm, s, len, isupload;
|
||||
|
||||
__progname = strrchr(argv[0], '/');
|
||||
if (__progname == NULL)
|
||||
__progname = argv[0];
|
||||
else
|
||||
__progname++;
|
||||
|
||||
ftpport = "ftp";
|
||||
httpport = "http";
|
||||
gateport = NULL;
|
||||
cp = getenv("FTPSERVERPORT");
|
||||
if (cp != NULL)
|
||||
gateport = cp;
|
||||
else
|
||||
gateport = "ftpgate";
|
||||
doglob = 1;
|
||||
interactive = 1;
|
||||
autologin = 1;
|
||||
passivemode = 1;
|
||||
activefallback = 1;
|
||||
preserve = 1;
|
||||
verbose = 0;
|
||||
progress = 0;
|
||||
gatemode = 0;
|
||||
data = -1;
|
||||
outfile = NULL;
|
||||
restartautofetch = 0;
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
editing = 0;
|
||||
el = NULL;
|
||||
hist = NULL;
|
||||
#endif
|
||||
bytes = 0;
|
||||
mark = HASHBYTES;
|
||||
rate_get = 0;
|
||||
rate_get_incr = DEFAULTINCR;
|
||||
rate_put = 0;
|
||||
rate_put_incr = DEFAULTINCR;
|
||||
#ifdef INET6
|
||||
epsv4 = 1;
|
||||
#else
|
||||
epsv4 = 0;
|
||||
#endif
|
||||
epsv4bad = 0;
|
||||
upload_path = NULL;
|
||||
isupload = 0;
|
||||
reply_callback = NULL;
|
||||
|
||||
/*
|
||||
* Get the default socket buffer sizes if we don't already have them.
|
||||
* It doesn't matter which socket we do this to, because on the first
|
||||
* call no socket buffer sizes will have been modified, so we are
|
||||
* guaranteed to get the system defaults.
|
||||
*/
|
||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s == -1)
|
||||
err(1, "can't create socket");
|
||||
len = sizeof(rcvbuf_size);
|
||||
if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, (void *) &rcvbuf_size, &len)
|
||||
< 0)
|
||||
err(1, "unable to get default rcvbuf size");
|
||||
len = sizeof(sndbuf_size);
|
||||
if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, (void *) &sndbuf_size, &len)
|
||||
< 0)
|
||||
err(1, "unable to get default sndbuf size");
|
||||
(void)close(s);
|
||||
/* sanity check returned buffer sizes */
|
||||
if (rcvbuf_size <= 0)
|
||||
rcvbuf_size = 8192;
|
||||
if (sndbuf_size <= 0)
|
||||
sndbuf_size = 8192;
|
||||
|
||||
marg_sl = xsl_init();
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
tmpdir = _PATH_TMP;
|
||||
|
||||
/* Set default operation mode based on FTPMODE environment variable */
|
||||
if ((cp = getenv("FTPMODE")) != NULL) {
|
||||
if (strcasecmp(cp, "passive") == 0) {
|
||||
passivemode = 1;
|
||||
activefallback = 0;
|
||||
} else if (strcasecmp(cp, "active") == 0) {
|
||||
passivemode = 0;
|
||||
activefallback = 0;
|
||||
} else if (strcasecmp(cp, "gate") == 0) {
|
||||
gatemode = 1;
|
||||
} else if (strcasecmp(cp, "auto") == 0) {
|
||||
passivemode = 1;
|
||||
activefallback = 1;
|
||||
} else
|
||||
warnx("unknown $FTPMODE '%s'; using defaults", cp);
|
||||
}
|
||||
|
||||
if (strcmp(__progname, "pftp") == 0) {
|
||||
passivemode = 1;
|
||||
activefallback = 0;
|
||||
} else if (strcmp(__progname, "gate-ftp") == 0)
|
||||
gatemode = 1;
|
||||
|
||||
gateserver = getenv("FTPSERVER");
|
||||
if (gateserver == NULL || *gateserver == '\0')
|
||||
gateserver = GATE_SERVER;
|
||||
if (gatemode) {
|
||||
if (*gateserver == '\0') {
|
||||
warnx(
|
||||
"Neither $FTPSERVER nor GATE_SERVER is defined; disabling gate-ftp");
|
||||
gatemode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
cp = getenv("TERM");
|
||||
if (cp == NULL || strcmp(cp, "dumb") == 0)
|
||||
dumbterm = 1;
|
||||
else
|
||||
dumbterm = 0;
|
||||
fromatty = isatty(fileno(stdin));
|
||||
ttyout = stdout;
|
||||
if (isatty(fileno(ttyout))) {
|
||||
verbose = 1; /* verbose if to a tty */
|
||||
if (! dumbterm) {
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
if (fromatty) /* editing mode on if tty is usable */
|
||||
editing = 1;
|
||||
#endif
|
||||
#ifndef NO_PROGRESS
|
||||
if (foregroundproc())
|
||||
progress = 1; /* progress bar on if fg */
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
while ((ch = getopt(argc, argv, "Aadefgino:pP:r:RtT:u:vV")) != -1) {
|
||||
switch (ch) {
|
||||
case 'A':
|
||||
activefallback = 0;
|
||||
passivemode = 0;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
anonftp = 1;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
options |= SO_DEBUG;
|
||||
debug++;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
editing = 0;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
flushcache = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
doglob = 0;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interactive = 0;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
autologin = 0;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
outfile = optarg;
|
||||
if (strcmp(outfile, "-") == 0)
|
||||
ttyout = stderr;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
passivemode = 1;
|
||||
activefallback = 0;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
ftpport = optarg;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
retry_connect = strtol(optarg, &ep, 10);
|
||||
if (retry_connect < 1 || *ep != '\0')
|
||||
errx(1, "bad retry value: %s", optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
restartautofetch = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
trace = 1;
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
{
|
||||
int targc;
|
||||
char *targv[6], *oac;
|
||||
|
||||
/* look for `dir,max[,incr]' */
|
||||
targc = 0;
|
||||
targv[targc++] = "-T";
|
||||
oac = xstrdup(optarg);
|
||||
|
||||
while ((cp = strsep(&oac, ",")) != NULL) {
|
||||
if (*cp == '\0') {
|
||||
warnx("bad throttle value: %s", optarg);
|
||||
usage();
|
||||
/* NOTREACHED */
|
||||
}
|
||||
targv[targc++] = cp;
|
||||
if (targc >= 5)
|
||||
break;
|
||||
}
|
||||
if (parserate(targc, targv, 1) == -1)
|
||||
usage();
|
||||
free(oac);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'u':
|
||||
{
|
||||
isupload = 1;
|
||||
interactive = 0;
|
||||
upload_path = xstrdup(optarg);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v':
|
||||
progress = verbose = 1;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
progress = verbose = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
/* set line buffering on ttyout */
|
||||
setvbuf(ttyout, NULL, _IOLBF, 0);
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
cpend = 0; /* no pending replies */
|
||||
proxy = 0; /* proxy not active */
|
||||
crflag = 1; /* strip c.r. on ascii gets */
|
||||
sendport = -1; /* not using ports */
|
||||
/*
|
||||
* Set up the home directory in case we're globbing.
|
||||
*/
|
||||
cp = getlogin();
|
||||
if (cp != NULL)
|
||||
pw = getpwnam(cp);
|
||||
if (pw == NULL)
|
||||
pw = getpwuid(getuid());
|
||||
if (pw != NULL) {
|
||||
(void)strlcpy(home, pw->pw_dir, sizeof(home));
|
||||
anonuser = pw->pw_name;
|
||||
} else {
|
||||
(void)strlcpy(home, "/", sizeof(home));
|
||||
anonuser = "anonymous";
|
||||
}
|
||||
|
||||
/*
|
||||
* Every anonymous FTP server I've encountered will accept the
|
||||
* string "username@", and will append the hostname itself. We
|
||||
* do this by default since many servers are picky about not
|
||||
* having a FQDN in the anonymous password.
|
||||
* - thorpej@netbsd.org
|
||||
*/
|
||||
len = strlen(anonuser) + 2;
|
||||
anonpass = xmalloc(len);
|
||||
(void)strlcpy(anonpass, anonuser, len);
|
||||
(void)strlcat(anonpass, "@", len);
|
||||
|
||||
/*
|
||||
* set all the defaults for options defined in
|
||||
* struct option optiontab[] declared in cmdtab.c
|
||||
*/
|
||||
setupoption("anonpass", getenv("FTPANONPASS"), anonpass);
|
||||
setupoption("ftp_proxy", getenv(FTP_PROXY), "");
|
||||
setupoption("http_proxy", getenv(HTTP_PROXY), "");
|
||||
setupoption("no_proxy", getenv(NO_PROXY), "");
|
||||
setupoption("pager", getenv("PAGER"), DEFAULTPAGER);
|
||||
setupoption("prompt", getenv("FTPPROMPT"), DEFAULTPROMPT);
|
||||
setupoption("rprompt", getenv("FTPRPROMPT"), DEFAULTRPROMPT);
|
||||
|
||||
free(anonpass);
|
||||
|
||||
setttywidth(0);
|
||||
#ifdef SIGINFO
|
||||
(void)xsignal(SIGINFO, psummary);
|
||||
#endif
|
||||
(void)xsignal(SIGQUIT, psummary);
|
||||
(void)xsignal(SIGUSR1, crankrate);
|
||||
(void)xsignal(SIGUSR2, crankrate);
|
||||
(void)xsignal(SIGWINCH, setttywidth);
|
||||
|
||||
#ifdef __GNUC__ /* to shut up gcc warnings */
|
||||
(void)&argc;
|
||||
(void)&argv;
|
||||
#endif
|
||||
|
||||
if (argc > 0) {
|
||||
if (isupload) {
|
||||
rval = auto_put(argc, argv, upload_path);
|
||||
exit(rval);
|
||||
} else if (strchr(argv[0], ':') != NULL
|
||||
&& ! isipv6addr(argv[0])) {
|
||||
rval = auto_fetch(argc, argv);
|
||||
if (rval >= 0) /* -1 == connected and cd-ed */
|
||||
exit(rval);
|
||||
} else {
|
||||
char *xargv[4], *user, *host;
|
||||
|
||||
if (sigsetjmp(toplevel, 1))
|
||||
exit(0);
|
||||
(void)xsignal(SIGINT, intr);
|
||||
(void)xsignal(SIGPIPE, lostpeer);
|
||||
user = NULL;
|
||||
host = argv[0];
|
||||
cp = strchr(host, '@');
|
||||
if (cp) {
|
||||
*cp = '\0';
|
||||
user = host;
|
||||
host = cp + 1;
|
||||
}
|
||||
xargv[0] = __progname;
|
||||
xargv[1] = host;
|
||||
xargv[2] = argv[1];
|
||||
xargv[3] = NULL;
|
||||
do {
|
||||
int oautologin;
|
||||
|
||||
oautologin = autologin;
|
||||
if (user != NULL) {
|
||||
anonftp = 0;
|
||||
autologin = 0;
|
||||
}
|
||||
setpeer(argc+1, xargv);
|
||||
autologin = oautologin;
|
||||
if (connected == 1 && user != NULL)
|
||||
(void)ftp_login(host, user, NULL);
|
||||
if (!retry_connect)
|
||||
break;
|
||||
if (!connected) {
|
||||
macnum = 0;
|
||||
fprintf(ttyout,
|
||||
"Retrying in %d seconds...\n",
|
||||
retry_connect);
|
||||
sleep(retry_connect);
|
||||
}
|
||||
} while (!connected);
|
||||
retry_connect = 0; /* connected, stop hiding msgs */
|
||||
}
|
||||
}
|
||||
if (isupload)
|
||||
usage();
|
||||
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
controlediting();
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
(void)sigsetjmp(toplevel, 1);
|
||||
(void)xsignal(SIGINT, intr);
|
||||
(void)xsignal(SIGPIPE, lostpeer);
|
||||
for (;;)
|
||||
cmdscanner();
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate a prompt
|
||||
*/
|
||||
char *
|
||||
prompt(void)
|
||||
{
|
||||
static char **prompt;
|
||||
static char buf[MAXPATHLEN];
|
||||
|
||||
if (prompt == NULL) {
|
||||
struct option *o;
|
||||
|
||||
o = getoption("prompt");
|
||||
if (o == NULL)
|
||||
errx(1, "no such option `prompt'");
|
||||
prompt = &(o->value);
|
||||
}
|
||||
formatbuf(buf, sizeof(buf), *prompt ? *prompt : DEFAULTPROMPT);
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate an rprompt
|
||||
*/
|
||||
char *
|
||||
rprompt(void)
|
||||
{
|
||||
static char **rprompt;
|
||||
static char buf[MAXPATHLEN];
|
||||
|
||||
if (rprompt == NULL) {
|
||||
struct option *o;
|
||||
|
||||
o = getoption("rprompt");
|
||||
if (o == NULL)
|
||||
errx(1, "no such option `rprompt'");
|
||||
rprompt = &(o->value);
|
||||
}
|
||||
formatbuf(buf, sizeof(buf), *rprompt ? *rprompt : DEFAULTRPROMPT);
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Command parser.
|
||||
*/
|
||||
void
|
||||
cmdscanner(void)
|
||||
{
|
||||
struct cmd *c;
|
||||
char *p;
|
||||
int num;
|
||||
|
||||
for (;;) {
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
if (!editing) {
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
if (fromatty) {
|
||||
fputs(prompt(), ttyout);
|
||||
p = rprompt();
|
||||
if (*p)
|
||||
fprintf(ttyout, "%s ", p);
|
||||
(void)fflush(ttyout);
|
||||
}
|
||||
if (fgets(line, sizeof(line), stdin) == NULL) {
|
||||
if (fromatty)
|
||||
putc('\n', ttyout);
|
||||
quit(0, NULL);
|
||||
}
|
||||
num = strlen(line);
|
||||
if (num == 0)
|
||||
break;
|
||||
if (line[--num] == '\n') {
|
||||
if (num == 0)
|
||||
break;
|
||||
line[num] = '\0';
|
||||
} else if (num == sizeof(line) - 2) {
|
||||
fputs("sorry, input line too long.\n", ttyout);
|
||||
while ((num = getchar()) != '\n' && num != EOF)
|
||||
/* void */;
|
||||
break;
|
||||
} /* else it was a line without a newline */
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
} else {
|
||||
const char *buf;
|
||||
HistEvent ev;
|
||||
cursor_pos = NULL;
|
||||
|
||||
if ((buf = el_gets(el, &num)) == NULL || num == 0) {
|
||||
if (fromatty)
|
||||
putc('\n', ttyout);
|
||||
quit(0, NULL);
|
||||
}
|
||||
if (buf[--num] == '\n') {
|
||||
if (num == 0)
|
||||
break;
|
||||
} else if (num >= sizeof(line)) {
|
||||
fputs("sorry, input line too long.\n", ttyout);
|
||||
break;
|
||||
}
|
||||
memcpy(line, buf, num);
|
||||
line[num] = '\0';
|
||||
history(hist, &ev, H_ENTER, buf);
|
||||
}
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
makeargv();
|
||||
if (margc == 0)
|
||||
continue;
|
||||
c = getcmd(margv[0]);
|
||||
if (c == (struct cmd *)-1) {
|
||||
fputs("?Ambiguous command.\n", ttyout);
|
||||
continue;
|
||||
}
|
||||
if (c == NULL) {
|
||||
#if !defined(NO_EDITCOMPLETE)
|
||||
/*
|
||||
* attempt to el_parse() unknown commands.
|
||||
* any command containing a ':' would be parsed
|
||||
* as "[prog:]cmd ...", and will result in a
|
||||
* false positive if prog != "ftp", so treat
|
||||
* such commands as invalid.
|
||||
*/
|
||||
if (strchr(margv[0], ':') != NULL ||
|
||||
el_parse(el, margc, margv) != 0)
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
fputs("?Invalid command.\n", ttyout);
|
||||
continue;
|
||||
}
|
||||
if (c->c_conn && !connected) {
|
||||
fputs("Not connected.\n", ttyout);
|
||||
continue;
|
||||
}
|
||||
confirmrest = 0;
|
||||
(*c->c_handler)(margc, margv);
|
||||
if (bell && c->c_bell)
|
||||
(void)putc('\007', ttyout);
|
||||
if (c->c_handler != help)
|
||||
break;
|
||||
}
|
||||
(void)xsignal(SIGINT, intr);
|
||||
(void)xsignal(SIGPIPE, lostpeer);
|
||||
}
|
||||
|
||||
struct cmd *
|
||||
getcmd(const char *name)
|
||||
{
|
||||
const char *p, *q;
|
||||
struct cmd *c, *found;
|
||||
int nmatches, longest;
|
||||
|
||||
if (name == NULL)
|
||||
return (0);
|
||||
|
||||
longest = 0;
|
||||
nmatches = 0;
|
||||
found = 0;
|
||||
for (c = cmdtab; (p = c->c_name) != NULL; c++) {
|
||||
for (q = name; *q == *p++; q++)
|
||||
if (*q == 0) /* exact match? */
|
||||
return (c);
|
||||
if (!*q) { /* the name was a prefix */
|
||||
if (q - name > longest) {
|
||||
longest = q - name;
|
||||
nmatches = 1;
|
||||
found = c;
|
||||
} else if (q - name == longest)
|
||||
nmatches++;
|
||||
}
|
||||
}
|
||||
if (nmatches > 1)
|
||||
return ((struct cmd *)-1);
|
||||
return (found);
|
||||
}
|
||||
|
||||
/*
|
||||
* Slice a string up into argc/argv.
|
||||
*/
|
||||
|
||||
int slrflag;
|
||||
|
||||
void
|
||||
makeargv(void)
|
||||
{
|
||||
char *argp;
|
||||
|
||||
stringbase = line; /* scan from first of buffer */
|
||||
argbase = argbuf; /* store from first of buffer */
|
||||
slrflag = 0;
|
||||
marg_sl->sl_cur = 0; /* reset to start of marg_sl */
|
||||
for (margc = 0; ; margc++) {
|
||||
argp = slurpstring();
|
||||
xsl_add(marg_sl, argp);
|
||||
if (argp == NULL)
|
||||
break;
|
||||
}
|
||||
#ifndef NO_EDITCOMPLETE
|
||||
if (cursor_pos == line) {
|
||||
cursor_argc = 0;
|
||||
cursor_argo = 0;
|
||||
} else if (cursor_pos != NULL) {
|
||||
cursor_argc = margc;
|
||||
cursor_argo = strlen(margv[margc-1]);
|
||||
}
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
}
|
||||
|
||||
#ifdef NO_EDITCOMPLETE
|
||||
#define INC_CHKCURSOR(x) (x)++
|
||||
#else /* !NO_EDITCOMPLETE */
|
||||
#define INC_CHKCURSOR(x) { (x)++ ; \
|
||||
if (x == cursor_pos) { \
|
||||
cursor_argc = margc; \
|
||||
cursor_argo = ap-argbase; \
|
||||
cursor_pos = NULL; \
|
||||
} }
|
||||
|
||||
#endif /* !NO_EDITCOMPLETE */
|
||||
|
||||
/*
|
||||
* Parse string into argbuf;
|
||||
* implemented with FSM to
|
||||
* handle quoting and strings
|
||||
*/
|
||||
char *
|
||||
slurpstring(void)
|
||||
{
|
||||
int got_one = 0;
|
||||
char *sb = stringbase;
|
||||
char *ap = argbase;
|
||||
char *tmp = argbase; /* will return this if token found */
|
||||
|
||||
if (*sb == '!' || *sb == '$') { /* recognize ! as a token for shell */
|
||||
switch (slrflag) { /* and $ as token for macro invoke */
|
||||
case 0:
|
||||
slrflag++;
|
||||
INC_CHKCURSOR(stringbase);
|
||||
return ((*sb == '!') ? "!" : "$");
|
||||
/* NOTREACHED */
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = stringbase;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
S0:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT;
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
INC_CHKCURSOR(sb);
|
||||
goto S0;
|
||||
|
||||
default:
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = sb;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S1:
|
||||
switch (*sb) {
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\0':
|
||||
goto OUT; /* end of token */
|
||||
|
||||
case '\\':
|
||||
INC_CHKCURSOR(sb);
|
||||
goto S2; /* slurp next character */
|
||||
|
||||
case '"':
|
||||
INC_CHKCURSOR(sb);
|
||||
goto S3; /* slurp quoted string */
|
||||
|
||||
default:
|
||||
*ap = *sb; /* add character to token */
|
||||
ap++;
|
||||
INC_CHKCURSOR(sb);
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S2:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT;
|
||||
|
||||
default:
|
||||
*ap = *sb;
|
||||
ap++;
|
||||
INC_CHKCURSOR(sb);
|
||||
got_one = 1;
|
||||
goto S1;
|
||||
}
|
||||
|
||||
S3:
|
||||
switch (*sb) {
|
||||
|
||||
case '\0':
|
||||
goto OUT;
|
||||
|
||||
case '"':
|
||||
INC_CHKCURSOR(sb);
|
||||
goto S1;
|
||||
|
||||
default:
|
||||
*ap = *sb;
|
||||
ap++;
|
||||
INC_CHKCURSOR(sb);
|
||||
got_one = 1;
|
||||
goto S3;
|
||||
}
|
||||
|
||||
OUT:
|
||||
if (got_one)
|
||||
*ap++ = '\0';
|
||||
argbase = ap; /* update storage pointer */
|
||||
stringbase = sb; /* update scan pointer */
|
||||
if (got_one) {
|
||||
return (tmp);
|
||||
}
|
||||
switch (slrflag) {
|
||||
case 0:
|
||||
slrflag++;
|
||||
break;
|
||||
case 1:
|
||||
slrflag++;
|
||||
altarg = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Help/usage command.
|
||||
* Call each command handler with argc == 0 and argv[0] == name.
|
||||
*/
|
||||
void
|
||||
help(int argc, char *argv[])
|
||||
{
|
||||
struct cmd *c;
|
||||
char *nargv[1], *p, *cmd;
|
||||
int isusage;
|
||||
|
||||
cmd = argv[0];
|
||||
isusage = (strcmp(cmd, "usage") == 0);
|
||||
if (argc == 0 || (isusage && argc == 1)) {
|
||||
fprintf(ttyout, "usage: %s [command [...]]\n", cmd);
|
||||
return;
|
||||
}
|
||||
if (argc == 1) {
|
||||
StringList *buf;
|
||||
|
||||
buf = xsl_init();
|
||||
fprintf(ttyout,
|
||||
"%sommands may be abbreviated. Commands are:\n\n",
|
||||
proxy ? "Proxy c" : "C");
|
||||
for (c = cmdtab; (p = c->c_name) != NULL; c++)
|
||||
if (!proxy || c->c_proxy)
|
||||
xsl_add(buf, p);
|
||||
list_vertical(buf);
|
||||
sl_free(buf, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
#define HELPINDENT ((int) sizeof("disconnect"))
|
||||
|
||||
while (--argc > 0) {
|
||||
char *arg;
|
||||
|
||||
arg = *++argv;
|
||||
c = getcmd(arg);
|
||||
if (c == (struct cmd *)-1)
|
||||
fprintf(ttyout, "?Ambiguous %s command `%s'\n",
|
||||
cmd, arg);
|
||||
else if (c == NULL)
|
||||
fprintf(ttyout, "?Invalid %s command `%s'\n",
|
||||
cmd, arg);
|
||||
else {
|
||||
if (isusage) {
|
||||
nargv[0] = arg;
|
||||
(*c->c_handler)(0, nargv);
|
||||
} else
|
||||
fprintf(ttyout, "%-*s\t%s\n", HELPINDENT,
|
||||
c->c_name, c->c_help);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct option *
|
||||
getoption(const char *name)
|
||||
{
|
||||
const char *p;
|
||||
struct option *c;
|
||||
|
||||
if (name == NULL)
|
||||
return (NULL);
|
||||
for (c = optiontab; (p = c->name) != NULL; c++) {
|
||||
if (strcasecmp(p, name) == 0)
|
||||
return (c);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
getoptionvalue(const char *name)
|
||||
{
|
||||
struct option *c;
|
||||
|
||||
if (name == NULL)
|
||||
errx(1, "getoptionvalue() invoked with NULL name");
|
||||
c = getoption(name);
|
||||
if (c != NULL)
|
||||
return (c->value);
|
||||
errx(1, "getoptionvalue() invoked with unknown option `%s'", name);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
static void
|
||||
setupoption(char *name, char *value, char *defaultvalue)
|
||||
{
|
||||
char *nargv[3];
|
||||
int overbose;
|
||||
|
||||
nargv[0] = "setupoption()";
|
||||
nargv[1] = name;
|
||||
nargv[2] = (value ? value : defaultvalue);
|
||||
overbose = verbose;
|
||||
verbose = 0;
|
||||
setoption(3, nargv);
|
||||
verbose = overbose;
|
||||
}
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"usage: %s [-AadefginpRtvV] [-o outfile] [-P port] [-r retry]\n"
|
||||
" [-T dir,max[,inc][[user@]host [port]]] [host:path[/]]\n"
|
||||
" [file:///file] [ftp://[user[:pass]@]host[:port]/path[/]]\n"
|
||||
" [http://[user[:pass]@]host[:port]/path] [...]\n"
|
||||
" %s -u url file [...]\n", __progname, __progname);
|
||||
exit(1);
|
||||
}
|
284
contrib/lukemftp/src/ruserpass.c
Normal file
284
contrib/lukemftp/src/ruserpass.c
Normal file
@ -0,0 +1,284 @@
|
||||
/* $NetBSD: ruserpass.c,v 1.27 2000/07/18 06:47:02 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1985, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* 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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
|
||||
*/
|
||||
|
||||
#include "lukemftp.h"
|
||||
|
||||
#include "ftp_var.h"
|
||||
|
||||
static int token(void);
|
||||
static FILE *cfile;
|
||||
|
||||
#define DEFAULT 1
|
||||
#define LOGIN 2
|
||||
#define PASSWD 3
|
||||
#define ACCOUNT 4
|
||||
#define MACDEF 5
|
||||
#define ID 10
|
||||
#define MACH 11
|
||||
|
||||
static char tokval[100];
|
||||
|
||||
static struct toktab {
|
||||
char *tokstr;
|
||||
int tval;
|
||||
} toktab[] = {
|
||||
{ "default", DEFAULT },
|
||||
{ "login", LOGIN },
|
||||
{ "password", PASSWD },
|
||||
{ "passwd", PASSWD },
|
||||
{ "account", ACCOUNT },
|
||||
{ "machine", MACH },
|
||||
{ "macdef", MACDEF },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
int
|
||||
ruserpass(const char *host, const char **aname, const char **apass,
|
||||
const char **aacct)
|
||||
{
|
||||
char *hdir, buf[BUFSIZ], *tmp;
|
||||
char myname[MAXHOSTNAMELEN + 1], *mydomain;
|
||||
int t, i, c, usedefault = 0;
|
||||
struct stat stb;
|
||||
|
||||
hdir = getenv("HOME");
|
||||
if (hdir == NULL)
|
||||
hdir = ".";
|
||||
if (strlcpy(buf, hdir, sizeof(buf)) >= sizeof(buf) ||
|
||||
strlcat(buf, "/.netrc", sizeof(buf)) >= sizeof(buf)) {
|
||||
warnx("%s/.netrc: %s", hdir, strerror(ENAMETOOLONG));
|
||||
return (0);
|
||||
}
|
||||
cfile = fopen(buf, "r");
|
||||
if (cfile == NULL) {
|
||||
if (errno != ENOENT)
|
||||
warn("%s", buf);
|
||||
return (0);
|
||||
}
|
||||
if (gethostname(myname, sizeof(myname)) < 0)
|
||||
myname[0] = '\0';
|
||||
myname[sizeof(myname) - 1] = '\0';
|
||||
if ((mydomain = strchr(myname, '.')) == NULL)
|
||||
mydomain = "";
|
||||
next:
|
||||
while ((t = token())) switch(t) {
|
||||
|
||||
case DEFAULT:
|
||||
usedefault = 1;
|
||||
/* FALL THROUGH */
|
||||
|
||||
case MACH:
|
||||
if (!usedefault) {
|
||||
if (token() != ID)
|
||||
continue;
|
||||
/*
|
||||
* Allow match either for user's input host name
|
||||
* or official hostname. Also allow match of
|
||||
* incompletely-specified host in local domain.
|
||||
*/
|
||||
if (strcasecmp(host, tokval) == 0)
|
||||
goto match;
|
||||
if (strcasecmp(hostname, tokval) == 0)
|
||||
goto match;
|
||||
if ((tmp = strchr(hostname, '.')) != NULL &&
|
||||
strcasecmp(tmp, mydomain) == 0 &&
|
||||
strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
|
||||
tokval[tmp - hostname] == '\0')
|
||||
goto match;
|
||||
if ((tmp = strchr(host, '.')) != NULL &&
|
||||
strcasecmp(tmp, mydomain) == 0 &&
|
||||
strncasecmp(host, tokval, tmp - host) == 0 &&
|
||||
tokval[tmp - host] == '\0')
|
||||
goto match;
|
||||
continue;
|
||||
}
|
||||
match:
|
||||
while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
|
||||
|
||||
case LOGIN:
|
||||
if (token()) {
|
||||
if (*aname == NULL)
|
||||
*aname = xstrdup(tokval);
|
||||
else {
|
||||
if (strcmp(*aname, tokval))
|
||||
goto next;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PASSWD:
|
||||
if ((*aname == NULL || strcmp(*aname, "anonymous")) &&
|
||||
fstat(fileno(cfile), &stb) >= 0 &&
|
||||
(stb.st_mode & 077) != 0) {
|
||||
warnx("Error: .netrc file is readable by others.");
|
||||
warnx("Remove password or make file unreadable by others.");
|
||||
goto bad;
|
||||
}
|
||||
if (token() && *apass == NULL)
|
||||
*apass = xstrdup(tokval);
|
||||
break;
|
||||
case ACCOUNT:
|
||||
if (fstat(fileno(cfile), &stb) >= 0
|
||||
&& (stb.st_mode & 077) != 0) {
|
||||
warnx("Error: .netrc file is readable by others.");
|
||||
warnx("Remove account or make file unreadable by others.");
|
||||
goto bad;
|
||||
}
|
||||
if (token() && *aacct == NULL)
|
||||
*aacct = xstrdup(tokval);
|
||||
break;
|
||||
case MACDEF:
|
||||
if (proxy) {
|
||||
(void)fclose(cfile);
|
||||
return (0);
|
||||
}
|
||||
while ((c = getc(cfile)) != EOF)
|
||||
if (c != ' ' && c != '\t')
|
||||
break;
|
||||
if (c == EOF || c == '\n') {
|
||||
fputs("Missing macdef name argument.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
if (macnum == 16) {
|
||||
fputs(
|
||||
"Limit of 16 macros have already been defined.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
tmp = macros[macnum].mac_name;
|
||||
*tmp++ = c;
|
||||
for (i = 0; i < 8 && (c = getc(cfile)) != EOF &&
|
||||
!isspace(c); ++i) {
|
||||
*tmp++ = c;
|
||||
}
|
||||
if (c == EOF) {
|
||||
fputs(
|
||||
"Macro definition missing null line terminator.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
*tmp = '\0';
|
||||
if (c != '\n') {
|
||||
while ((c = getc(cfile)) != EOF && c != '\n');
|
||||
}
|
||||
if (c == EOF) {
|
||||
fputs(
|
||||
"Macro definition missing null line terminator.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
if (macnum == 0) {
|
||||
macros[macnum].mac_start = macbuf;
|
||||
}
|
||||
else {
|
||||
macros[macnum].mac_start =
|
||||
macros[macnum-1].mac_end + 1;
|
||||
}
|
||||
tmp = macros[macnum].mac_start;
|
||||
while (tmp != macbuf + 4096) {
|
||||
if ((c = getc(cfile)) == EOF) {
|
||||
fputs(
|
||||
"Macro definition missing null line terminator.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
*tmp = c;
|
||||
if (*tmp == '\n') {
|
||||
if (*(tmp-1) == '\0') {
|
||||
macros[macnum++].mac_end = tmp - 1;
|
||||
break;
|
||||
}
|
||||
*tmp = '\0';
|
||||
}
|
||||
tmp++;
|
||||
}
|
||||
if (tmp == macbuf + 4096) {
|
||||
fputs("4K macro buffer exceeded.\n",
|
||||
ttyout);
|
||||
goto bad;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
warnx("Unknown .netrc keyword %s", tokval);
|
||||
break;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
done:
|
||||
(void)fclose(cfile);
|
||||
return (0);
|
||||
bad:
|
||||
(void)fclose(cfile);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static int
|
||||
token(void)
|
||||
{
|
||||
char *cp;
|
||||
int c;
|
||||
struct toktab *t;
|
||||
|
||||
if (feof(cfile) || ferror(cfile))
|
||||
return (0);
|
||||
while ((c = getc(cfile)) != EOF &&
|
||||
(c == '\n' || c == '\t' || c == ' ' || c == ','))
|
||||
continue;
|
||||
if (c == EOF)
|
||||
return (0);
|
||||
cp = tokval;
|
||||
if (c == '"') {
|
||||
while ((c = getc(cfile)) != EOF && c != '"') {
|
||||
if (c == '\\')
|
||||
c = getc(cfile);
|
||||
*cp++ = c;
|
||||
}
|
||||
} else {
|
||||
*cp++ = c;
|
||||
while ((c = getc(cfile)) != EOF
|
||||
&& c != '\n' && c != '\t' && c != ' ' && c != ',') {
|
||||
if (c == '\\')
|
||||
c = getc(cfile);
|
||||
*cp++ = c;
|
||||
}
|
||||
}
|
||||
*cp = 0;
|
||||
if (tokval[0] == 0)
|
||||
return (0);
|
||||
for (t = toktab; t->tokstr; t++)
|
||||
if (!strcmp(t->tokstr, tokval))
|
||||
return (t->tval);
|
||||
return (ID);
|
||||
}
|
1620
contrib/lukemftp/src/util.c
Normal file
1620
contrib/lukemftp/src/util.c
Normal file
File diff suppressed because it is too large
Load Diff
44
contrib/lukemftp/src/version.h
Normal file
44
contrib/lukemftp/src/version.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* $NetBSD: version.h,v 1.21 2000/09/28 12:29:24 lukem Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef FTP_PRODUCT
|
||||
#define FTP_PRODUCT "NetBSD-ftp"
|
||||
#endif
|
||||
|
||||
#ifndef FTP_VERSION
|
||||
#define FTP_VERSION "20000928"
|
||||
#endif
|
15
contrib/lukemftp/todo
Normal file
15
contrib/lukemftp/todo
Normal file
@ -0,0 +1,15 @@
|
||||
$Id: todo,v 1.25 2000/09/19 22:25:50 lukem Exp $
|
||||
|
||||
in configure, check for ansi c compiler and barf if it fails
|
||||
|
||||
check if we need #defines for memcpy() et al
|
||||
|
||||
we check for fparseln twice; once in libutil and once in general
|
||||
|
||||
check for utimes() decls [which system?]
|
||||
|
||||
possibly install editline.3 and editrc.5
|
||||
|
||||
system specific tests (to remove need for manual intervention):
|
||||
- sunos4
|
||||
LIBS+= -lresolv
|
Loading…
Reference in New Issue
Block a user