1 diff -Nru src/CVS/Entries /home/spock/ftp/CVS/Entries
2 --- src/CVS/Entries Thu Jan 30 11:00:13 2003
3 +++ /home/spock/ftp/CVS/Entries Thu Jun 12 02:02:10 2003
5 -/Makefile.in/1.1.1.1/Thu Jul 19 16:26:12 2001//
6 -/cmds.c/1.1.1.2/Sat Jun 15 09:40:32 2002//
7 -/cmdtab.c/1.1.1.2/Sat Jun 15 09:40:33 2002//
8 -/complete.c/1.1.1.1/Thu Jul 19 16:26:13 2001//
9 -/domacro.c/1.1.1.2/Sat Jun 15 09:40:33 2002//
10 -/extern.h/1.1.1.2/Sat Jun 15 09:40:33 2002//
11 -/fetch.c/1.1.1.3/Sat Jun 15 09:40:34 2002//
12 -/ftp.1/1.1.1.3/Sat Jun 15 09:40:35 2002//
13 -/ftp.c/1.1.1.3/Sat Jun 15 09:40:36 2002//
14 -/ftp.cat1/1.1.1.1/Sat Jun 15 09:40:31 2002//
15 -/ftp_var.h/1.1.1.3/Sat Jun 15 09:40:36 2002//
16 -/main.c/1.1.1.3/Sat Jun 15 09:40:36 2002//
17 -/ruserpass.c/1.1.1.2/Sat Jun 15 09:40:36 2002//
18 -/util.c/1.1.1.2/Sat Jun 15 09:40:37 2002//
19 -/version.h/1.1.1.2/Sat Jun 15 09:40:37 2002//
20 +/Makefile/1.26/Tue Jan 21 16:08:06 2003//
21 +/cmds.c/1.100/Sat Nov 30 03:10:55 2002//
22 +/cmdtab.c/1.40/Mon Jul 29 04:24:47 2002//
23 +/complete.c/1.38/Mon May 1 10:35:17 2000//
24 +/domacro.c/1.19/Fri Feb 1 05:04:43 2002//
25 +/extern.h/1.61/Tue Jan 21 16:08:07 2003//
26 +/fetch.c/1.141/Wed May 14 14:31:00 2003//
27 +/ftp.1/1.94/Wed May 14 14:31:00 2003//
28 +/ftp.c/1.120/Wed Jun 5 10:20:49 2002//
29 +/ftp_var.h/1.64/Tue Jan 21 16:08:07 2003//
30 +/main.c/1.84/Wed May 14 14:31:00 2003//
31 +/progressbar.c/1.3/Fri Feb 28 09:53:49 2003//
32 +/progressbar.h/1.3/Fri Feb 28 09:53:49 2003//
33 +/ruserpass.c/1.28/Wed Nov 15 00:11:04 2000//
34 +/util.c/1.111/Fri Feb 28 09:54:51 2003//
35 +/version.h/1.30/Fri Feb 28 09:54:20 2003//
37 diff -Nru src/CVS/Repository /home/spock/ftp/CVS/Repository
38 --- src/CVS/Repository Thu Jan 30 11:00:13 2003
39 +++ /home/spock/ftp/CVS/Repository Thu Jun 12 02:02:10 2003
41 -src/contrib/lukemftp/src
43 diff -Nru src/CVS/Root /home/spock/ftp/CVS/Root
44 --- src/CVS/Root Thu Jan 30 11:00:13 2003
45 +++ /home/spock/ftp/CVS/Root Thu Jun 12 02:02:09 2003
47 -spock@current:/cvs/ncvs
48 +:pserver:anoncvs@anoncvs.netbsd.org:/cvsroot
49 diff -Nru src/Makefile /home/spock/ftp/Makefile
50 --- src/Makefile Wed Dec 31 19:00:00 1969
51 +++ /home/spock/ftp/Makefile Thu Jun 12 02:02:10 2003
53 +# $NetBSD: Makefile,v 1.26 2003/01/21 16:08:06 jhawk Exp $
54 +# from: @(#)Makefile 8.2 (Berkeley) 4/3/94
57 +SRCS= cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c \
58 + progressbar.c ruserpass.c util.c
60 +# Uncomment the following to provide defaults for gate-ftp operation
62 +#CPPFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21
64 +.if defined(SMALLPROG)
65 +CPPFLAGS+=-DNO_EDITCOMPLETE -DNO_ABOUT
67 +LDADD+= -ledit -ltermcap
68 +DPADD+= ${LIBEDIT} ${LIBTERMCAP}
71 +.if !defined(SMALLPROG) || defined(SMALLPROG_INET6)
75 +cmds.o fetch.o: version.h
78 +.include <bsd.prog.mk>
79 diff -Nru src/Makefile.in /home/spock/ftp/Makefile.in
80 --- src/Makefile.in Thu Jul 19 12:26:12 2001
81 +++ /home/spock/ftp/Makefile.in Wed Dec 31 19:00:00 1969
84 -# $Id: Makefile.in,v 1.8 2000/08/08 07:04:27 lukem Exp $
92 -exec_prefix = @exec_prefix@
95 -transform = @program_transform_name@
97 -mandircat1 = ${mandir}/cat1
100 -CFLAGS = -I${srcdir} -I${srcdir}/.. -I. -I.. @INCLUDES@ @CFLAGS@
107 -OBJS = cmds.o cmdtab.o complete.o domacro.o fetch.o ftp.o main.o \
113 - -mkdir -p ${bindir}
114 - ${INSTALL} -m 555 ${PROG} ${bindir}/`echo ${PROG}|sed '$(transform)'`
115 - -mkdir -p ${mandircat1}
116 - ${INSTALL} -m 444 ${srcdir}/${PROG}.cat1 ${mandircat1}/`echo ${PROG}|sed '$(transform)'`.1
118 -${PROG}: ${OBJS} @LIBDEPENDS@
119 - ${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
122 - rm -f core ${PROG} ${OBJS}
126 diff -Nru src/cmds.c /home/spock/ftp/cmds.c
127 --- src/cmds.c Sat Jun 15 05:40:32 2002
128 +++ /home/spock/ftp/cmds.c Thu Jun 12 02:02:10 2003
130 -/* $NetBSD: cmds.c,v 1.98 2002/06/05 10:20:46 lukem Exp $ */
131 +/* $NetBSD: cmds.c,v 1.100 2002/11/30 03:10:55 lukem Exp $ */
134 * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
135 @@ -102,11 +102,35 @@
139 +#include <sys/cdefs.h>
142 +static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
144 +__RCSID("$NetBSD: cmds.c,v 1.100 2002/11/30 03:10:55 lukem Exp $");
146 +#endif /* not lint */
149 * FTP User Program -- Command Routines.
152 -#include "lukemftp.h"
153 +#include <sys/types.h>
154 +#include <sys/socket.h>
155 +#include <sys/stat.h>
156 +#include <sys/wait.h>
157 +#include <arpa/ftp.h>
173 @@ -1008,7 +1032,7 @@
177 - gateport = strdup(argv[2]);
178 + gateport = xstrdup(argv[2]);
179 (void)strlcpy(gsbuf, argv[1], sizeof(gsbuf));
182 diff -Nru src/cmdtab.c /home/spock/ftp/cmdtab.c
183 --- src/cmdtab.c Sat Jun 15 05:40:33 2002
184 +++ /home/spock/ftp/cmdtab.c Thu Jun 12 02:02:10 2003
186 -/* $NetBSD: cmdtab.c,v 1.39 2000/11/15 00:10:59 lukem Exp $ */
187 +/* $NetBSD: cmdtab.c,v 1.40 2002/07/29 04:24:47 lukem Exp $ */
190 * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
195 -#include "lukemftp.h"
196 +#include <sys/cdefs.h>
199 +static char sccsid[] = "@(#)cmdtab.c 8.4 (Berkeley) 10/9/94";
201 +__RCSID("$NetBSD: cmdtab.c,v 1.40 2002/07/29 04:24:47 lukem Exp $");
203 +#endif /* not lint */
210 char ntranshelp[] = "set translation table for default file name mapping";
211 char optshelp[] = "show or set options for remote commands";
212 char pagehelp[] = "view a remote file through your pager";
213 -char passivehelp[] = "enter passive transfer mode";
214 +char passivehelp[] = "toggle use of passive transfer mode";
215 char plshelp[] = "list contents of remote path through your pager";
216 char pmlsdhelp[] = "list contents of remote directory in a machine "
217 "parsable form through your pager";
218 diff -Nru src/complete.c /home/spock/ftp/complete.c
219 --- src/complete.c Thu Jul 19 12:26:13 2001
220 +++ /home/spock/ftp/complete.c Thu Jun 12 02:02:10 2003
222 * POSSIBILITY OF SUCH DAMAGE.
225 +#include <sys/cdefs.h>
227 +__RCSID("$NetBSD: complete.c,v 1.38 2000/05/01 10:35:17 lukem Exp $");
228 +#endif /* not lint */
231 * FTP user program - command and file completion routines
234 -#include "lukemftp.h"
235 +#include <sys/stat.h>
246 diff -Nru src/domacro.c /home/spock/ftp/domacro.c
247 --- src/domacro.c Sat Jun 15 05:40:33 2002
248 +++ /home/spock/ftp/domacro.c Thu Jun 12 02:02:10 2003
253 -#include "lukemftp.h"
254 +#include <sys/cdefs.h>
257 +static char sccsid[] = "@(#)domacro.c 8.3 (Berkeley) 4/2/94";
259 +__RCSID("$NetBSD: domacro.c,v 1.19 2002/02/01 05:04:43 itojun Exp $");
261 +#endif /* not lint */
269 diff -Nru src/extern.h /home/spock/ftp/extern.h
270 --- src/extern.h Sat Jun 15 05:40:33 2002
271 +++ /home/spock/ftp/extern.h Thu Jun 12 02:02:10 2003
273 -/* $NetBSD: extern.h,v 1.60 2000/10/11 14:46:03 is Exp $ */
274 +/* $NetBSD: extern.h,v 1.61 2003/01/21 16:08:07 jhawk Exp $ */
277 - * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
278 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
279 * All rights reserved.
281 * This code is derived from software contributed to The NetBSD Foundation
284 void account(int, char **);
285 void ai_unmapped(struct addrinfo *);
286 -void alarmtimer(int);
287 int another(int *, char ***, const char *);
288 int auto_fetch(int, char **);
289 int auto_put(int, char **, const char *);
291 void cmdtimeout(int);
292 void cmdscanner(void);
293 int command(const char *, ...)
295 + __attribute__((__format__(__printf__, 1, 2)));
296 #ifndef NO_EDITCOMPLETE
297 unsigned char complete(EditLine *, int);
298 void controlediting(void);
299 @@ -183,14 +182,11 @@
300 void page(int, char **);
301 int parseport(const char *, int);
302 int parserate(int, char **, int);
303 -void progressmeter(int);
306 void proxtrans(const char *, const char *, const char *);
310 -void ptransfer(int);
311 void put(int, char **);
312 void pwd(int, char **);
313 void quit(int, char **);
315 StringList *xsl_init(void);
316 void xsl_add(StringList *, char *);
317 char *xstrdup(const char *);
318 -sigfunc xsignal(int, sigfunc);
319 -sigfunc xsignal_restart(int, sigfunc, int);
320 diff -Nru src/fetch.c /home/spock/ftp/fetch.c
321 --- src/fetch.c Sun Feb 16 14:45:52 2003
322 +++ /home/spock/ftp/fetch.c Thu Jun 12 02:02:11 2003
324 -/* $NetBSD: fetch.c,v 1.136 2002/06/05 10:20:48 lukem Exp $ */
325 +/* $NetBSD: fetch.c,v 1.141 2003/05/14 14:31:00 wiz Exp $ */
328 - * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
329 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
330 * All rights reserved.
332 * This code is derived from software contributed to The NetBSD Foundation
334 * POSSIBILITY OF SUCH DAMAGE.
337 +#include <sys/cdefs.h>
339 +__RCSID("$NetBSD: fetch.c,v 1.141 2003/05/14 14:31:00 wiz Exp $");
340 +#endif /* not lint */
343 * FTP User Program -- Command line file retrieval
346 -#include "lukemftp.h"
347 +#include <sys/types.h>
348 +#include <sys/param.h>
349 +#include <sys/socket.h>
350 +#include <sys/stat.h>
351 +#include <sys/time.h>
353 +#include <netinet/in.h>
355 +#include <arpa/ftp.h>
356 +#include <arpa/inet.h>
372 *response = (char *)xmalloc(rlen);
373 (void)strlcpy(*response, scheme, rlen);
374 len = strlcat(*response, " ", rlen);
375 - base64_encode(clear, clen, *response + len);
376 + base64_encode(clear, clen, (u_char *)*response + len);
377 memset(clear, 0, clen);
380 @@ -235,12 +260,12 @@
381 * XXX: this is not totally RFC 1738 compliant; <path> will have the
382 * leading `/' unless it's an ftp:// URL, as this makes things easier
383 * for file:// and http:// URLs. ftp:// URLs have the `/' between the
384 - * host and the url-path removed, but any additional leading slashes
385 - * in the url-path are retained (because they imply that we should
386 + * host and the URL-path removed, but any additional leading slashes
387 + * in the URL-path are retained (because they imply that we should
388 * later do "CWD" with a null argument).
391 - * input url output path
392 + * input URL output path
393 * --------- -----------
395 * "http://host/" NULL
397 rval = fetch_ftp(url);
398 goto cleanup_fetch_url;
400 - warnx("Invalid URL (no file after directory) `%s'", url);
401 + warnx("no file after directory (you must specify an "
402 + "output file) `%s'", url);
403 goto cleanup_fetch_url;
406 @@ -1372,7 +1398,7 @@
407 dir ? dir : "<null>", file ? file : "<null>");
409 dirhasglob = filehasglob = 0;
410 - if (doglob && (urltype == CLASSIC_URL_T || urltype == FTP_URL_T)) {
411 + if (doglob && urltype == CLASSIC_URL_T) {
412 if (! EMPTYSTRING(dir) && strpbrk(dir, "*?[]{}") != NULL)
414 if (! EMPTYSTRING(file) && strpbrk(file, "*?[]{}") != NULL)
415 @@ -1741,7 +1767,7 @@
419 - fprintf(ttyout, "auto_put: url `%s' argv[2] `%s'\n",
420 + fprintf(ttyout, "auto_put: URL `%s' argv[2] `%s'\n",
421 path, uargv[2] ? uargv[2] : "<null>");
423 /* connect and cwd */
424 diff -Nru src/ftp.1 /home/spock/ftp/ftp.1
425 --- src/ftp.1 Sat Jun 15 05:40:35 2002
426 +++ /home/spock/ftp/ftp.1 Thu Jun 12 02:02:11 2003
428 -.\" $NetBSD: ftp.1,v 1.83 2002/06/05 10:20:48 lukem Exp $
429 +.\" $NetBSD: ftp.1,v 1.94 2003/05/14 14:31:00 wiz Exp $
431 -.\" Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
432 +.\" Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
433 .\" All rights reserved.
435 .\" This code is derived from software contributed to The NetBSD Foundation
438 .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
441 +.Dd January 20, 2003
447 Internet file transfer program
451 .Op Fl 46AadefginpRtvV
458 +.Op Fl q Ar quittime
464 +.\" [-T dir,max[,inc]]
479 +.\" [[user@]host [port]]
481 -[\fIuser\fR@]\fIhost\fR
482 +.Oo Ar user Ns Li \&@ Oc Ns Ar host
487 -[\fIuser\fR@]\fIhost\fR:[\fIpath\fR][/]
488 +.\" [[user@]host:[path][/]]
499 -.Op file:///\fIpath\fR
503 +.Li file:/// Ar path
508 -.Op ftp://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR[/]
509 +.\" [ftp://[user[:password]@]host[:port]/path[/]]
514 +.Op Li \&: Ar password
516 +.Ar host Oo Li \&: Ar port Oc
524 -.Op http://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR
525 +.\" [http://[user[:password]@]host[:port]/path]
530 +.Op Li \&: Ar password
532 +.Ar host Oo Li \&: Ar port Oc
540 -.\".Ar ftp://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR[/[file]]
542 -.\".Ar [\fIuser\fR@]\fIhost\fR:[\fIpath\fR][/[\fIfile\fR]]
546 +.Fl u Ar URL Ar file
551 Retry the connection attempt if it failed, pausing for
554 +.It Fl q Ar quittime
555 +Quit if the connection has stalled for
559 Restart all non-proxied auto-fetches.
561 @@ -266,11 +305,11 @@
564 for more information.
565 -.It Fl u Ar url file Op \&.\&.\&.
566 +.It Fl u Ar URL file Op \&.\&.\&.
567 Upload files on the command line to
573 is one of the ftp URL types as supported by auto-fetch
574 (with an optional target filename for single file uploads), and
581 +.Ic "set auto-login"
582 option is on (default),
584 will also attempt to automatically log the user in to
585 @@ -882,10 +921,10 @@
586 and display with the program specified by the
589 -.It Ic passive Op Ic auto
590 +.It Ic passive Op Cm auto
591 Toggle passive mode (if no arguments are given).
598 @@ -896,14 +935,17 @@
600 command for all data connections instead of a
606 command requests that the remote server open a port for the data connection
607 -and return the address of that port. The remote server listens on that
608 -port and the client connects to it. When using the more traditional
609 +and return the address of that port.
610 +The remote server listens on that port and the client connects to it.
611 +When using the more traditional
613 command, the client listens on a port and sends that address to the remote
614 -server, who connects back to it. Passive mode is useful when using
615 +server, who connects back to it.
616 +Passive mode is useful when using
618 through a gateway router or host that controls the directionality of
620 @@ -965,34 +1007,34 @@
622 When prompting is on, the following commands are available at a prompt:
623 .Bl -tag -width 2n -offset indent
628 to the current file, and automatically answer
630 to any remaining files for the current command.
635 and do not transfer the file.
640 to the current file, and turn off prompt mode
646 Terminate the current operation.
651 and transfer the file.
654 Display a help message.
657 -Any other reponse will answer
658 +Any other response will answer
661 .It Ic proxy Ar ftp-command
662 @@ -1072,11 +1114,11 @@
665 .Bl -tag -width "all" -offset indent -compact
677 @@ -1240,7 +1282,7 @@
678 implementations which do ignore
680 commands but, incorrectly, indicate they've been accepted.
681 -.It Ic set Op Ar "option value"
682 +.It Ic set Op Ar option Ar value
686 @@ -1252,25 +1294,25 @@
687 are not given, display all of the options and their values.
688 The currently supported options are:
689 .Bl -tag -width "http_proxy" -offset indent
719 @@ -1415,13 +1457,14 @@
720 interpretation of the argument.
721 Supported suffixes are:
722 .Bl -tag -width 3n -offset indent -compact
724 -Causes no modification. (Optional)
727 +Causes no modification.
730 Kilo; multiply the argument by 1024
733 Mega; multiply the argument by 1048576
736 Giga; multiply the argument by 1073741824
739 @@ -1447,7 +1490,15 @@
741 The following formats are valid syntax for an auto-fetch element:
742 .Bl -tag -width "FOO "
743 -.It [user@]host:[path][/]
744 +.\" [user@]host:[path][/]
756 @@ -1471,7 +1522,19 @@
757 in the current directory.
758 Otherwise, the full remote name is used as the local name,
759 relative to the local root directory.
760 -.It ftp://[user[:password]@]host[:port]/path[/][;type=X]
761 +.\" ftp://[user[:password]@]host[:port]/path[/][;type=X]
766 +.Op Li \&: Ar password
768 +.Ar host Oo Li \&: Ar port Oc
776 URL, retrieved using the
777 @@ -1493,15 +1556,94 @@
779 if supplied, otherwise prompt the user for one.
785 +is supplied, then the transfer type will take place as
786 +ascii or binary (respectively).
787 +The default transfer type is binary.
789 In order to be compliant with
799 +auto-fetch URL as follows:
804 +immediately after the
805 +.Ar host Ns Oo Li \&: Ns Ar port Oc
806 +is interpreted as a separator before the
808 +and not as part of the
815 +.So Li / Sc Ns -separated
816 +list of name components.
817 +For all but the last such component,
819 +performs the equivalent of a
822 +For the last path component,
824 +performs the equivalent of a
828 +Empty name components,
835 +at the beginning of the
837 -resulting in a transfer relative from the default login directory of
839 +will cause the equivalent of a
841 +command without a directory name.
842 +This is unlikely to be useful.
846 +codes within the path components are decoded, with
848 +representing a character code in hexadecimal.
849 +This decoding takes place after the
851 +has been split into components,
852 +but before each component is used in the equivalent of a
857 +Some often-used codes are
867 +The above interpretation has the following consequences:
870 +The path is interpreted relative to the
871 +default login directory of the specified user or of the
876 directory is required, use a leading path of
877 @@ -1519,15 +1661,57 @@
880 .Dq ftp://myname:mypass@localhost/%2fetc/motd
886 -is supplied, then the transfer type will take place as
887 -ascii or binary (respectively).
888 -The default transfer type is binary.
889 -.It http://[user[:password]@]host[:port]/path
895 +commands can be controlled by careful choice of
902 +For example, the following URLs correspond to the
903 +equivalents of the indicated commands:
904 +.Bl -tag -width "ftp://host/%2Fdir1%2Fdir2%2Ffile"
905 +.It ftp://host/dir1/dir2/file
909 +.It ftp://host/%2Fdir1/dir2/file
913 +.It ftp://host/dir1%2Fdir2/file
914 +.Dq "cd dir1/dir2" ,
916 +.It ftp://host/%2Fdir1%2Fdir2/file
917 +.Dq "cd /dir1/dir2" ,
919 +.It ftp://host/dir1%2Fdir2%2Ffile
920 +.Dq "get dir1/dir2/file" .
921 +.It ftp://host/%2Fdir1%2Fdir2%2Ffile
922 +.Dq "get /dir1/dir2/file" .
925 +You must have appropriate access permission for each of the
926 +intermediate directories that is used in the equivalent of a
930 +.\" http://[user[:password]@]host[:port]/path
935 +.Op Li \&: Ar password
937 +.Ar host Oo Li \&: Ar port Oc
943 URL, retrieved using the
944 @@ -1540,16 +1724,22 @@
948 -authorisation is required to retrieve
949 +authorization is required to retrieve
955 is in the URL, use them for the first attempt to authenticate.
960 +.Li file:/// Ar path
963 A local URL, copied from
969 Unless noted otherwise above, and
970 @@ -1736,7 +1926,7 @@
972 supports only the default values for the remaining
973 file transfer parameters:
979 @@ -1841,6 +2031,14 @@
981 is defined, it is automatically executed as the last step in the
984 +.Bd -literal -offset indent
990 +followed by a blank line.
992 .Sh COMMAND LINE EDITING
994 @@ -1888,9 +2086,20 @@
995 The following formatting sequences are replaced by the given
997 .Bl -tag -width "%% " -offset indent
1000 The current remote working directory.
1001 -.It %c[[0]\fIn\fR], %.[[0]\fIn\fR]
1002 +.\" %c[[0]n], %.[[0]n]
1006 +.Op Oo Li 0 Oc Ar n
1011 +.Op Oo Li 0 Oc Ar n
1014 The trailing component of the current remote working directory, or
1016 trailing components if a digit
1017 @@ -1902,21 +2111,28 @@
1019 the number of skipped components precede the trailing component(s) in
1021 -.Dq /\fI\*[Lt]skipped\*[Gt]\fRtrailing
1022 +.\" ``/<number>trailing''
1025 +.Li / Li \*[Lt] Va number Li \*[Gt]
1034 +.\" ``...trailing''
1035 +.Dq Li \&... Ns Va trailing
1041 The remote host name.
1044 The remote host name, up to the first
1048 The remote user name.
1054 @@ -1934,15 +2150,15 @@
1055 Overrides the default operation mode.
1057 .Bl -tag -width "passive"
1065 automatic determination of passive or active (this is the default)
1074 @@ -2028,6 +2244,21 @@
1075 Each entry may have an optional trailing ":port", which restricts
1076 the matching to connections to that port.
1078 +.Sh EXTENDED PASSIVE MODE AND FIREWALLS
1079 +Some firewall configurations do not allow
1081 +to use extended passive mode.
1082 +If you find that even a simple
1084 +appears to hang after printing a message such as this:
1086 +.Dl 229 Entering Extended Passive Mode (|||58551|)
1088 +then you will need to disable extended passive mode with
1090 +See the above section
1091 +.Sx The .netrc File
1092 +for an example of how to make this automatic.
1094 .Xr getservbyname 3 ,
1096 @@ -2061,7 +2292,9 @@
1100 -by Luke Mewburn \*[Lt]lukem@netbsd.org\*[Gt].
1103 +.Aq lukem@NetBSD.org .
1105 IPv6 support was added by the WIDE/KAME project
1106 (but may not be present in all non-NetBSD versions of this program, depending
1107 diff -Nru src/ftp.c /home/spock/ftp/ftp.c
1108 --- src/ftp.c Sat Jun 15 05:40:36 2002
1109 +++ /home/spock/ftp/ftp.c Thu Jun 12 02:02:11 2003
1114 -#include "lukemftp.h"
1115 +#include <sys/cdefs.h>
1118 +static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
1120 +__RCSID("$NetBSD: ftp.c,v 1.120 2002/06/05 10:20:49 lukem Exp $");
1122 +#endif /* not lint */
1124 +#include <sys/types.h>
1125 +#include <sys/stat.h>
1126 +#include <sys/socket.h>
1127 +#include <sys/time.h>
1129 +#include <netinet/in.h>
1130 +#include <netinet/in_systm.h>
1131 +#include <netinet/ip.h>
1132 +#include <arpa/inet.h>
1133 +#include <arpa/ftp.h>
1134 #include <arpa/telnet.h>
1141 +#include <stdlib.h>
1142 +#include <string.h>
1144 +#include <unistd.h>
1145 +#include <stdarg.h>
1150 #include "ftp_var.h"
1152 diff -Nru src/ftp.cat1 /home/spock/ftp/ftp.cat1
1153 --- src/ftp.cat1 Sat Jun 15 05:40:31 2002
1154 +++ /home/spock/ftp/ftp.cat1 Wed Dec 31 19:00:00 1969
1156 -FTP(1) NetBSD Reference Manual FTP(1)
1159 - f
\bft
\btp
\bp - Internet file transfer program
1161 -S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
1162 - f
\bft
\btp
\bp [-
\b-4
\b46
\b6A
\bAa
\bad
\bde
\bef
\bfg
\bgi
\bin
\bnp
\bpR
\bRt
\btv
\bvV
\bV] [-
\b-N
\bN _
\bn_
\be_
\bt_
\br_
\bc] [-
\b-o
\bo _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt] [-
\b-P
\bP _
\bp_
\bo_
\br_
\bt] [-
\b-r
\br _
\br_
\be_
\bt_
\br_
\by] [-
\b-T
\bT
1163 - _
\bd_
\bi_
\br,_
\bm_
\ba_
\bx[,_
\bi_
\bn_
\bc]] [[_
\bu_
\bs_
\be_
\br@]_
\bh_
\bo_
\bs_
\bt [_
\bp_
\bo_
\br_
\bt]] [_
\bu_
\bs_
\be_
\br@]_
\bh_
\bo_
\bs_
\bt:[_
\bp_
\ba_
\bt_
\bh][/]
1164 - [file:///_
\bp_
\ba_
\bt_
\bh] [ftp://[_
\bu_
\bs_
\be_
\br[:_
\bp_
\ba_
\bs_
\bs_
\bw_
\bo_
\br_
\bd]@]_
\bh_
\bo_
\bs_
\bt[:_
\bp_
\bo_
\br_
\bt]/_
\bp_
\ba_
\bt_
\bh[/]]
1165 - [http://[_
\bu_
\bs_
\be_
\br[:_
\bp_
\ba_
\bs_
\bs_
\bw_
\bo_
\br_
\bd]@]_
\bh_
\bo_
\bs_
\bt[:_
\bp_
\bo_
\br_
\bt]/_
\bp_
\ba_
\bt_
\bh] [_
\b._
\b._
\b.]
1166 - f
\bft
\btp
\bp -
\b-u
\bu _
\bu_
\br_
\bl file [_
\b._
\b._
\b.]
1168 -D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
1169 - f
\bft
\btp
\bp is the user interface to the Internet standard File Transfer Proto-
1170 - col. The program allows a user to transfer files to and from a remote
1173 - The last five arguments will fetch a file using the FTP or HTTP proto-
1174 - cols, or by direct copying, into the current directory. This is ideal
1175 - for scripts. Refer to _
\bA_
\bU_
\bT_
\bO_
\b-_
\bF_
\bE_
\bT_
\bC_
\bH_
\bI_
\bN_
\bG _
\bF_
\bI_
\bL_
\bE_
\bS below for more information.
1177 - Options may be specified at the command line, or to the command inter-
1180 - -
\b-4
\b4 Forces f
\bft
\btp
\bp to only use IPv4 addresses.
1182 - -
\b-6
\b6 Forces f
\bft
\btp
\bp to only use IPv6 addresses.
1184 - -
\b-A
\bA Force active mode ftp. By default, f
\bft
\btp
\bp will try to use passive
1185 - mode ftp and fall back to active mode if passive is not support-
1186 - ed by the server. This option causes f
\bft
\btp
\bp to always use an ac-
1187 - tive connection. It is only useful for connecting to very old
1188 - servers that do not implement passive mode properly.
1190 - -
\b-a
\ba Causes f
\bft
\btp
\bp to bypass normal login procedure, and use an anony-
1191 - mous login instead.
1193 - -
\b-d
\bd Enables debugging.
1195 - -
\b-e
\be Disables command line editing. This is useful for Emacs ange-
1198 - -
\b-f
\bf Forces a cache reload for transfers that go through the FTP or
1201 - -
\b-g
\bg Disables file name globbing.
1203 - -
\b-i
\bi Turns off interactive prompting during multiple file transfers.
1205 - -
\b-n
\bn Restrains f
\bft
\btp
\bp from attempting ``auto-login'' upon initial con-
1206 - nection. If auto-login is enabled, f
\bft
\btp
\bp will check the _
\b._
\bn_
\be_
\bt_
\br_
\bc
1207 - (see below) file in the user's home directory for an entry de-
1208 - scribing an account on the remote machine. If no entry exists,
1209 - f
\bft
\btp
\bp will prompt for the remote machine login name (default is
1210 - the user identity on the local machine), and, if necessary,
1211 - prompt for a password and an account with which to login.
1213 - -
\b-N
\bN _
\bn_
\be_
\bt_
\br_
\bc
1214 - Use _
\bn_
\be_
\bt_
\br_
\bc instead of _
\b~_
\b/_
\b._
\bn_
\be_
\bt_
\br_
\bc. Refer to _
\bT_
\bH_
\bE _
\b._
\bn_
\be_
\bt_
\br_
\bc _
\bF_
\bI_
\bL_
\bE for
1217 - -
\b-o
\bo _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt
1218 - When auto-fetching files, save the contents in _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt. _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt
1219 - is parsed according to the _
\bF_
\bI_
\bL_
\bE _
\bN_
\bA_
\bM_
\bI_
\bN_
\bG _
\bC_
\bO_
\bN_
\bV_
\bE_
\bN_
\bT_
\bI_
\bO_
\bN_
\bS below. If
1220 - _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt is not `-' or doesn't start with `|', then only the first
1221 - file specified will be retrieved into _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt; all other files
1222 - will be retrieved into the basename of their remote name.
1224 - -
\b-p
\bp Enable passive mode operation for use behind connection filter-
1225 - ing firewalls. This option has been deprecated as f
\bft
\btp
\bp now tries
1226 - to use passive mode by default, falling back to active mode if
1227 - the server does not support passive connections.
1229 - -
\b-P
\bP _
\bp_
\bo_
\br_
\bt Sets the port number to _
\bp_
\bo_
\br_
\bt.
1231 - -
\b-r
\br _
\bw_
\ba_
\bi_
\bt Retry the connection attempt if it failed, pausing for _
\bw_
\ba_
\bi_
\bt sec-
1234 - -
\b-R
\bR Restart all non-proxied auto-fetches.
1236 - -
\b-t
\bt Enables packet tracing.
1238 - -
\b-T
\bT _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bi_
\bo_
\bn,_
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm[,_
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt]
1239 - Set the maximum transfer rate for _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bi_
\bo_
\bn to _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm
1240 - bytes/second, and if specified, the increment to _
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt
1241 - bytes/second. Refer to r
\bra
\bat
\bte
\be for more information.
1243 - -
\b-u
\bu _
\bu_
\br_
\bl _
\bf_
\bi_
\bl_
\be [...]
1244 - Upload files on the command line to _
\bu_
\br_
\bl where _
\bu_
\br_
\bl is one of the
1245 - ftp URL types as supported by auto-fetch (with an optional tar-
1246 - get filename for single file uploads), and _
\bf_
\bi_
\bl_
\be is one or more
1247 - local files to be uploaded.
1249 - -
\b-v
\bv Enable v
\bve
\ber
\brb
\bbo
\bos
\bse
\be and p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs. This is the default if output is
1250 - to a terminal (and in the case of p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs, f
\bft
\btp
\bp is the fore-
1251 - ground process). Forces f
\bft
\btp
\bp to show all responses from the re-
1252 - mote server, as well as report on data transfer statistics.
1254 - -
\b-V
\bV Disable v
\bve
\ber
\brb
\bbo
\bos
\bse
\be and p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs, overriding the default of enabled
1255 - when output is to a terminal.
1257 - The client host with which f
\bft
\btp
\bp is to communicate may be specified on the
1258 - command line. If this is done, f
\bft
\btp
\bp will immediately attempt to establish
1259 - a connection to an FTP server on that host; otherwise, f
\bft
\btp
\bp will enter its
1260 - command interpreter and await instructions from the user. When f
\bft
\btp
\bp is
1261 - awaiting commands from the user the prompt `ftp>' is provided to the us-
1262 - er. The following commands are recognized by f
\bft
\btp
\bp:
1264 - !
\b! [_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd [_
\ba_
\br_
\bg_
\bs]]
1265 - Invoke an interactive shell on the local machine. If there
1266 - are arguments, the first is taken to be a command to execute
1267 - directly, with the rest of the arguments as its arguments.
1269 - $
\b$ _
\bm_
\ba_
\bc_
\br_
\bo_
\b-_
\bn_
\ba_
\bm_
\be [_
\ba_
\br_
\bg_
\bs]
1270 - Execute the macro _
\bm_
\ba_
\bc_
\br_
\bo_
\b-_
\bn_
\ba_
\bm_
\be that was defined with the m
\bma
\bac
\bcd
\bde
\bef
\bf
1271 - command. Arguments are passed to the macro unglobbed.
1273 - a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bt [_
\bp_
\ba_
\bs_
\bs_
\bw_
\bd]
1274 - Supply a supplemental password required by a remote system
1275 - for access to resources once a login has been successfully
1276 - completed. If no argument is included, the user will be
1277 - prompted for an account password in a non-echoing input mode.
1279 - a
\bap
\bpp
\bpe
\ben
\bnd
\bd _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be]
1280 - Append a local file to a file on the remote machine. If
1281 - _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be is left unspecified, the local file name is used
1282 - in naming the remote file after being altered by any n
\bnt
\btr
\bra
\ban
\bns
\bs
1283 - or n
\bnm
\bma
\bap
\bp setting. File transfer uses the current settings for
1284 - t
\bty
\byp
\bpe
\be, f
\bfo
\bor
\brm
\bma
\bat
\bt, m
\bmo
\bod
\bde
\be, and s
\bst
\btr
\bru
\buc
\bct
\btu
\bur
\bre
\be.
1286 - a
\bas
\bsc
\bci
\bii
\bi Set the file transfer t
\bty
\byp
\bpe
\be to network ASCII. This is the de-
1289 - b
\bbe
\bel
\bll
\bl Arrange that a bell be sounded after each file transfer com-
1290 - mand is completed.
1292 - b
\bbi
\bin
\bna
\bar
\bry
\by Set the file transfer t
\bty
\byp
\bpe
\be to support binary image transfer.
1294 - b
\bby
\bye
\be Terminate the FTP session with the remote server and exit
1295 - f
\bft
\btp
\bp. An end of file will also terminate the session and ex-
1298 - c
\bca
\bas
\bse
\be Toggle remote computer file name case mapping during g
\bge
\bet
\bt,
1299 - m
\bmg
\bge
\bet
\bt and m
\bmp
\bpu
\but
\bt commands. When c
\bca
\bas
\bse
\be is on (default is off),
1300 - remote computer file names with all letters in upper case are
1301 - written in the local directory with the letters mapped to
1304 - c
\bcd
\bd _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by
1305 - Change the working directory on the remote machine to _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-
1306 - _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by.
1308 - c
\bcd
\bdu
\bup
\bp Change the remote machine working directory to the parent of
1309 - the current remote machine working directory.
1311 - c
\bch
\bhm
\bmo
\bod
\bd _
\bm_
\bo_
\bd_
\be _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be
1312 - Change the permission modes of the file _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be on the
1313 - remote system to _
\bm_
\bo_
\bd_
\be.
1315 - c
\bcl
\blo
\bos
\bse
\be Terminate the FTP session with the remote server, and return
1316 - to the command interpreter. Any defined macros are erased.
1318 - c
\bcr
\br Toggle carriage return stripping during ascii type file re-
1319 - trieval. Records are denoted by a carriage return/linefeed
1320 - sequence during ascii type file transfer. When c
\bcr
\br is on (the
1321 - default), carriage returns are stripped from this sequence to
1322 - conform with the UNIX single linefeed record delimiter.
1323 - Records on non-UNIX remote systems may contain single line-
1324 - feeds; when an ascii type transfer is made, these linefeeds
1325 - may be distinguished from a record delimiter only when c
\bcr
\br is
1328 - d
\bde
\beb
\bbu
\bug
\bg [_
\bd_
\be_
\bb_
\bu_
\bg_
\b-_
\bv_
\ba_
\bl_
\bu_
\be]
1329 - Toggle debugging mode. If an optional _
\bd_
\be_
\bb_
\bu_
\bg_
\b-_
\bv_
\ba_
\bl_
\bu_
\be is speci-
1330 - fied it is used to set the debugging level. When debugging
1331 - is on, f
\bft
\btp
\bp prints each command sent to the remote machine,
1332 - preceded by the string `-->'
1334 - d
\bde
\bel
\ble
\bet
\bte
\be _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be
1335 - Delete the file _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be on the remote machine.
1337 - d
\bdi
\bir
\br [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]]
1338 - Print a listing of the contents of a directory on the remote
1339 - machine. The listing includes any system-dependent informa-
1340 - tion that the server chooses to include; for example, most
1341 - UNIX systems will produce output from the command `ls -l'.
1342 - If _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh is left unspecified, the current working di-
1343 - rectory is used. If interactive prompting is on, f
\bft
\btp
\bp will
1344 - prompt the user to verify that the last argument is indeed
1345 - the target local file for receiving d
\bdi
\bir
\br output. If no local
1346 - file is specified, or if _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be is `-
\b-', the output is
1347 - sent to the terminal.
1349 - d
\bdi
\bis
\bsc
\bco
\bon
\bnn
\bne
\bec
\bct
\bt A synonym for c
\bcl
\blo
\bos
\bse
\be.
1351 - e
\bed
\bdi
\bit
\bt Toggle command line editing, and context sensitive command
1352 - and file completion. This is automatically enabled if input
1353 - is from a terminal, and disabled otherwise.
1355 - e
\bep
\bps
\bsv
\bv4
\b4 Toggle the use of the extended EPSV and EPRT commands on IPv4
1356 - connections; first try EPSV / EPRT, and then PASV / PORT.
1357 - This is enabled by default. If an extended command fails
1358 - then this option will be temporarily disabled for the dura-
1359 - tion of the current connection, or until e
\bep
\bps
\bsv
\bv4
\b4 is executed
1362 - e
\bex
\bxi
\bit
\bt A synonym for b
\bby
\bye
\be.
1364 - f
\bfe
\bea
\bat
\btu
\bur
\bre
\bes
\bs Display what features the remote server supports (using the
1367 - f
\bfg
\bge
\bet
\bt _
\bl_
\bo_
\bc_
\ba_
\bl_
\bf_
\bi_
\bl_
\be
1368 - Retrieve the files listed in _
\bl_
\bo_
\bc_
\ba_
\bl_
\bf_
\bi_
\bl_
\be, which has one line
1371 - f
\bfo
\bor
\brm
\bm _
\bf_
\bo_
\br_
\bm_
\ba_
\bt
1372 - Set the file transfer f
\bfo
\bor
\brm
\bm to _
\bf_
\bo_
\br_
\bm_
\ba_
\bt. The default (and only
1373 - supported) format is ``non-print''.
1375 - f
\bft
\btp
\bp _
\bh_
\bo_
\bs_
\bt [_
\bp_
\bo_
\br_
\bt]
1376 - A synonym for o
\bop
\bpe
\ben
\bn.
1378 - g
\bga
\bat
\bte
\be [_
\bh_
\bo_
\bs_
\bt [_
\bp_
\bo_
\br_
\bt]]
1379 - Toggle gate-ftp mode, which used to connect through the TIS
1380 - FWTK and Gauntlet ftp proxies. This will not be permitted if
1381 - the gate-ftp server hasn't been set (either explicitly by the
1382 - user, or from the FTPSERVER environment variable). If _
\bh_
\bo_
\bs_
\bt
1383 - is given, then gate-ftp mode will be enabled, and the gate-
1384 - ftp server will be set to _
\bh_
\bo_
\bs_
\bt. If _
\bp_
\bo_
\br_
\bt is also given, that
1385 - will be used as the port to connect to on the gate-ftp serv-
1388 - g
\bge
\bet
\bt _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]
1389 - Retrieve the _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be and store it on the local machine.
1390 - If the local file name is not specified, it is given the same
1391 - name it has on the remote machine, subject to alteration by
1392 - the current c
\bca
\bas
\bse
\be, n
\bnt
\btr
\bra
\ban
\bns
\bs, and n
\bnm
\bma
\bap
\bp settings. The current
1393 - settings for t
\bty
\byp
\bpe
\be, f
\bfo
\bor
\brm
\bm, m
\bmo
\bod
\bde
\be, and s
\bst
\btr
\bru
\buc
\bct
\btu
\bur
\bre
\be are used while
1394 - transferring the file.
1396 - g
\bgl
\blo
\bob
\bb Toggle filename expansion for m
\bmd
\bde
\bel
\ble
\bet
\bte
\be, m
\bmg
\bge
\bet
\bt, m
\bmp
\bpu
\but
\bt, and
1397 - m
\bmr
\bre
\beg
\bge
\bet
\bt. If globbing is turned off with g
\bgl
\blo
\bob
\bb, the file name
1398 - arguments are taken literally and not expanded. Globbing for
1399 - m
\bmp
\bpu
\but
\bt is done as in csh(1). For m
\bmd
\bde
\bel
\ble
\bet
\bte
\be, m
\bmg
\bge
\bet
\bt, and m
\bmr
\bre
\beg
\bge
\bet
\bt,
1400 - each remote file name is expanded separately on the remote
1401 - machine and the lists are not merged. Expansion of a direc-
1402 - tory name is likely to be different from expansion of the
1403 - name of an ordinary file: the exact result depends on the
1404 - foreign operating system and ftp server, and can be previewed
1405 - by doing `mls remote-files -' Note: m
\bmg
\bge
\bet
\bt, m
\bmp
\bpu
\but
\bt and m
\bmr
\bre
\beg
\bge
\bet
\bt are
1406 - not meant to transfer entire directory subtrees of files.
1407 - That can be done by transferring a tar(1) archive of the sub-
1408 - tree (in binary mode).
1410 - h
\bha
\bas
\bsh
\bh [_
\bs_
\bi_
\bz_
\be]
1411 - Toggle hash-sign (``#'') printing for each data block trans-
1412 - ferred. The size of a data block defaults to 1024 bytes.
1413 - This can be changed by specifying _
\bs_
\bi_
\bz_
\be in bytes. Enabling
1414 - h
\bha
\bas
\bsh
\bh disables p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs.
1416 - h
\bhe
\bel
\blp
\bp [_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd]
1417 - Print an informative message about the meaning of _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd.
1418 - If no argument is given, f
\bft
\btp
\bp prints a list of the known com-
1421 - i
\bid
\bdl
\ble
\be [_
\bs_
\be_
\bc_
\bo_
\bn_
\bd_
\bs]
1422 - Set the inactivity timer on the remote server to _
\bs_
\be_
\bc_
\bo_
\bn_
\bd_
\bs sec-
1423 - onds. If _
\bs_
\be_
\bc_
\bo_
\bn_
\bd_
\bs is omitted, the current inactivity timer is
1426 - i
\bim
\bma
\bag
\bge
\be A synonym for b
\bbi
\bin
\bna
\bar
\bry
\by.
1428 - l
\blc
\bcd
\bd [_
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by]
1429 - Change the working directory on the local machine. If no
1430 - _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by is specified, the user's home directory is used.
1432 - l
\ble
\bes
\bss
\bs _
\bf_
\bi_
\bl_
\be A synonym for p
\bpa
\bag
\bge
\be.
1434 - l
\blp
\bpa
\bag
\bge
\be _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be
1435 - Display _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be with the program specified by the s
\bse
\bet
\bt
1436 - p
\bpa
\bag
\bge
\ber
\br option.
1438 - l
\blp
\bpw
\bwd
\bd Print the working directory on the local machine.
1440 - l
\bls
\bs [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]]
1441 - A synonym for d
\bdi
\bir
\br.
1443 - m
\bma
\bac
\bcd
\bde
\bef
\bf _
\bm_
\ba_
\bc_
\br_
\bo_
\b-_
\bn_
\ba_
\bm_
\be
1444 - Define a macro. Subsequent lines are stored as the macro
1445 - _
\bm_
\ba_
\bc_
\br_
\bo_
\b-_
\bn_
\ba_
\bm_
\be; a null line (consecutive newline characters in a
1446 - file or carriage returns from the terminal) terminates macro
1447 - input mode. There is a limit of 16 macros and 4096 total
1448 - characters in all defined macros. Macros remain defined un-
1449 - til a c
\bcl
\blo
\bos
\bse
\be command is executed. The macro processor inter-
1450 - prets `$' and `\' as special characters. A `$' followed by a
1451 - number (or numbers) is replaced by the corresponding argument
1452 - on the macro invocation command line. A `$' followed by an
1453 - `i' signals that macro processor that the executing macro is
1454 - to be looped. On the first pass `$i' is replaced by the
1455 - first argument on the macro invocation command line, on the
1456 - second pass it is replaced by the second argument, and so on.
1457 - A `\' followed by any character is replaced by that charac-
1458 - ter. Use the `\' to prevent special treatment of the `$'.
1460 - m
\bmd
\bde
\bel
\ble
\bet
\bte
\be [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs]
1461 - Delete the _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs on the remote machine.
1463 - m
\bmd
\bdi
\bir
\br _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be
1464 - Like d
\bdi
\bir
\br, except multiple remote files may be specified. If
1465 - interactive prompting is on, f
\bft
\btp
\bp will prompt the user to ver-
1466 - ify that the last argument is indeed the target local file
1467 - for receiving m
\bmd
\bdi
\bir
\br output.
1469 - m
\bmg
\bge
\bet
\bt _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs
1470 - Expand the _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs on the remote machine and do a g
\bge
\bet
\bt
1471 - for each file name thus produced. See g
\bgl
\blo
\bob
\bb for details on
1472 - the filename expansion. Resulting file names will then be
1473 - processed according to c
\bca
\bas
\bse
\be, n
\bnt
\btr
\bra
\ban
\bns
\bs, and n
\bnm
\bma
\bap
\bp settings.
1474 - Files are transferred into the local working directory, which
1475 - can be changed with `lcd directory'; new local directories
1476 - can be created with `! mkdir directory'.
1478 - m
\bmk
\bkd
\bdi
\bir
\br _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by_
\b-_
\bn_
\ba_
\bm_
\be
1479 - Make a directory on the remote machine.
1481 - m
\bml
\bls
\bs _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be
1482 - Like l
\bls
\bs, except multiple remote files may be specified, and
1483 - the _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be must be specified. If interactive prompting
1484 - is on, f
\bft
\btp
\bp will prompt the user to verify that the last argu-
1485 - ment is indeed the target local file for receiving m
\bml
\bls
\bs out-
1488 - m
\bml
\bls
\bsd
\bd [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh]
1489 - Display the contents of _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh (which should default to
1490 - the current directory if not given) in a machine-parsable
1491 - form, using MLSD. The format of display can be changed with
1492 - `remopts mlst ...'.
1494 - m
\bml
\bls
\bst
\bt [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh]
1495 - Display the details about _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh (which should default
1496 - to the current directory if not given) in a machine-parsable
1497 - form, using MLST. The format of display can be changed with
1498 - `remopts mlst ...'.
1500 - m
\bmo
\bod
\bde
\be _
\bm_
\bo_
\bd_
\be_
\b-_
\bn_
\ba_
\bm_
\be
1501 - Set the file transfer m
\bmo
\bod
\bde
\be to _
\bm_
\bo_
\bd_
\be_
\b-_
\bn_
\ba_
\bm_
\be. The default (and
1502 - only supported) mode is ``stream''.
1504 - m
\bmo
\bod
\bdt
\bti
\bim
\bme
\be _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be
1505 - Show the last modification time of the file on the remote ma-
1508 - m
\bmo
\bor
\bre
\be _
\bf_
\bi_
\bl_
\be A synonym for p
\bpa
\bag
\bge
\be.
1510 - m
\bmp
\bpu
\but
\bt _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be_
\bs
1511 - Expand wild cards in the list of local files given as argu-
1512 - ments and do a p
\bpu
\but
\bt for each file in the resulting list. See
1513 - g
\bgl
\blo
\bob
\bb for details of filename expansion. Resulting file names
1514 - will then be processed according to n
\bnt
\btr
\bra
\ban
\bns
\bs and n
\bnm
\bma
\bap
\bp settings.
1516 - m
\bmr
\bre
\beg
\bge
\bet
\bt _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be_
\bs
1517 - As per m
\bmg
\bge
\bet
\bt, but performs a r
\bre
\beg
\bge
\bet
\bt instead of g
\bge
\bet
\bt.
1519 - m
\bms
\bse
\ben
\bnd
\bd _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be_
\bs
1520 - A synonym for m
\bmp
\bpu
\but
\bt.
1522 - n
\bne
\bew
\bwe
\ber
\br _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]
1523 - Get the file only if the modification time of the remote file
1524 - is more recent that the file on the current system. If the
1525 - file does not exist on the current system, the remote file is
1526 - considered n
\bne
\bew
\bwe
\ber
\br. Otherwise, this command is identical to
1529 - n
\bnl
\bli
\bis
\bst
\bt [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]]
1530 - A synonym for l
\bls
\bs.
1532 - n
\bnm
\bma
\bap
\bp [_
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn _
\bo_
\bu_
\bt_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn]
1533 - Set or unset the filename mapping mechanism. If no arguments
1534 - are specified, the filename mapping mechanism is unset. If
1535 - arguments are specified, remote filenames are mapped during
1536 - m
\bmp
\bpu
\but
\bt commands and p
\bpu
\but
\bt commands issued without a specified re-
1537 - mote target filename. If arguments are specified, local
1538 - filenames are mapped during m
\bmg
\bge
\bet
\bt commands and g
\bge
\bet
\bt commands
1539 - issued without a specified local target filename. This com-
1540 - mand is useful when connecting to a non-UNIX remote computer
1541 - with different file naming conventions or practices. The
1542 - mapping follows the pattern set by _
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn and _
\bo_
\bu_
\bt_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn.
1543 - [_
\bI_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn] is a template for incoming filenames (which may
1544 - have already been processed according to the n
\bnt
\btr
\bra
\ban
\bns
\bs and c
\bca
\bas
\bse
\be
1545 - settings). Variable templating is accomplished by including
1546 - the sequences `$1', `$2', ..., `$9' in _
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn. Use `\' to
1547 - prevent this special treatment of the `$' character. All
1548 - other characters are treated literally, and are used to de-
1549 - termine the n
\bnm
\bma
\bap
\bp [_
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn] variable values. For example,
1550 - given _
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn $1.$2 and the remote file name "mydata.data",
1551 - $1 would have the value "mydata", and $2 would have the value
1552 - "data". The _
\bo_
\bu_
\bt_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn determines the resulting mapped file-
1553 - name. The sequences `$1', `$2', ...., `$9' are replaced by
1554 - any value resulting from the _
\bi_
\bn_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn template. The se-
1555 - quence `$0' is replace by the original filename. Additional-
1556 - ly, the sequence `[_
\bs_
\be_
\bq_
\b1, _
\bs_
\be_
\bq_
\b2]' is replaced by [_
\bs_
\be_
\bq_
\b1] if _
\bs_
\be_
\bq_
\b1
1557 - is not a null string; otherwise it is replaced by _
\bs_
\be_
\bq_
\b2. For
1558 - example, the command
1560 - nmap $1.$2.$3 [$1,$2].[$2,file]
1562 - would yield the output filename "myfile.data" for input file-
1563 - names "myfile.data" and "myfile.data.old", "myfile.file" for
1564 - the input filename "myfile", and "myfile.myfile" for the in-
1565 - put filename ".myfile". Spaces may be included in
1566 - _
\bo_
\bu_
\bt_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn, as in the example: `nmap $1 sed "s/ *$//" > $1'
1567 - . Use the `\' character to prevent special treatment of the
1568 - `$','[',']', and `,' characters.
1570 - n
\bnt
\btr
\bra
\ban
\bns
\bs [_
\bi_
\bn_
\bc_
\bh_
\ba_
\br_
\bs [_
\bo_
\bu_
\bt_
\bc_
\bh_
\ba_
\br_
\bs]]
1571 - Set or unset the filename character translation mechanism.
1572 - If no arguments are specified, the filename character trans-
1573 - lation mechanism is unset. If arguments are specified, char-
1574 - acters in remote filenames are translated during m
\bmp
\bpu
\but
\bt com-
1575 - mands and p
\bpu
\but
\bt commands issued without a specified remote tar-
1576 - get filename. If arguments are specified, characters in lo-
1577 - cal filenames are translated during m
\bmg
\bge
\bet
\bt commands and g
\bge
\bet
\bt
1578 - commands issued without a specified local target filename.
1579 - This command is useful when connecting to a non-UNIX remote
1580 - computer with different file naming conventions or practices.
1581 - Characters in a filename matching a character in _
\bi_
\bn_
\bc_
\bh_
\ba_
\br_
\bs are
1582 - replaced with the corresponding character in _
\bo_
\bu_
\bt_
\bc_
\bh_
\ba_
\br_
\bs. If
1583 - the character's position in _
\bi_
\bn_
\bc_
\bh_
\ba_
\br_
\bs is longer than the length
1584 - of _
\bo_
\bu_
\bt_
\bc_
\bh_
\ba_
\br_
\bs, the character is deleted from the file name.
1586 - o
\bop
\bpe
\ben
\bn _
\bh_
\bo_
\bs_
\bt [_
\bp_
\bo_
\br_
\bt]
1587 - Establish a connection to the specified _
\bh_
\bo_
\bs_
\bt FTP server. An
1588 - optional port number may be supplied, in which case, f
\bft
\btp
\bp will
1589 - attempt to contact an FTP server at that port. If the a
\bau
\but
\bto
\bo-
\b-
1590 - l
\blo
\bog
\bgi
\bin
\bn option is on (default), f
\bft
\btp
\bp will also attempt to auto-
1591 - matically log the user in to the FTP server (see below).
1593 - p
\bpa
\bag
\bge
\be _
\bf_
\bi_
\bl_
\be Retrieve f
\bfi
\bil
\ble
\be and display with the program specified by the
1594 - s
\bse
\bet
\bt p
\bpa
\bag
\bge
\ber
\br option.
1596 - p
\bpa
\bas
\bss
\bsi
\biv
\bve
\be [a
\bau
\but
\bto
\bo]
1597 - Toggle passive mode (if no arguments are given). If a
\bau
\but
\bto
\bo is
1598 - given, act as if FTPMODE is set to `auto'. If passive mode
1599 - is turned on (default), f
\bft
\btp
\bp will send a PASV command for all
1600 - data connections instead of a PORT command. The PASV command
1601 - requests that the remote server open a port for the data con-
1602 - nection and return the address of that port. The remote
1603 - server listens on that port and the client connects to it.
1604 - When using the more traditional PORT command, the client lis-
1605 - tens on a port and sends that address to the remote server,
1606 - who connects back to it. Passive mode is useful when using
1607 - f
\bft
\btp
\bp through a gateway router or host that controls the direc-
1608 - tionality of traffic. (Note that though FTP servers are re-
1609 - quired to support the PASV command by RFC 1123, some do not.)
1611 - p
\bpd
\bdi
\bir
\br [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh]
1612 - Perform d
\bdi
\bir
\br [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh], and display the result with the
1613 - program specified by the s
\bse
\bet
\bt p
\bpa
\bag
\bge
\ber
\br option.
1615 - p
\bpl
\bls
\bs [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh]
1616 - Perform l
\bls
\bs [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh], and display the result with the
1617 - program specified by the s
\bse
\bet
\bt p
\bpa
\bag
\bge
\ber
\br option.
1619 - p
\bpm
\bml
\bls
\bsd
\bd [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh]
1620 - Perform m
\bml
\bls
\bsd
\bd [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bp_
\ba_
\bt_
\bh], and display the result with the
1621 - program specified by the s
\bse
\bet
\bt p
\bpa
\bag
\bge
\ber
\br option.
1623 - p
\bpr
\bre
\bes
\bse
\ber
\brv
\bve
\be Toggle preservation of modification times on retrieved files.
1625 - p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs Toggle display of transfer progress bar. The progress bar
1626 - will be disabled for a transfer that has _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be as `-
\b-' or
1627 - a command that starts with `|'. Refer to _
\bF_
\bI_
\bL_
\bE _
\bN_
\bA_
\bM_
\bI_
\bN_
\bG
1628 - _
\bC_
\bO_
\bN_
\bV_
\bE_
\bN_
\bT_
\bI_
\bO_
\bN_
\bS for more information. Enabling p
\bpr
\bro
\bog
\bgr
\bre
\bes
\bss
\bs disables
1631 - p
\bpr
\bro
\bom
\bmp
\bpt
\bt Toggle interactive prompting. Interactive prompting occurs
1632 - during multiple file transfers to allow the user to selec-
1633 - tively retrieve or store files. If prompting is turned off
1634 - (default is on), any m
\bmg
\bge
\bet
\bt or m
\bmp
\bpu
\but
\bt will transfer all files,
1635 - and any m
\bmd
\bde
\bel
\ble
\bet
\bte
\be will delete all files.
1637 - When prompting is on, the following commands are available at
1640 - a
\ba Answer `yes' to the current file, and automatically
1641 - answer `yes' to any remaining files for the current
1644 - n
\bn Answer `no', and do not transfer the file.
1646 - p
\bp Answer `yes' to the current file, and turn off
1647 - prompt mode (as is ``prompt off'' had been given).
1649 - q
\bq Terminate the current operation.
1651 - y
\by Answer `yes', and transfer the file.
1653 - ?
\b? Display a help message.
1655 - Any other reponse will answer `yes' to the current file.
1657 - p
\bpr
\bro
\box
\bxy
\by _
\bf_
\bt_
\bp_
\b-_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd
1658 - Execute an ftp command on a secondary control connection.
1659 - This command allows simultaneous connection to two remote FTP
1660 - servers for transferring files between the two servers. The
1661 - first p
\bpr
\bro
\box
\bxy
\by command should be an o
\bop
\bpe
\ben
\bn, to establish the sec-
1662 - ondary control connection. Enter the command "proxy ?" to
1663 - see other FTP commands executable on the secondary connec-
1664 - tion. The following commands behave differently when pref-
1665 - aced by p
\bpr
\bro
\box
\bxy
\by: o
\bop
\bpe
\ben
\bn will not define new macros during the au-
1666 - to-login process, c
\bcl
\blo
\bos
\bse
\be will not erase existing macro defini-
1667 - tions, g
\bge
\bet
\bt and m
\bmg
\bge
\bet
\bt transfer files from the host on the pri-
1668 - mary control connection to the host on the secondary control
1669 - connection, and p
\bpu
\but
\bt, m
\bmp
\bpu
\but
\bt, and a
\bap
\bpp
\bpe
\ben
\bnd
\bd transfer files from the
1670 - host on the secondary control connection to the host on the
1671 - primary control connection. Third party file transfers de-
1672 - pend upon support of the FTP protocol PASV command by the
1673 - server on the secondary control connection.
1675 - p
\bpu
\but
\bt _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be]
1676 - Store a local file on the remote machine. If _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be is
1677 - left unspecified, the local file name is used after process-
1678 - ing according to any n
\bnt
\btr
\bra
\ban
\bns
\bs or n
\bnm
\bma
\bap
\bp settings in naming the
1679 - remote file. File transfer uses the current settings for
1680 - t
\bty
\byp
\bpe
\be, f
\bfo
\bor
\brm
\bma
\bat
\bt, m
\bmo
\bod
\bde
\be, and s
\bst
\btr
\bru
\buc
\bct
\btu
\bur
\bre
\be.
1682 - p
\bpw
\bwd
\bd Print the name of the current working directory on the remote
1685 - q
\bqu
\bui
\bit
\bt A synonym for b
\bby
\bye
\be.
1687 - q
\bqu
\buo
\bot
\bte
\be _
\ba_
\br_
\bg_
\b1 _
\ba_
\br_
\bg_
\b2 _
\b._
\b._
\b.
1688 - The arguments specified are sent, verbatim, to the remote FTP
1691 - r
\bra
\bat
\bte
\be _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bi_
\bo_
\bn [_
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm [_
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt]]
1692 - Throttle the maximum transfer rate to _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm bytes/second.
1693 - If _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm is 0, disable the throttle.
1695 - _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bi_
\bo_
\bn may be one of:
1696 - a
\bal
\bll
\bl Both directions.
1697 - g
\bge
\bet
\bt Incoming transfers.
1698 - p
\bpu
\but
\bt Outgoing transfers.
1700 - _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm can by modified on the fly by _
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt bytes (de-
1701 - fault: 1024) each time a given signal is received:
1703 - SIGUSR1 Increment _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm by _
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt bytes.
1705 - SIGUSR2 Decrement _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm by _
\bi_
\bn_
\bc_
\br_
\be_
\bm_
\be_
\bn_
\bt bytes. The re-
1706 - sult must be a positive number.
1708 - If _
\bm_
\ba_
\bx_
\bi_
\bm_
\bu_
\bm is not supplied, the current throttle rates are
1711 - Note: r
\bra
\bat
\bte
\be is not yet implemented for ascii mode transfers.
1713 - r
\brc
\bcv
\bvb
\bbu
\buf
\bf _
\bs_
\bi_
\bz_
\be
1714 - Set the size of the socket receive buffer to _
\bs_
\bi_
\bz_
\be.
1716 - r
\bre
\bec
\bcv
\bv _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]
1717 - A synonym for g
\bge
\bet
\bt.
1719 - r
\bre
\beg
\bge
\bet
\bt _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be [_
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be]
1720 - r
\bre
\beg
\bge
\bet
\bt acts like g
\bge
\bet
\bt, except that if _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be exists and is
1721 - smaller than _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be, _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be is presumed to be a par-
1722 - tially transferred copy of _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be and the transfer is
1723 - continued from the apparent point of failure. This command
1724 - is useful when transferring very large files over networks
1725 - that are prone to dropping connections.
1727 - r
\bre
\bem
\bmo
\bop
\bpt
\bts
\bs _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd [_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd_
\b-_
\bo_
\bp_
\bt_
\bi_
\bo_
\bn_
\bs]
1728 - Set options on the remote FTP server for _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd to _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd_
\b-
1729 - _
\bo_
\bp_
\bt_
\bi_
\bo_
\bn_
\bs (whose absence is handled on a command-specific ba-
1730 - sis). Remote FTP commands known to support options include:
1731 - `MLST' (used for MLSD and MLST).
1733 - r
\bre
\ben
\bna
\bam
\bme
\be [_
\bf_
\br_
\bo_
\bm [_
\bt_
\bo]]
1734 - Rename the file _
\bf_
\br_
\bo_
\bm on the remote machine, to the file _
\bt_
\bo.
1736 - r
\bre
\bes
\bse
\bet
\bt Clear reply queue. This command re-synchronizes command/re-
1737 - ply sequencing with the remote FTP server. Resynchronization
1738 - may be necessary following a violation of the FTP protocol by
1739 - the remote server.
1741 - r
\bre
\bes
\bst
\bta
\bar
\brt
\bt _
\bm_
\ba_
\br_
\bk_
\be_
\br
1742 - Restart the immediately following g
\bge
\bet
\bt or p
\bpu
\but
\bt at the indicated
1743 - _
\bm_
\ba_
\br_
\bk_
\be_
\br. On UNIX systems, marker is usually a byte offset in-
1746 - r
\brh
\bhe
\bel
\blp
\bp [_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd_
\b-_
\bn_
\ba_
\bm_
\be]
1747 - Request help from the remote FTP server. If a _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd_
\b-_
\bn_
\ba_
\bm_
\be
1748 - is specified it is supplied to the server as well.
1750 - r
\brm
\bmd
\bdi
\bir
\br _
\bd_
\bi_
\br_
\be_
\bc_
\bt_
\bo_
\br_
\by_
\b-_
\bn_
\ba_
\bm_
\be
1751 - Delete a directory on the remote machine.
1753 - r
\brs
\bst
\bta
\bat
\btu
\bus
\bs [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be]
1754 - With no arguments, show status of remote machine. If _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-
1755 - _
\bf_
\bi_
\bl_
\be is specified, show status of _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be on remote ma-
1758 - r
\bru
\bun
\bni
\biq
\bqu
\bue
\be Toggle storing of files on the local system with unique file-
1759 - names. If a file already exists with a name equal to the
1760 - target local filename for a g
\bge
\bet
\bt or m
\bmg
\bge
\bet
\bt command, a ".1" is
1761 - appended to the name. If the resulting name matches another
1762 - existing file, a ".2" is appended to the original name. If
1763 - this process continues up to ".99", an error message is
1764 - printed, and the transfer does not take place. The generated
1765 - unique filename will be reported. Note that r
\bru
\bun
\bni
\biq
\bqu
\bue
\be will not
1766 - affect local files generated from a shell command (see be-
1767 - low). The default value is off.
1769 - s
\bse
\ben
\bnd
\bd _
\bl_
\bo_
\bc_
\ba_
\bl_
\b-_
\bf_
\bi_
\bl_
\be [_
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be]
1770 - A synonym for p
\bpu
\but
\bt.
1772 - s
\bse
\ben
\bnd
\bdp
\bpo
\bor
\brt
\bt Toggle the use of PORT commands. By default, f
\bft
\btp
\bp will at-
1773 - tempt to use a PORT command when establishing a connection
1774 - for each data transfer. The use of PORT commands can prevent
1775 - delays when performing multiple file transfers. If the PORT
1776 - command fails, f
\bft
\btp
\bp will use the default data port. When the
1777 - use of PORT commands is disabled, no attempt will be made to
1778 - use PORT commands for each data transfer. This is useful for
1779 - certain FTP implementations which do ignore PORT commands
1780 - but, incorrectly, indicate they've been accepted.
1782 - s
\bse
\bet
\bt [_
\bo_
\bp_
\bt_
\bi_
\bo_
\bn _
\bv_
\ba_
\bl_
\bu_
\be]
1783 - Set _
\bo_
\bp_
\bt_
\bi_
\bo_
\bn to _
\bv_
\ba_
\bl_
\bu_
\be. If _
\bo_
\bp_
\bt_
\bi_
\bo_
\bn and _
\bv_
\ba_
\bl_
\bu_
\be are not given, dis-
1784 - play all of the options and their values. The currently sup-
1785 - ported options are:
1787 - anonpass Defaults to $FTPANONPASS
1789 - ftp_proxy Defaults to $ftp_proxy.
1791 - http_proxy Defaults to $http_proxy.
1793 - no_proxy Defaults to $no_proxy.
1795 - pager Defaults to $PAGER.
1797 - prompt Defaults to $FTPPROMPT.
1799 - rprompt Defaults to $FTPRPROMPT.
1801 - s
\bsi
\bit
\bte
\be _
\ba_
\br_
\bg_
\b1 _
\ba_
\br_
\bg_
\b2 _
\b._
\b._
\b.
1802 - The arguments specified are sent, verbatim, to the remote FTP
1803 - server as a SITE command.
1805 - s
\bsi
\biz
\bze
\be _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be
1806 - Return size of _
\br_
\be_
\bm_
\bo_
\bt_
\be_
\b-_
\bf_
\bi_
\bl_
\be on remote machine.
1808 - s
\bsn
\bnd
\bdb
\bbu
\buf
\bf _
\bs_
\bi_
\bz_
\be
1809 - Set the size of the socket send buffer to _
\bs_
\bi_
\bz_
\be.
1811 - s
\bst
\bta
\bat
\btu
\bus
\bs Show the current status of f
\bft
\btp
\bp.
1813 - s
\bst
\btr
\bru
\buc
\bct
\bt _
\bs_
\bt_
\br_
\bu_
\bc_
\bt_
\b-_
\bn_
\ba_
\bm_
\be
1814 - Set the file transfer _
\bs_
\bt_
\br_
\bu_
\bc_
\bt_
\bu_
\br_
\be to _
\bs_
\bt_
\br_
\bu_
\bc_
\bt_
\b-_
\bn_
\ba_
\bm_
\be. The default
1815 - (and only supported) structure is ``file''.
1817 - s
\bsu
\bun
\bni
\biq
\bqu
\bue
\be Toggle storing of files on remote machine under unique file
1818 - names. The remote FTP server must support FTP protocol STOU
1819 - command for successful completion. The remote server will
1820 - report unique name. Default value is off.
1822 - s
\bsy
\bys
\bst
\bte
\bem
\bm Show the type of operating system running on the remote ma-
1825 - t
\bte
\ben
\bne
\bex
\bx Set the file transfer type to that needed to talk to TENEX
1828 - t
\bth
\bhr
\bro
\bot
\btt
\btl
\ble
\be A synonym for r
\bra
\bat
\bte
\be.
1830 - t
\btr
\bra
\bac
\bce
\be Toggle packet tracing.
1832 - t
\bty
\byp
\bpe
\be [_
\bt_
\by_
\bp_
\be_
\b-_
\bn_
\ba_
\bm_
\be]
1833 - Set the file transfer t
\bty
\byp
\bpe
\be to _
\bt_
\by_
\bp_
\be_
\b-_
\bn_
\ba_
\bm_
\be. If no type is spec-
1834 - ified, the current type is printed. The default type is net-
1837 - u
\bum
\bma
\bas
\bsk
\bk [_
\bn_
\be_
\bw_
\bm_
\ba_
\bs_
\bk]
1838 - Set the default umask on the remote server to _
\bn_
\be_
\bw_
\bm_
\ba_
\bs_
\bk. If
1839 - _
\bn_
\be_
\bw_
\bm_
\ba_
\bs_
\bk is omitted, the current umask is printed.
1841 - u
\bun
\bns
\bse
\bet
\bt _
\bo_
\bp_
\bt_
\bi_
\bo_
\bn
1842 - Unset _
\bo_
\bp_
\bt_
\bi_
\bo_
\bn. Refer to s
\bse
\bet
\bt for more information.
1844 - u
\bus
\bsa
\bag
\bge
\be _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd
1845 - Print the usage message for _
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd.
1847 - u
\bus
\bse
\ber
\br _
\bu_
\bs_
\be_
\br_
\b-_
\bn_
\ba_
\bm_
\be [_
\bp_
\ba_
\bs_
\bs_
\bw_
\bo_
\br_
\bd [_
\ba_
\bc_
\bc_
\bo_
\bu_
\bn_
\bt]]
1848 - Identify yourself to the remote FTP server. If the _
\bp_
\ba_
\bs_
\bs_
\bw_
\bo_
\br_
\bd
1849 - is not specified and the server requires it, f
\bft
\btp
\bp will prompt
1850 - the user for it (after disabling local echo). If an _
\ba_
\bc_
\bc_
\bo_
\bu_
\bn_
\bt
1851 - field is not specified, and the FTP server requires it, the
1852 - user will be prompted for it. If an _
\ba_
\bc_
\bc_
\bo_
\bu_
\bn_
\bt field is speci-
1853 - fied, an account command will be relayed to the remote server
1854 - after the login sequence is completed if the remote server
1855 - did not require it for logging in. Unless f
\bft
\btp
\bp is invoked
1856 - with ``auto-login'' disabled, this process is done automati-
1857 - cally on initial connection to the FTP server.
1859 - v
\bve
\ber
\brb
\bbo
\bos
\bse
\be Toggle verbose mode. In verbose mode, all responses from the
1860 - FTP server are displayed to the user. In addition, if ver-
1861 - bose is on, when a file transfer completes, statistics re-
1862 - garding the efficiency of the transfer are reported. By de-
1863 - fault, verbose is on.
1865 - x
\bxf
\bfe
\ber
\brb
\bbu
\buf
\bf _
\bs_
\bi_
\bz_
\be
1866 - Set the size of the socket send and receive buffers to _
\bs_
\bi_
\bz_
\be.
1868 - ?
\b? [_
\bc_
\bo_
\bm_
\bm_
\ba_
\bn_
\bd]
1869 - A synonym for h
\bhe
\bel
\blp
\bp.
1871 - Command arguments which have embedded spaces may be quoted with quote `"'
1874 - Commands which toggle settings can take an explicit o
\bon
\bn or o
\bof
\bff
\bf argument to
1875 - force the setting appropriately.
1877 - Commands which take a byte count as an argument (e.g., h
\bha
\bas
\bsh
\bh, r
\bra
\bat
\bte
\be, and
1878 - x
\bxf
\bfe
\ber
\brb
\bbu
\buf
\bf) support an optional suffix on the argument which changes the in-
1879 - terpretation of the argument. Supported suffixes are:
1880 - b Causes no modification. (Optional)
1881 - k Kilo; multiply the argument by 1024
1882 - m Mega; multiply the argument by 1048576
1883 - g Giga; multiply the argument by 1073741824
1885 - If f
\bft
\btp
\bp receives a SIGINFO (see the ``status'' argument of stty(1)) or
1886 - SIGQUIT signal whilst a transfer is in progress, the current transfer
1887 - rate statistics will be written to the standard error output, in the same
1888 - format as the standard completion message.
1890 -A
\bAU
\bUT
\bTO
\bO-
\b-F
\bFE
\bET
\bTC
\bCH
\bHI
\bIN
\bNG
\bG F
\bFI
\bIL
\bLE
\bES
\bS
1891 - In addition to standard commands, this version of f
\bft
\btp
\bp supports an auto-
1892 - fetch feature. To enable auto-fetch, simply pass the list of host-
1893 - names/files on the command line.
1895 - The following formats are valid syntax for an auto-fetch element:
1897 - [user@]host:[path][/]
1898 - ``Classic'' FTP format.
1900 - If _
\bp_
\ba_
\bt_
\bh contains a glob character and globbing is enabled, (see
1901 - g
\bgl
\blo
\bob
\bb), then the equivalent of `mget path' is performed.
1903 - If the directory component of _
\bp_
\ba_
\bt_
\bh contains no globbing characters,
1904 - it is stored locally with the name basename (see basename(1)) of
1905 - p
\bpa
\bat
\bth
\bh, in the current directory. Otherwise, the full remote name is
1906 - used as the local name, relative to the local root directory.
1908 - ftp://[user[:password]@]host[:port]/path[/][;type=X]
1909 - An FTP URL, retrieved using the FTP protocol if s
\bse
\bet
\bt f
\bft
\btp
\bp_
\b_p
\bpr
\bro
\box
\bxy
\by isn't
1910 - defined. Otherwise, transfer the URL using HTTP via the proxy de-
1911 - fined in s
\bse
\bet
\bt f
\bft
\btp
\bp_
\b_p
\bpr
\bro
\box
\bxy
\by. If s
\bse
\bet
\bt f
\bft
\btp
\bp_
\b_p
\bpr
\bro
\box
\bxy
\by isn't defined and _
\bu_
\bs_
\be_
\br is
1912 - given, login as _
\bu_
\bs_
\be_
\br. In this case, use _
\bp_
\ba_
\bs_
\bs_
\bw_
\bo_
\br_
\bd if supplied, oth-
1913 - erwise prompt the user for one.
1915 - In order to be compliant with R
\bRF
\bFC
\bC 1
\b17
\b73
\b38
\b8, f
\bft
\btp
\bp strips the leading `/'
1916 - from _
\bp_
\ba_
\bt_
\bh, resulting in a transfer relative from the default login
1917 - directory of the user. If the _
\b/ directory is required, use a lead-
1918 - ing path of ``%2F''. If a user's home directory is required (and
1919 - the remote server supports the syntax), use a leading path of
1920 - ``%7Euser/''. For example, to retrieve _
\b/_
\be_
\bt_
\bc_
\b/_
\bm_
\bo_
\bt_
\bd from `localhost'
1921 - as the user `myname' with the password `mypass', use
1922 - ``ftp://myname:mypass@localhost/%2fetc/motd''
1924 - If a suffix of `;type=A' or `;type=I' is supplied, then the trans-
1925 - fer type will take place as ascii or binary (respectively). The
1926 - default transfer type is binary.
1928 - http://[user[:password]@]host[:port]/path
1929 - An HTTP URL, retrieved using the HTTP protocol. If s
\bse
\bet
\bt h
\bht
\btt
\btp
\bp_
\b_p
\bpr
\bro
\box
\bxy
\by
1930 - is defined, it is used as a URL to an HTTP proxy server. If HTTP
1931 - authorisation is required to retrieve _
\bp_
\ba_
\bt_
\bh, and `user' (and option-
1932 - ally `password') is in the URL, use them for the first attempt to
1936 - A local URL, copied from _
\b/_
\bp_
\ba_
\bt_
\bh.
1938 - Unless noted otherwise above, and -
\b-o
\bo _
\bo_
\bu_
\bt_
\bp_
\bu_
\bt is not given, the file is
1939 - stored in the current directory as the basename(1) of _
\bp_
\ba_
\bt_
\bh.
1941 - If a classic format or an FTP URL format has a trailing `/' or an empty
1942 - _
\bp_
\ba_
\bt_
\bh component, then f
\bft
\btp
\bp will connect to the site and c
\bcd
\bd to the directory
1943 - given as the path, and leave the user in interactive mode ready for fur-
1944 - ther input. This will not work if s
\bse
\bet
\bt f
\bft
\btp
\bp_
\b_p
\bpr
\bro
\box
\bxy
\by is being used.
1946 - Direct HTTP transfers use HTTP 1.1. Proxied FTP and HTTP transfers use
1949 - If -
\b-R
\bR is given, all auto-fetches that don't go via the FTP or HTTP prox-
1950 - ies will be restarted. For FTP, this is implemented by using r
\bre
\beg
\bge
\bet
\bt in-
1951 - stead of g
\bge
\bet
\bt. For HTTP, this is implemented by using the `Range: bytes='
1952 - HTTP/1.1 directive.
1954 - If WWW or proxy WWW authentication is required, you will be prompted to
1955 - enter a username and password to authenticate with.
1957 - When specifying IPv6 numeric addresses in a URL, you need to surround the
1958 - address in square brackets. E.g.: ``ftp://[::1]:21/''. This is because
1959 - colons are used in IPv6 numeric address as well as being the separator
1960 - for the port number.
1962 -A
\bAB
\bBO
\bOR
\bRT
\bTI
\bIN
\bNG
\bG A
\bA F
\bFI
\bIL
\bLE
\bE T
\bTR
\bRA
\bAN
\bNS
\bSF
\bFE
\bER
\bR
1963 - To abort a file transfer, use the terminal interrupt key (usually Ctrl-
1964 - C). Sending transfers will be immediately halted. Receiving transfers
1965 - will be halted by sending an FTP protocol ABOR command to the remote
1966 - server, and discarding any further data received. The speed at which
1967 - this is accomplished depends upon the remote server's support for ABOR
1968 - processing. If the remote server does not support the ABOR command, the
1969 - prompt will not appear until the remote server has completed sending the
1972 - If the terminal interrupt key sequence is used whilst f
\bft
\btp
\bp is awaiting a
1973 - reply from the remote server for the ABOR processing, then the connection
1974 - will be closed. This is different from the traditional behaviour (which
1975 - ignores the terminal interrupt during this phase), but is considered more
1978 -F
\bFI
\bIL
\bLE
\bE N
\bNA
\bAM
\bMI
\bIN
\bNG
\bG C
\bCO
\bON
\bNV
\bVE
\bEN
\bNT
\bTI
\bIO
\bON
\bNS
\bS
1979 - Files specified as arguments to f
\bft
\btp
\bp commands are processed according to
1980 - the following rules.
1982 - 1. If the file name `-
\b-' is specified, the _
\bs_
\bt_
\bd_
\bi_
\bn (for reading) or _
\bs_
\bt_
\bd_
\bo_
\bu_
\bt
1983 - (for writing) is used.
1985 - 2. If the first character of the file name is `|', the remainder of the
1986 - argument is interpreted as a shell command. f
\bft
\btp
\bp then forks a shell,
1987 - using popen(3) with the argument supplied, and reads (writes) from
1988 - the stdout (stdin). If the shell command includes spaces, the argu-
1989 - ment must be quoted; e.g. ``"| ls -lt"''. A particularly useful
1990 - example of this mechanism is: ``dir "" |more''.
1992 - 3. Failing the above checks, if ``globbing'' is enabled, local file
1993 - names are expanded according to the rules used in the csh(1); c.f.
1994 - the g
\bgl
\blo
\bob
\bb command. If the f
\bft
\btp
\bp command expects a single local file
1995 - (e.g. p
\bpu
\but
\bt), only the first filename generated by the "globbing" op-
1998 - 4. For m
\bmg
\bge
\bet
\bt commands and g
\bge
\bet
\bt commands with unspecified local file
1999 - names, the local filename is the remote filename, which may be al-
2000 - tered by a c
\bca
\bas
\bse
\be, n
\bnt
\btr
\bra
\ban
\bns
\bs, or n
\bnm
\bma
\bap
\bp setting. The resulting filename
2001 - may then be altered if r
\bru
\bun
\bni
\biq
\bqu
\bue
\be is on.
2003 - 5. For m
\bmp
\bpu
\but
\bt commands and p
\bpu
\but
\bt commands with unspecified remote file
2004 - names, the remote filename is the local filename, which may be al-
2005 - tered by a n
\bnt
\btr
\bra
\ban
\bns
\bs or n
\bnm
\bma
\bap
\bp setting. The resulting filename may then
2006 - be altered by the remote server if s
\bsu
\bun
\bni
\biq
\bqu
\bue
\be is on.
2008 -F
\bFI
\bIL
\bLE
\bE T
\bTR
\bRA
\bAN
\bNS
\bSF
\bFE
\bER
\bR P
\bPA
\bAR
\bRA
\bAM
\bME
\bET
\bTE
\bER
\bRS
\bS
2009 - The FTP specification specifies many parameters which may affect a file
2010 - transfer. The t
\bty
\byp
\bpe
\be may be one of ``ascii'', ``image'' (binary),
2011 - ``ebcdic'', and ``local byte size'' (for PDP-10's and PDP-20's mostly).
2012 - f
\bft
\btp
\bp supports the ascii and image types of file transfer, plus local byte
2013 - size 8 for t
\bte
\ben
\bne
\bex
\bx mode transfers.
2015 - f
\bft
\btp
\bp supports only the default values for the remaining file transfer pa-
2016 - rameters: m
\bmo
\bod
\bde
\be, f
\bfo
\bor
\brm
\bm, and s
\bst
\btr
\bru
\buc
\bct
\bt.
2018 -T
\bTH
\bHE
\bE .
\b.n
\bne
\bet
\btr
\brc
\bc F
\bFI
\bIL
\bLE
\bE
2019 - The _
\b._
\bn_
\be_
\bt_
\br_
\bc file contains login and initialization information used by the
2020 - auto-login process. It resides in the user's home directory, unless
2021 - overridden with the -
\b-N
\bN _
\bn_
\be_
\bt_
\br_
\bc option, or specified in the NETRC environ-
2022 - ment variable. The following tokens are recognized; they may be separat-
2023 - ed by spaces, tabs, or new-lines:
2025 - m
\bma
\bac
\bch
\bhi
\bin
\bne
\be _
\bn_
\ba_
\bm_
\be
2026 - Identify a remote machine _
\bn_
\ba_
\bm_
\be. The auto-login process search-
2027 - es the _
\b._
\bn_
\be_
\bt_
\br_
\bc file for a m
\bma
\bac
\bch
\bhi
\bin
\bne
\be token that matches the remote
2028 - machine specified on the f
\bft
\btp
\bp command line or as an o
\bop
\bpe
\ben
\bn command
2029 - argument. Once a match is made, the subsequent _
\b._
\bn_
\be_
\bt_
\br_
\bc tokens
2030 - are processed, stopping when the end of file is reached or an-
2031 - other m
\bma
\bac
\bch
\bhi
\bin
\bne
\be or a d
\bde
\bef
\bfa
\bau
\bul
\blt
\bt token is encountered.
2033 - d
\bde
\bef
\bfa
\bau
\bul
\blt
\bt This is the same as m
\bma
\bac
\bch
\bhi
\bin
\bne
\be _
\bn_
\ba_
\bm_
\be except that d
\bde
\bef
\bfa
\bau
\bul
\blt
\bt matches
2034 - any name. There can be only one d
\bde
\bef
\bfa
\bau
\bul
\blt
\bt token, and it must be
2035 - after all m
\bma
\bac
\bch
\bhi
\bin
\bne
\be tokens. This is normally used as:
2037 - default login anonymous password user@site
2039 - thereby giving the user an automatic anonymous FTP login to ma-
2040 - chines not specified in _
\b._
\bn_
\be_
\bt_
\br_
\bc. This can be overridden by us-
2041 - ing the -
\b-n
\bn flag to disable auto-login.
2043 - l
\blo
\bog
\bgi
\bin
\bn _
\bn_
\ba_
\bm_
\be
2044 - Identify a user on the remote machine. If this token is pre-
2045 - sent, the auto-login process will initiate a login using the
2046 - specified _
\bn_
\ba_
\bm_
\be.
2048 - p
\bpa
\bas
\bss
\bsw
\bwo
\bor
\brd
\bd _
\bs_
\bt_
\br_
\bi_
\bn_
\bg
2049 - Supply a password. If this token is present, the auto-login
2050 - process will supply the specified string if the remote server
2051 - requires a password as part of the login process. Note that if
2052 - this token is present in the _
\b._
\bn_
\be_
\bt_
\br_
\bc file for any user other
2053 - than _
\ba_
\bn_
\bo_
\bn_
\by_
\bm_
\bo_
\bu_
\bs, f
\bft
\btp
\bp will abort the auto-login process if the
2054 - _
\b._
\bn_
\be_
\bt_
\br_
\bc is readable by anyone besides the user.
2056 - a
\bac
\bcc
\bco
\bou
\bun
\bnt
\bt _
\bs_
\bt_
\br_
\bi_
\bn_
\bg
2057 - Supply an additional account password. If this token is pre-
2058 - sent, the auto-login process will supply the specified string
2059 - if the remote server requires an additional account password,
2060 - or the auto-login process will initiate an ACCT command if it
2063 - m
\bma
\bac
\bcd
\bde
\bef
\bf _
\bn_
\ba_
\bm_
\be
2064 - Define a macro. This token functions like the f
\bft
\btp
\bp m
\bma
\bac
\bcd
\bde
\bef
\bf com-
2065 - mand functions. A macro is defined with the specified name;
2066 - its contents begin with the next _
\b._
\bn_
\be_
\bt_
\br_
\bc line and continue until
2067 - a blank line (consecutive new-line characters) is encountered.
2068 - If a macro named i
\bin
\bni
\bit
\bt is defined, it is automatically executed
2069 - as the last step in the auto-login process.
2071 -C
\bCO
\bOM
\bMM
\bMA
\bAN
\bND
\bD L
\bLI
\bIN
\bNE
\bE E
\bED
\bDI
\bIT
\bTI
\bIN
\bNG
\bG
2072 - f
\bft
\btp
\bp supports interactive command line editing, via the editline(3) li-
2073 - brary. It is enabled with the e
\bed
\bdi
\bit
\bt command, and is enabled by default if
2074 - input is from a tty. Previous lines can be recalled and edited with the
2075 - arrow keys, and other GNU Emacs-style editing keys may be used as well.
2077 - The editline(3) library is configured with a _
\b._
\be_
\bd_
\bi_
\bt_
\br_
\bc file - refer to
2078 - editrc(5) for more information.
2080 - An extra key binding is available to f
\bft
\btp
\bp to provide context sensitive
2081 - command and filename completion (including remote file completion). To
2082 - use this, bind a key to the editline(3) command f
\bft
\btp
\bp-
\b-c
\bco
\bom
\bmp
\bpl
\ble
\bet
\bte
\be. By de-
2083 - fault, this is bound to the TAB key.
2085 -C
\bCO
\bOM
\bMM
\bMA
\bAN
\bND
\bD L
\bLI
\bIN
\bNE
\bE P
\bPR
\bRO
\bOM
\bMP
\bPT
\bT
2086 - By default, f
\bft
\btp
\bp displays a command line prompt of ``ftp>'' to the user.
2087 - This can be changed with the s
\bse
\bet
\bt p
\bpr
\bro
\bom
\bmp
\bpt
\bt command.
2089 - A prompt can be displayed on the right side of the screen (after the com-
2090 - mand input) with the s
\bse
\bet
\bt r
\brp
\bpr
\bro
\bom
\bmp
\bpt
\bt command.
2092 - The following formatting sequences are replaced by the given information:
2094 - %/ The current remote working directory.
2096 - %c[[0]_
\bn], %.[[0]_
\bn]
2097 - The trailing component of the current remote working directo-
2098 - ry, or _
\bn trailing components if a digit _
\bn is given. If _
\bn be-
2099 - gins with `0', the number of skipped components precede the
2100 - trailing component(s) in the format ``/_
\b<_
\bs_
\bk_
\bi_
\bp_
\bp_
\be_
\bd_
\b>trailing''
2101 - (for `%c') or ``...trailing'' (for `%.').
2103 - %M The remote host name.
2105 - %m The remote host name, up to the first `.'.
2107 - %n The remote user name.
2111 -E
\bEN
\bNV
\bVI
\bIR
\bRO
\bON
\bNM
\bME
\bEN
\bNT
\bT
2112 - f
\bft
\btp
\bp uses the following environment variables.
2114 - FTPANONPASS Password to send in an anonymous FTP transfer. Defaults
2117 - FTPMODE Overrides the default operation mode. Support values are:
2119 - active active mode FTP only
2121 - auto automatic determination of passive or active
2122 - (this is the default)
2124 - gate gate-ftp mode
2126 - passive passive mode FTP only
2128 - FTPPROMPT Command-line prompt to use. Defaults to ``ftp>''. Refer
2129 - to _
\bC_
\bO_
\bM_
\bM_
\bA_
\bN_
\bD _
\bL_
\bI_
\bN_
\bE _
\bP_
\bR_
\bO_
\bM_
\bP_
\bT for more information.
2131 - FTPRPROMPT Command-line right side prompt to use. Defaults to ``''.
2132 - Refer to _
\bC_
\bO_
\bM_
\bM_
\bA_
\bN_
\bD _
\bL_
\bI_
\bN_
\bE _
\bP_
\bR_
\bO_
\bM_
\bP_
\bT for more information.
2134 - FTPSERVER Host to use as gate-ftp server when g
\bga
\bat
\bte
\be is enabled.
2136 - FTPSERVERPORT Port to use when connecting to gate-ftp server when g
\bga
\bat
\bte
\be
2137 - is enabled. Default is port returned by a g
\bge
\bet
\bts
\bse
\ber
\brv
\bvb
\bby
\byn
\bna
\bam
\bme
\be()
2138 - lookup of ``ftpgate/tcp''.
2140 - HOME For default location of a _
\b._
\bn_
\be_
\bt_
\br_
\bc file, if one exists.
2142 - NETRC An alternate location of the _
\b._
\bn_
\be_
\bt_
\br_
\bc file.
2144 - PAGER Used by various commands to display files. Defaults to
2145 - more(1) if empty or not set.
2147 - SHELL For default shell.
2149 - ftp_proxy URL of FTP proxy to use when making FTP URL requests (if
2150 - not defined, use the standard FTP protocol).
2152 - _
\bN_
\bO_
\bT_
\bE: this is not used for interactive sessions, only for
2153 - command-line fetches.
2155 - http_proxy URL of HTTP proxy to use when making HTTP URL requests.
2156 - If proxy authentication is required and there is a user-
2157 - name and password in this URL, they will automatically be
2158 - used in the first attempt to authenticate to the proxy.
2160 - Note that the use of a username and password in ftp_proxy
2161 - and http_proxy may be incompatible with other programs
2162 - that use it (such as lynx(1)).
2164 - _
\bN_
\bO_
\bT_
\bE: this is not used for interactive sessions, only for
2165 - command-line fetches.
2167 - no_proxy A space or comma separated list of hosts (or domains) for
2168 - which proxying is not to be used. Each entry may have an
2169 - optional trailing ":port", which restricts the matching to
2170 - connections to that port.
2172 -S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
2173 - getservbyname(3), editrc(5), services(5), ftpd(8)
2175 -S
\bST
\bTA
\bAN
\bND
\bDA
\bAR
\bRD
\bDS
\bS
2176 - f
\bft
\btp
\bp attempts to be compliant with R
\bRF
\bFC
\bC 9
\b95
\b59
\b9, R
\bRF
\bFC
\bC 1
\b11
\b12
\b23
\b3, R
\bRF
\bFC
\bC 1
\b17
\b73
\b38
\b8, R
\bRF
\bFC
\bC 2
\b20
\b06
\b68
\b8,
2177 - R
\bRF
\bFC
\bC 2
\b23
\b38
\b89
\b9, R
\bRF
\bFC
\bC 2
\b24
\b42
\b28
\b8, R
\bRF
\bFC
\bC 2
\b27
\b73
\b32
\b2, and d
\bdr
\bra
\baf
\bft
\bt-
\b-i
\bie
\bet
\btf
\bf-
\b-f
\bft
\btp
\bpe
\bex
\bxt
\bt-
\b-m
\bml
\bls
\bst
\bt-
\b-1
\b11
\b1.
2179 -H
\bHI
\bIS
\bST
\bTO
\bOR
\bRY
\bY
2180 - The f
\bft
\btp
\bp command appeared in 4.2BSD.
2182 - Various features such as command line editing, context sensitive command
2183 - and file completion, dynamic progress bar, automatic fetching of files
2184 - and URLs, modification time preservation, transfer rate throttling, con-
2185 - figurable command line prompt, and other enhancements over the standard
2186 - BSD f
\bft
\btp
\bp were implemented in NetBSD 1.3 and later releases by Luke Mewburn
2187 - <lukem@netbsd.org>.
2189 - IPv6 support was added by the WIDE/KAME project (but may not be present
2190 - in all non-NetBSD versions of this program, depending if the operating
2191 - system supports IPv6 in a similar manner to KAME).
2194 - Correct execution of many commands depends upon proper behavior by the
2197 - An error in the treatment of carriage returns in the 4.2BSD ascii-mode
2198 - transfer code has been corrected. This correction may result in incor-
2199 - rect transfers of binary files to and from 4.2BSD servers using the ascii
2200 - type. Avoid this problem by using the binary image type.
2202 - f
\bft
\btp
\bp assumes that all IPv4 mapped addresses (IPv6 addresses with a form
2203 - like ::ffff:10.1.1.1) indicate IPv4 destinations which can be handled by
2204 - AF_INET sockets. However, in certain IPv6 network configurations, this
2205 - assumption is not true. In such an environment, IPv4 mapped addresses
2206 - must be passed to AF_INET6 sockets directly. For example, if your site
2207 - uses a SIIT translator for IPv6-to-IPv4 translation, f
\bft
\btp
\bp is unable to
2208 - support your configuration.
2210 -NetBSD 1.6_BETA1 May 18, 2002 16
2211 diff -Nru src/ftp_var.h /home/spock/ftp/ftp_var.h
2212 --- src/ftp_var.h Sat Jun 15 05:40:36 2002
2213 +++ /home/spock/ftp/ftp_var.h Thu Jun 12 02:02:11 2003
2215 -/* $NetBSD: ftp_var.h,v 1.62 2001/12/26 09:40:16 lukem Exp $ */
2216 +/* $NetBSD: ftp_var.h,v 1.64 2003/01/21 16:08:07 jhawk Exp $ */
2219 - * Copyright (c) 1996-2001 The NetBSD Foundation, Inc.
2220 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
2221 * All rights reserved.
2223 * This code is derived from software contributed to The NetBSD Foundation
2224 @@ -111,14 +111,20 @@
2228 +#include <sys/param.h>
2230 +#include <netinet/in.h>
2231 +#include <arpa/inet.h>
2233 +#include <setjmp.h>
2234 +#include <stringlist.h>
2236 #ifndef NO_EDITCOMPLETE
2237 #include <histedit.h>
2238 #endif /* !NO_EDITCOMPLETE */
2240 -typedef void (*sigfunc)(int);
2244 +#include "progressbar.h"
2247 * Format of command table.
2250 #define HASHBYTES 1024 /* default mark for `hash' command */
2251 #define DEFAULTINCR 1024 /* default increment for `rate' command */
2252 -#define STALLTIME 5 /* # of seconds of no xfer before "stalling" */
2254 #define FTP_PORT 21 /* default if ! getservbyname("ftp/tcp") */
2255 #define HTTP_PORT 80 /* default if ! getservbyname("http/tcp") */
2257 GLOBAL int hash; /* print # for each buffer transferred */
2258 GLOBAL int mark; /* number of bytes between hashes */
2259 GLOBAL int sendport; /* use PORT/LPRT cmd for each data connection */
2260 -GLOBAL int verbose; /* print messages coming back from server */
2261 GLOBAL int connected; /* 1 = connected to server, -1 = logged in */
2262 -GLOBAL int fromatty; /* input is from a terminal */
2263 GLOBAL int interactive; /* interactively prompt on m* cmds */
2264 GLOBAL int confirmrest; /* confirm rest of current m* cmd */
2265 GLOBAL int debug; /* debugging level */
2267 GLOBAL int ntflag; /* use ntin ntout tables for name translation */
2268 GLOBAL int mapflag; /* use mapin mapout templates on file names */
2269 GLOBAL int preserve; /* preserve modification time on files */
2270 -GLOBAL int progress; /* display transfer progress bar */
2271 GLOBAL int code; /* return/reply code for ftp command */
2272 GLOBAL int crflag; /* if 1, strip car. rets. on ascii gets */
2273 GLOBAL int passivemode; /* passive mode enabled */
2275 GLOBAL int rate_put; /* maximum put xfer rate */
2276 GLOBAL int rate_put_incr; /* increment for put xfer rate */
2277 GLOBAL int retry_connect; /* seconds between retrying connection */
2278 -GLOBAL int ttywidth; /* width of tty */
2279 GLOBAL char *tmpdir; /* temporary directory */
2280 -GLOBAL FILE *ttyout; /* stdout, or stderr if retrieving to stdout */
2281 GLOBAL int epsv4; /* use EPSV/EPRT on IPv4 connections */
2282 GLOBAL int epsv4bad; /* EPSV doesn't work on the current server */
2283 GLOBAL int editing; /* command line editing enabled */
2284 @@ -268,10 +268,7 @@
2285 GLOBAL size_t cursor_argo; /* offset of cursor in margv[cursor_argc] */
2286 #endif /* !NO_EDITCOMPLETE */
2288 -GLOBAL off_t bytes; /* current # of bytes read */
2289 -GLOBAL off_t filesize; /* size of file being transferred */
2290 GLOBAL char *direction; /* direction transfer is occurring */
2291 -GLOBAL off_t restart_point; /* offset to restart transfer */
2293 GLOBAL char *hostname; /* name of host connected to */
2294 GLOBAL int unix_server; /* server is unix, can use binary for ascii */
2296 GLOBAL char *outfile; /* filename to output URLs to */
2297 GLOBAL int restartautofetch; /* restart auto-fetch */
2299 -GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
2301 GLOBAL char line[FTPBUFLEN]; /* input line buffer */
2302 GLOBAL char *stringbase; /* current scan point in line buffer */
2303 GLOBAL char argbuf[FTPBUFLEN]; /* argument storage buffer */
2304 @@ -336,29 +331,7 @@
2309 -# define LLFP(x) "%" x "ld"
2311 -# define ULLF "%lu"
2312 -# define ULLFP(x) "%" x "lu"
2313 -# define ULLT unsigned long
2314 # define STRTOLL(x,y,z) strtol(x,y,z)
2318 -# define LLFP(x) "%" x "qd"
2319 -# define LLT long long
2320 -# define ULLF "%qu"
2321 -# define ULLFP(x) "%" x "qu"
2322 -# define ULLT unsigned long long
2323 -# define STRTOLL(x,y,z) strtoll(x,y,z)
2325 -# define LLF "%lld"
2326 -# define LLFP(x) "%" x "lld"
2327 -# define LLT long long
2328 -# define ULLF "%llu"
2329 -# define ULLFP(x) "%" x "llu"
2330 -# define ULLT unsigned long long
2331 # define STRTOLL(x,y,z) strtoll(x,y,z)
2334 diff -Nru src/main.c /home/spock/ftp/main.c
2335 --- src/main.c Sat Jun 15 05:40:36 2002
2336 +++ /home/spock/ftp/main.c Thu Jun 12 02:02:11 2003
2338 -/* $NetBSD: main.c,v 1.82 2002/06/05 13:51:54 lukem Exp $ */
2339 +/* $NetBSD: main.c,v 1.84 2003/05/14 14:31:00 wiz Exp $ */
2342 * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
2347 +#include <sys/cdefs.h>
2349 +__COPYRIGHT("@(#) Copyright (c) 1985, 1989, 1993, 1994\n\
2350 + The Regents of the University of California. All rights reserved.\n");
2351 +#endif /* not lint */
2355 +static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
2357 +__RCSID("$NetBSD: main.c,v 1.84 2003/05/14 14:31:00 wiz Exp $");
2359 +#endif /* not lint */
2362 * FTP User Program -- Command Interface.
2364 +#include <sys/types.h>
2365 +#include <sys/socket.h>
2367 -#include "lukemftp.h"
2374 +#include <stdlib.h>
2375 +#include <string.h>
2376 +#include <unistd.h>
2377 +#include <locale.h>
2379 #define GLOBAL /* force GLOBAL decls in ftp_var.h to be declared */
2380 #include "ftp_var.h"
2382 char *cp, *ep, *anonuser, *anonpass, *upload_path;
2383 int dumbterm, s, len, isupload;
2386 setlocale(LC_ALL, "");
2388 setprogname(argv[0]);
2395 - while ((ch = getopt(argc, argv, "46AadefginN:o:pP:r:RtT:u:vV")) != -1) {
2396 + while ((ch = getopt(argc, argv, "46AadefginN:o:pP:q:r:RtT:u:vV")) != -1) {
2400 @@ -330,6 +353,12 @@
2405 + quit_time = strtol(optarg, &ep, 10);
2406 + if (quit_time < 1 || *ep != '\0')
2407 + errx(1, "bad quit value: %s", optarg);
2411 retry_connect = strtol(optarg, &ep, 10);
2412 if (retry_connect < 1 || *ep != '\0')
2413 @@ -1003,6 +1032,6 @@
2414 " [-T dir,max[,inc][[user@]host [port]]] [host:path[/]]\n"
2415 " [file:///file] [ftp://[user[:pass]@]host[:port]/path[/]]\n"
2416 " [http://[user[:pass]@]host[:port]/path] [...]\n"
2417 -" %s -u url file [...]\n", progname, progname);
2418 +" %s -u URL file [...]\n", progname, progname);
2421 diff -Nru src/progressbar.c /home/spock/ftp/progressbar.c
2422 --- src/progressbar.c Wed Dec 31 19:00:00 1969
2423 +++ /home/spock/ftp/progressbar.c Thu Jun 12 02:02:11 2003
2425 +/* $NetBSD: progressbar.c,v 1.3 2003/02/28 09:53:49 lukem Exp $ */
2428 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
2429 + * All rights reserved.
2431 + * This code is derived from software contributed to The NetBSD Foundation
2432 + * by Luke Mewburn.
2434 + * This code is derived from software contributed to The NetBSD Foundation
2435 + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
2436 + * NASA Ames Research Center.
2438 + * Redistribution and use in source and binary forms, with or without
2439 + * modification, are permitted provided that the following conditions
2441 + * 1. Redistributions of source code must retain the above copyright
2442 + * notice, this list of conditions and the following disclaimer.
2443 + * 2. Redistributions in binary form must reproduce the above copyright
2444 + * notice, this list of conditions and the following disclaimer in the
2445 + * documentation and/or other materials provided with the distribution.
2446 + * 3. All advertising materials mentioning features or use of this software
2447 + * must display the following acknowledgement:
2448 + * This product includes software developed by the NetBSD
2449 + * Foundation, Inc. and its contributors.
2450 + * 4. Neither the name of The NetBSD Foundation nor the names of its
2451 + * contributors may be used to endorse or promote products derived
2452 + * from this software without specific prior written permission.
2454 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2455 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2456 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2457 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2458 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2459 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2460 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2461 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2462 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2463 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2464 + * POSSIBILITY OF SUCH DAMAGE.
2467 +#include <sys/cdefs.h>
2469 +__RCSID("$NetBSD: progressbar.c,v 1.3 2003/02/28 09:53:49 lukem Exp $");
2470 +#endif /* not lint */
2473 + * FTP User Program -- Misc support routines
2475 +#include <sys/types.h>
2476 +#include <sys/param.h>
2480 +#include <signal.h>
2482 +#include <stdlib.h>
2484 +#include <tzfile.h>
2485 +#include <unistd.h>
2487 +#include "progressbar.h"
2489 +#if !defined(NO_PROGRESS)
2491 + * return non-zero if we're the current foreground process
2494 +foregroundproc(void)
2496 + static pid_t pgrp = -1;
2501 + return (tcgetpgrp(fileno(ttyout)) == pgrp);
2503 +#endif /* !defined(NO_PROGRESS) */
2506 +#ifndef NO_PROGRESS
2507 +static void updateprogressmeter(int);
2510 + * SIGALRM handler to update the progress meter
2513 +updateprogressmeter(int dummy)
2515 + int oerrno = errno;
2520 +#endif /* NO_PROGRESS */
2524 + * List of order of magnitude prefixes.
2525 + * The last is `P', as 2^64 = 16384 Petabytes
2527 +static const char prefixes[] = " KMGTP";
2530 + * Display a transfer progress bar if progress is non-zero.
2531 + * SIGALRM is hijacked for use by this function.
2532 + * - Before the transfer, set filesize to size of file (or -1 if unknown),
2533 + * and call with flag = -1. This starts the once per second timer,
2534 + * and a call to updateprogressmeter() upon SIGALRM.
2535 + * - During the transfer, updateprogressmeter will call progressmeter
2537 + * - After the transfer, call with flag = 1
2539 +static struct timeval start;
2540 +static struct timeval lastupdate;
2542 +#define BUFLEFT (sizeof(buf) - len)
2545 +progressmeter(int flag)
2547 + static off_t lastsize;
2549 + struct timeval now, wait;
2550 +#ifndef NO_PROGRESS
2551 + struct timeval td;
2552 + off_t abbrevsize, bytespersec;
2554 + int ratio, barlength, i, len, remaining;
2557 + * Work variables for progress bar.
2559 + * XXX: if the format of the progress bar changes
2560 + * (especially the number of characters in the
2561 + * `static' portion of it), be sure to update
2562 + * these appropriately.
2564 + char buf[256]; /* workspace for progress bar */
2565 +#define BAROVERHEAD 43 /* non `*' portion of progress bar */
2567 + * stars should contain at least
2568 + * sizeof(buf) - BAROVERHEAD entries
2570 + static const char stars[] =
2571 +"*****************************************************************************"
2572 +"*****************************************************************************"
2573 +"*****************************************************************************";
2578 + (void)gettimeofday(&start, NULL);
2579 + lastupdate = start;
2580 + lastsize = restart_point;
2583 + (void)gettimeofday(&now, NULL);
2584 + cursize = bytes + restart_point;
2585 + timersub(&now, &lastupdate, &wait);
2586 + if (cursize > lastsize) {
2588 + lastsize = cursize;
2591 +#ifndef STANDALONE_PROGRESS
2592 + if (quit_time > 0 && wait.tv_sec > quit_time) {
2593 + len = snprintf(buf, sizeof(buf), "\r\n%s: "
2594 + "transfer aborted because stalled for %lu sec.\r\n",
2595 + getprogname(), (unsigned long)wait.tv_sec);
2596 + (void)write(fileno(ttyout), buf, len);
2597 + (void)xsignal(SIGALRM, SIG_DFL);
2599 + siglongjmp(toplevel, 1);
2601 +#endif /* !STANDALONE_PROGRESS */
2604 + * Always set the handler even if we are not the foreground process.
2606 +#ifdef STANDALONE_PROGRESS
2609 + if (quit_time > 0 || progress) {
2610 +#endif /* !STANDALONE_PROGRESS */
2612 + (void)xsignal_restart(SIGALRM, updateprogressmeter, 1);
2613 + alarmtimer(1); /* set alarm timer for 1 Hz */
2614 + } else if (flag == 1) {
2615 + (void)xsignal(SIGALRM, SIG_DFL);
2619 +#ifndef NO_PROGRESS
2625 + * print progress bar only if we are foreground process.
2627 + if (! foregroundproc())
2630 + len += snprintf(buf + len, BUFLEFT, "\r");
2631 + if (filesize > 0) {
2632 + ratio = (int)((double)cursize * 100.0 / (double)filesize);
2633 + ratio = MAX(ratio, 0);
2634 + ratio = MIN(ratio, 100);
2635 + len += snprintf(buf + len, BUFLEFT, "%3d%% ", ratio);
2638 + * calculate the length of the `*' bar, ensuring that
2639 + * the number of stars won't exceed the buffer size
2641 + barlength = MIN(sizeof(buf) - 1, ttywidth) - BAROVERHEAD;
2642 + if (barlength > 0) {
2643 + i = barlength * ratio / 100;
2644 + len += snprintf(buf + len, BUFLEFT,
2645 + "|%.*s%*s|", i, stars, barlength - i, "");
2649 + abbrevsize = cursize;
2650 + for (i = 0; abbrevsize >= 100000 && i < sizeof(prefixes); i++)
2651 + abbrevsize >>= 10;
2652 + len += snprintf(buf + len, BUFLEFT, " " LLFP("5") " %c%c ",
2655 + i == 0 ? ' ' : 'B');
2657 + timersub(&now, &start, &td);
2658 + elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
2662 + bytespersec = bytes;
2663 + if (elapsed > 0.0)
2664 + bytespersec /= elapsed;
2666 + for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
2667 + bytespersec >>= 10;
2668 + len += snprintf(buf + len, BUFLEFT,
2669 + " " LLFP("3") ".%02d %cB/s ",
2670 + (LLT)(bytespersec / 1024),
2671 + (int)((bytespersec % 1024) * 100 / 1024),
2674 + if (filesize > 0) {
2675 + if (bytes <= 0 || elapsed <= 0.0 || cursize > filesize) {
2676 + len += snprintf(buf + len, BUFLEFT, " --:-- ETA");
2677 + } else if (wait.tv_sec >= STALLTIME) {
2678 + len += snprintf(buf + len, BUFLEFT, " - stalled -");
2681 + ((filesize - restart_point) / (bytes / elapsed) -
2683 + if (remaining >= 100 * SECSPERHOUR)
2684 + len += snprintf(buf + len, BUFLEFT,
2687 + i = remaining / SECSPERHOUR;
2689 + len += snprintf(buf + len, BUFLEFT,
2692 + len += snprintf(buf + len, BUFLEFT,
2694 + i = remaining % SECSPERHOUR;
2695 + len += snprintf(buf + len, BUFLEFT,
2696 + "%02d:%02d ETA", i / 60, i % 60);
2701 + len += snprintf(buf + len, BUFLEFT, "\n");
2702 + (void)write(fileno(ttyout), buf, len);
2704 +#endif /* !NO_PROGRESS */
2707 +#ifndef STANDALONE_PROGRESS
2709 + * Display transfer statistics.
2710 + * Requires start to be initialised by progressmeter(-1),
2711 + * direction to be defined by xfer routines, and filesize and bytes
2712 + * to be updated by xfer routines
2713 + * If siginfo is nonzero, an ETA is displayed, and the output goes to stderr
2714 + * instead of ttyout.
2717 +ptransfer(int siginfo)
2719 + struct timeval now, td, wait;
2721 + off_t bytespersec;
2722 + int remaining, hh, i, len;
2724 + char buf[256]; /* Work variable for transfer status. */
2726 + if (!verbose && !progress && !siginfo)
2729 + (void)gettimeofday(&now, NULL);
2730 + timersub(&now, &start, &td);
2731 + elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
2734 + bytespersec = bytes;
2735 + if (elapsed > 0.0)
2736 + bytespersec /= elapsed;
2739 + len += snprintf(buf + len, BUFLEFT, LLF " byte%s %s in ",
2740 + (LLT)bytes, bytes == 1 ? "" : "s", direction);
2741 + remaining = (int)elapsed;
2742 + if (remaining > SECSPERDAY) {
2745 + days = remaining / SECSPERDAY;
2746 + remaining %= SECSPERDAY;
2747 + len += snprintf(buf + len, BUFLEFT,
2748 + "%d day%s ", days, days == 1 ? "" : "s");
2750 + hh = remaining / SECSPERHOUR;
2751 + remaining %= SECSPERHOUR;
2753 + len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
2754 + len += snprintf(buf + len, BUFLEFT,
2755 + "%02d:%02d ", remaining / 60, remaining % 60);
2757 + for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
2758 + bytespersec >>= 10;
2759 + len += snprintf(buf + len, BUFLEFT, "(" LLF ".%02d %cB/s)",
2760 + (LLT)(bytespersec / 1024),
2761 + (int)((bytespersec % 1024) * 100 / 1024),
2764 + if (siginfo && bytes > 0 && elapsed > 0.0 && filesize >= 0
2765 + && bytes + restart_point <= filesize) {
2766 + remaining = (int)((filesize - restart_point) /
2767 + (bytes / elapsed) - elapsed);
2768 + hh = remaining / SECSPERHOUR;
2769 + remaining %= SECSPERHOUR;
2770 + len += snprintf(buf + len, BUFLEFT, " ETA: ");
2772 + len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
2773 + len += snprintf(buf + len, BUFLEFT, "%02d:%02d",
2774 + remaining / 60, remaining % 60);
2775 + timersub(&now, &lastupdate, &wait);
2776 + if (wait.tv_sec >= STALLTIME)
2777 + len += snprintf(buf + len, BUFLEFT, " (stalled)");
2779 + len += snprintf(buf + len, BUFLEFT, "\n");
2780 + (void)write(siginfo ? STDERR_FILENO : fileno(ttyout), buf, len);
2784 + * SIG{INFO,QUIT} handler to print transfer stats if a transfer is in progress
2787 +psummary(int notused)
2789 + int oerrno = errno;
2793 + write(fileno(ttyout), "\n", 1);
2798 +#endif /* !STANDALONE_PROGRESS */
2802 + * Set the SIGALRM interval timer for wait seconds, 0 to disable.
2805 +alarmtimer(int wait)
2807 + struct itimerval itv;
2809 + itv.it_value.tv_sec = wait;
2810 + itv.it_value.tv_usec = 0;
2811 + itv.it_interval = itv.it_value;
2812 + setitimer(ITIMER_REAL, &itv, NULL);
2817 + * Install a POSIX signal handler, allowing the invoker to set whether
2818 + * the signal should be restartable or not
2821 +xsignal_restart(int sig, sigfunc func, int restartable)
2823 + struct sigaction act, oact;
2824 + act.sa_handler = func;
2826 + sigemptyset(&act.sa_mask);
2827 +#if defined(SA_RESTART) /* 4.4BSD, Posix(?), SVR4 */
2828 + act.sa_flags = restartable ? SA_RESTART : 0;
2829 +#elif defined(SA_INTERRUPT) /* SunOS 4.x */
2830 + act.sa_flags = restartable ? 0 : SA_INTERRUPT;
2832 +#error "system must have SA_RESTART or SA_INTERRUPT"
2834 + if (sigaction(sig, &act, &oact) < 0)
2836 + return (oact.sa_handler);
2840 + * Install a signal handler with the `restartable' flag set dependent upon
2841 + * which signal is being set. (This is a wrapper to xsignal_restart())
2844 +xsignal(int sig, sigfunc func)
2849 + * Some signals print output or change the state of the process.
2850 + * There should be restartable, so that reads and writes are
2851 + * not affected. Some signals should cause program flow to change;
2852 + * these signals should not be restartable, so that the system call
2853 + * will return with EINTR, and the program will go do something
2854 + * different. If the signal handler calls longjmp() or siglongjmp(),
2855 + * it doesn't matter if it's restartable.
2877 + * This is unpleasant, but I don't know what would be better.
2878 + * Right now, this "can't happen"
2880 + errx(1, "xsignal_restart called with signal %d", sig);
2883 + return(xsignal_restart(sig, func, restartable));
2885 diff -Nru src/progressbar.h /home/spock/ftp/progressbar.h
2886 --- src/progressbar.h Wed Dec 31 19:00:00 1969
2887 +++ /home/spock/ftp/progressbar.h Thu Jun 12 02:02:11 2003
2889 +/* $NetBSD: progressbar.h,v 1.3 2003/02/28 09:53:49 lukem Exp $ */
2892 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
2893 + * All rights reserved.
2895 + * This code is derived from software contributed to The NetBSD Foundation
2896 + * by Luke Mewburn.
2898 + * Redistribution and use in source and binary forms, with or without
2899 + * modification, are permitted provided that the following conditions
2901 + * 1. Redistributions of source code must retain the above copyright
2902 + * notice, this list of conditions and the following disclaimer.
2903 + * 2. Redistributions in binary form must reproduce the above copyright
2904 + * notice, this list of conditions and the following disclaimer in the
2905 + * documentation and/or other materials provided with the distribution.
2906 + * 3. All advertising materials mentioning features or use of this software
2907 + * must display the following acknowledgement:
2908 + * This product includes software developed by the NetBSD
2909 + * Foundation, Inc. and its contributors.
2910 + * 4. Neither the name of The NetBSD Foundation nor the names of its
2911 + * contributors may be used to endorse or promote products derived
2912 + * from this software without specific prior written permission.
2914 + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2915 + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2916 + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2917 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
2918 + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2919 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2920 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2921 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2922 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2923 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2924 + * POSSIBILITY OF SUCH DAMAGE.
2927 +#ifndef STANDALONE_PROGRESS
2928 +#include <setjmp.h>
2929 +#endif /* !STANDALONE_PROGRESS */
2932 +#define GLOBAL extern
2936 +#define STALLTIME 5 /* # of seconds of no xfer before "stalling" */
2938 +typedef void (*sigfunc)(int);
2941 +GLOBAL FILE *ttyout; /* stdout, or stderr if retrieving to stdout */
2943 +GLOBAL int progress; /* display transfer progress bar */
2944 +GLOBAL int ttywidth; /* width of tty */
2946 +GLOBAL off_t bytes; /* current # of bytes read */
2947 +GLOBAL off_t filesize; /* size of file being transferred */
2948 +GLOBAL off_t restart_point; /* offset to restart transfer */
2951 +#ifndef STANDALONE_PROGRESS
2952 +GLOBAL int fromatty; /* input is from a terminal */
2953 +GLOBAL int verbose; /* print messages coming back from server */
2954 +GLOBAL int quit_time; /* maximum time to wait if stalled */
2956 +GLOBAL char *direction; /* direction transfer is occurring */
2958 +GLOBAL sigjmp_buf toplevel; /* non-local goto stuff for cmd scanner */
2959 +#endif /* !STANDALONE_PROGRESS */
2961 +int foregroundproc(void);
2962 +void alarmtimer(int);
2963 +void progressmeter(int);
2964 +sigfunc xsignal(int, sigfunc);
2965 +sigfunc xsignal_restart(int, sigfunc, int);
2967 +#ifndef STANDALONE_PROGRESS
2968 +void psummary(int);
2969 +void ptransfer(int);
2970 +#endif /* !STANDALONE_PROGRESS */
2973 +#ifdef NO_LONG_LONG
2975 +# define LLFP(x) "%" x "ld"
2977 +# define ULLF "%lu"
2978 +# define ULLFP(x) "%" x "lu"
2979 +# define ULLT unsigned long
2981 +# define LLF "%lld"
2982 +# define LLFP(x) "%" x "lld"
2983 +# define LLT long long
2984 +# define ULLF "%llu"
2985 +# define ULLFP(x) "%" x "llu"
2986 +# define ULLT unsigned long long
2988 diff -Nru src/ruserpass.c /home/spock/ftp/ruserpass.c
2989 --- src/ruserpass.c Sat Jun 15 05:40:36 2002
2990 +++ /home/spock/ftp/ruserpass.c Thu Jun 12 02:02:11 2003
2995 -#include "lukemftp.h"
2996 +#include <sys/cdefs.h>
2999 +static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95";
3001 +__RCSID("$NetBSD: ruserpass.c,v 1.28 2000/11/15 00:11:04 lukem Exp $");
3003 +#endif /* not lint */
3005 +#include <sys/types.h>
3006 +#include <sys/stat.h>
3013 +#include <stdlib.h>
3014 +#include <string.h>
3015 +#include <unistd.h>
3017 #include "ftp_var.h"
3019 diff -Nru src/util.c /home/spock/ftp/util.c
3020 --- src/util.c Sat Jun 15 05:40:37 2002
3021 +++ /home/spock/ftp/util.c Thu Jun 12 02:02:11 2003
3023 -/* $NetBSD: util.c,v 1.107 2002/06/05 10:20:50 lukem Exp $ */
3024 +/* $NetBSD: util.c,v 1.111 2003/02/28 09:54:51 lukem Exp $ */
3027 - * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
3028 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
3029 * All rights reserved.
3031 * This code is derived from software contributed to The NetBSD Foundation
3036 +#include <sys/cdefs.h>
3038 +__RCSID("$NetBSD: util.c,v 1.111 2003/02/28 09:54:51 lukem Exp $");
3039 +#endif /* not lint */
3042 * FTP User Program -- Misc support routines
3045 -#include "lukemftp.h"
3046 +#include <sys/types.h>
3047 +#include <sys/socket.h>
3048 +#include <sys/ioctl.h>
3049 +#include <sys/time.h>
3050 +#include <netinet/in.h>
3051 +#include <arpa/ftp.h>
3058 +#include <signal.h>
3059 +#include <limits.h>
3062 +#include <stdlib.h>
3063 +#include <string.h>
3064 +#include <termios.h>
3066 +#include <tzfile.h>
3067 +#include <unistd.h>
3069 #include "ftp_var.h"
3071 @@ -775,303 +800,6 @@
3075 -#ifndef NO_PROGRESS
3078 - * return non-zero if we're the current foreground process
3081 -foregroundproc(void)
3083 - static pid_t pgrp = -1;
3088 -#else /* ! GETPGRP_VOID */
3089 - pgrp = getpgrp(0);
3090 -#endif /* ! GETPGRP_VOID */
3092 - return (tcgetpgrp(fileno(ttyout)) == pgrp);
3096 -static void updateprogressmeter(int);
3099 - * SIGALRM handler to update the progress meter
3102 -updateprogressmeter(int dummy)
3104 - int oerrno = errno;
3109 -#endif /* NO_PROGRESS */
3113 - * List of order of magnitude prefixes.
3114 - * The last is `P', as 2^64 = 16384 Petabytes
3116 -static const char prefixes[] = " KMGTP";
3119 - * Display a transfer progress bar if progress is non-zero.
3120 - * SIGALRM is hijacked for use by this function.
3121 - * - Before the transfer, set filesize to size of file (or -1 if unknown),
3122 - * and call with flag = -1. This starts the once per second timer,
3123 - * and a call to updateprogressmeter() upon SIGALRM.
3124 - * - During the transfer, updateprogressmeter will call progressmeter
3126 - * - After the transfer, call with flag = 1
3128 -static struct timeval start;
3129 -static struct timeval lastupdate;
3131 -#define BUFLEFT (sizeof(buf) - len)
3134 -progressmeter(int flag)
3136 - static off_t lastsize;
3137 -#ifndef NO_PROGRESS
3138 - struct timeval now, td, wait;
3139 - off_t cursize, abbrevsize, bytespersec;
3141 - int ratio, barlength, i, len, remaining;
3144 - * Work variables for progress bar.
3146 - * XXX: if the format of the progress bar changes
3147 - * (especially the number of characters in the
3148 - * `static' portion of it), be sure to update
3149 - * these appropriately.
3151 - char buf[256]; /* workspace for progress bar */
3152 -#define BAROVERHEAD 43 /* non `*' portion of progress bar */
3154 - * stars should contain at least
3155 - * sizeof(buf) - BAROVERHEAD entries
3157 - const char stars[] =
3158 -"*****************************************************************************"
3159 -"*****************************************************************************"
3160 -"*****************************************************************************";
3165 - (void)gettimeofday(&start, NULL);
3166 - lastupdate = start;
3167 - lastsize = restart_point;
3169 -#ifndef NO_PROGRESS
3175 - * print progress bar only if we are foreground process.
3177 - if (! foregroundproc())
3180 - (void)gettimeofday(&now, NULL);
3181 - cursize = bytes + restart_point;
3182 - timersub(&now, &lastupdate, &wait);
3183 - if (cursize > lastsize) {
3185 - lastsize = cursize;
3189 - len += snprintf(buf + len, BUFLEFT, "\r");
3190 - if (filesize > 0) {
3191 - ratio = (int)((double)cursize * 100.0 / (double)filesize);
3192 - ratio = MAX(ratio, 0);
3193 - ratio = MIN(ratio, 100);
3194 - len += snprintf(buf + len, BUFLEFT, "%3d%% ", ratio);
3197 - * calculate the length of the `*' bar, ensuring that
3198 - * the number of stars won't exceed the buffer size
3200 - barlength = MIN(sizeof(buf) - 1, ttywidth) - BAROVERHEAD;
3201 - if (barlength > 0) {
3202 - i = barlength * ratio / 100;
3203 - len += snprintf(buf + len, BUFLEFT,
3204 - "|%.*s%*s|", i, stars, barlength - i, "");
3208 - abbrevsize = cursize;
3209 - for (i = 0; abbrevsize >= 100000 && i < sizeof(prefixes); i++)
3210 - abbrevsize >>= 10;
3211 - len += snprintf(buf + len, BUFLEFT, " " LLFP("5") " %c%c ",
3214 - i == 0 ? ' ' : 'B');
3216 - timersub(&now, &start, &td);
3217 - elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
3221 - bytespersec = bytes;
3222 - if (elapsed > 0.0)
3223 - bytespersec /= elapsed;
3225 - for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
3226 - bytespersec >>= 10;
3227 - len += snprintf(buf + len, BUFLEFT,
3228 - " " LLFP("3") ".%02d %cB/s ",
3229 - (LLT)(bytespersec / 1024),
3230 - (int)((bytespersec % 1024) * 100 / 1024),
3233 - if (filesize > 0) {
3234 - if (bytes <= 0 || elapsed <= 0.0 || cursize > filesize) {
3235 - len += snprintf(buf + len, BUFLEFT, " --:-- ETA");
3236 - } else if (flag == 1) {
3237 - i = elapsed / SECSPERHOUR;
3239 - len += snprintf(buf + len, BUFLEFT, "%2d:", i);
3241 - len += snprintf(buf + len, BUFLEFT, " ");
3242 - i = (int)elapsed % SECSPERHOUR;
3243 - len += snprintf(buf + len, BUFLEFT,
3244 - "%02d:%02d ", i / 60, i % 60);
3245 - } else if (wait.tv_sec >= STALLTIME) {
3246 - len += snprintf(buf + len, BUFLEFT, " - stalled -");
3249 - ((filesize - restart_point) / (bytes / elapsed) -
3251 - if (remaining >= 100 * SECSPERHOUR)
3252 - len += snprintf(buf + len, BUFLEFT,
3255 - i = remaining / SECSPERHOUR;
3257 - len += snprintf(buf + len, BUFLEFT,
3260 - len += snprintf(buf + len, BUFLEFT,
3262 - i = remaining % SECSPERHOUR;
3263 - len += snprintf(buf + len, BUFLEFT,
3264 - "%02d:%02d ETA", i / 60, i % 60);
3269 - len += snprintf(buf + len, BUFLEFT, "\n");
3270 - (void)write(fileno(ttyout), buf, len);
3273 - (void)xsignal_restart(SIGALRM, updateprogressmeter, 1);
3274 - alarmtimer(1); /* set alarm timer for 1 Hz */
3275 - } else if (flag == 1) {
3276 - (void)xsignal(SIGALRM, SIG_DFL);
3279 -#endif /* !NO_PROGRESS */
3283 - * Display transfer statistics.
3284 - * Requires start to be initialised by progressmeter(-1),
3285 - * direction to be defined by xfer routines, and filesize and bytes
3286 - * to be updated by xfer routines
3287 - * If siginfo is nonzero, an ETA is displayed, and the output goes to stderr
3288 - * instead of ttyout.
3291 -ptransfer(int siginfo)
3293 - struct timeval now, td, wait;
3295 - off_t bytespersec;
3296 - int remaining, hh, i, len;
3298 - char buf[256]; /* Work variable for transfer status. */
3300 - if (!verbose && !progress && !siginfo)
3303 - (void)gettimeofday(&now, NULL);
3304 - timersub(&now, &start, &td);
3305 - elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
3308 - bytespersec = bytes;
3309 - if (elapsed > 0.0)
3310 - bytespersec /= elapsed;
3313 - len += snprintf(buf + len, BUFLEFT, LLF " byte%s %s in ",
3314 - (LLT)bytes, bytes == 1 ? "" : "s", direction);
3315 - remaining = (int)elapsed;
3316 - if (remaining > SECSPERDAY) {
3319 - days = remaining / SECSPERDAY;
3320 - remaining %= SECSPERDAY;
3321 - len += snprintf(buf + len, BUFLEFT,
3322 - "%d day%s ", days, days == 1 ? "" : "s");
3324 - hh = remaining / SECSPERHOUR;
3325 - remaining %= SECSPERHOUR;
3327 - len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
3328 - len += snprintf(buf + len, BUFLEFT,
3329 - "%02d:%02d ", remaining / 60, remaining % 60);
3331 - for (i = 1; bytespersec >= 1024000 && i < sizeof(prefixes); i++)
3332 - bytespersec >>= 10;
3333 - len += snprintf(buf + len, BUFLEFT, "(" LLF ".%02d %cB/s)",
3334 - (LLT)(bytespersec / 1024),
3335 - (int)((bytespersec % 1024) * 100 / 1024),
3338 - if (siginfo && bytes > 0 && elapsed > 0.0 && filesize >= 0
3339 - && bytes + restart_point <= filesize) {
3340 - remaining = (int)((filesize - restart_point) /
3341 - (bytes / elapsed) - elapsed);
3342 - hh = remaining / SECSPERHOUR;
3343 - remaining %= SECSPERHOUR;
3344 - len += snprintf(buf + len, BUFLEFT, " ETA: ");
3346 - len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
3347 - len += snprintf(buf + len, BUFLEFT, "%02d:%02d",
3348 - remaining / 60, remaining % 60);
3349 - timersub(&now, &lastupdate, &wait);
3350 - if (wait.tv_sec >= STALLTIME)
3351 - len += snprintf(buf + len, BUFLEFT, " (stalled)");
3353 - len += snprintf(buf + len, BUFLEFT, "\n");
3354 - (void)write(siginfo ? STDERR_FILENO : fileno(ttyout), buf, len);
3358 - * SIG{INFO,QUIT} handler to print transfer stats if a transfer is in progress
3361 -psummary(int notused)
3363 - int oerrno = errno;
3367 - write(fileno(ttyout), "\n", 1);
3374 * List words in stringlist, vertically arranged
3375 @@ -1158,20 +886,6 @@
3379 - * Set the SIGALRM interval timer for wait seconds, 0 to disable.
3382 -alarmtimer(int wait)
3384 - struct itimerval itv;
3386 - itv.it_value.tv_sec = wait;
3387 - itv.it_value.tv_usec = 0;
3388 - itv.it_interval = itv.it_value;
3389 - setitimer(ITIMER_REAL, &itv, NULL);
3393 * Setup or cleanup EditLine structures
3395 #ifndef NO_EDITCOMPLETE
3396 @@ -1552,85 +1266,4 @@
3398 err(1, "Unable to allocate memory for string copy");
3403 - * Install a POSIX signal handler, allowing the invoker to set whether
3404 - * the signal should be restartable or not
3407 -xsignal_restart(int sig, sigfunc func, int restartable)
3409 -#ifdef ultrix /* XXX: this is lame - how do we test sigvec vs. sigaction? */
3410 - struct sigvec vec, ovec;
3412 - vec.sv_handler = func;
3413 - sigemptyset(&vec.sv_mask);
3415 - if (sigvec(sig, &vec, &ovec) < 0)
3417 - return (ovec.sv_handler);
3418 -#else /* ! ultrix */
3419 - struct sigaction act, oact;
3420 - act.sa_handler = func;
3422 - sigemptyset(&act.sa_mask);
3423 -#if defined(SA_RESTART) /* 4.4BSD, Posix(?), SVR4 */
3424 - act.sa_flags = restartable ? SA_RESTART : 0;
3425 -#elif defined(SA_INTERRUPT) /* SunOS 4.x */
3426 - act.sa_flags = restartable ? 0 : SA_INTERRUPT;
3428 -#error "system must have SA_RESTART or SA_INTERRUPT"
3430 - if (sigaction(sig, &act, &oact) < 0)
3432 - return (oact.sa_handler);
3433 -#endif /* ! ultrix */
3437 - * Install a signal handler with the `restartable' flag set dependent upon
3438 - * which signal is being set. (This is a wrapper to xsignal_restart())
3441 -xsignal(int sig, sigfunc func)
3446 - * Some signals print output or change the state of the process.
3447 - * There should be restartable, so that reads and writes are
3448 - * not affected. Some signals should cause program flow to change;
3449 - * these signals should not be restartable, so that the system call
3450 - * will return with EINTR, and the program will go do something
3451 - * different. If the signal handler calls longjmp() or siglongjmp(),
3452 - * it doesn't matter if it's restartable.
3474 - * This is unpleasant, but I don't know what would be better.
3475 - * Right now, this "can't happen"
3477 - errx(1, "xsignal_restart called with signal %d", sig);
3480 - return(xsignal_restart(sig, func, restartable));
3482 diff -Nru src/version.h /home/spock/ftp/version.h
3483 --- src/version.h Sat Jun 15 05:40:37 2002
3484 +++ /home/spock/ftp/version.h Thu Jun 12 02:02:11 2003
3486 -/* $NetBSD: version.h,v 1.29 2002/06/05 10:20:51 lukem Exp $ */
3487 +/* $NetBSD: version.h,v 1.30 2003/02/28 09:54:20 lukem Exp $ */
3489 - * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
3490 + * Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
3491 * All rights reserved.
3493 * This code is derived from software contributed to The NetBSD Foundation
3498 -#define FTP_VERSION "20020605"
3499 +#define FTP_VERSION "20030228"