]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - contrib/lukemftp/diffout
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / contrib / lukemftp / diffout
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
4 @@ -1,16 +1,17 @@
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//
36  D
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
40 @@ -1 +1 @@
41 -src/contrib/lukemftp/src
42 +src/usr.bin/ftp
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
46 @@ -1 +1 @@
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
52 @@ -0,0 +1,26 @@
53 +#      $NetBSD: Makefile,v 1.26 2003/01/21 16:08:06 jhawk Exp $
54 +#      from: @(#)Makefile      8.2 (Berkeley) 4/3/94
55 +
56 +PROG=  ftp
57 +SRCS=  cmds.c cmdtab.c complete.c domacro.c fetch.c ftp.c main.c \
58 +       progressbar.c ruserpass.c util.c
59 +
60 +# Uncomment the following to provide defaults for gate-ftp operation
61 +#
62 +#CPPFLAGS+=-DGATE_SERVER=\"ftp-gw.host\" # -DGATE_PORT=21
63 +
64 +.if defined(SMALLPROG)
65 +CPPFLAGS+=-DNO_EDITCOMPLETE -DNO_ABOUT
66 +.else
67 +LDADD+=        -ledit -ltermcap
68 +DPADD+=        ${LIBEDIT} ${LIBTERMCAP}
69 +.endif
70 +
71 +.if !defined(SMALLPROG) || defined(SMALLPROG_INET6)
72 +CPPFLAGS+= -DINET6
73 +.endif
74 +
75 +cmds.o fetch.o: version.h
76 +main.o:        ftp_var.h
77 +
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
82 @@ -1,43 +0,0 @@
83 -#
84 -#      $Id: Makefile.in,v 1.8 2000/08/08 07:04:27 lukem Exp $
85 -#
86 -
87 -srcdir = @srcdir@
88 -VPATH  = @srcdir@
89 -SHELL  = /bin/sh
90 -
91 -prefix = @prefix@
92 -exec_prefix = @exec_prefix@
93 -bindir = @bindir@
94 -mandir = @mandir@
95 -transform = @program_transform_name@
96 -
97 -mandircat1 = ${mandir}/cat1
98 -
99 -CC     = @CC@
100 -CFLAGS = -I${srcdir} -I${srcdir}/.. -I. -I.. @INCLUDES@ @CFLAGS@
101 -LIBS   = @LIBS@
102 -LDFLAGS        = @LDFLAGS@
103 -
104 -INSTALL        = @INSTALL@
105 -
106 -PROG   = ftp
107 -OBJS   = cmds.o cmdtab.o complete.o domacro.o fetch.o ftp.o main.o \
108 -         ruserpass.o util.o
109 -
110 -all:   ${PROG}
111 -
112 -install: all
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
117 -
118 -${PROG}: ${OBJS} @LIBDEPENDS@
119 -       ${CC} ${CFLAGS} ${LDFLAGS} -o ${PROG} ${OBJS} ${LIBS}
120 -
121 -clean:
122 -       rm -f core ${PROG} ${OBJS}
123 -
124 -distclean: clean
125 -       rm -f Makefile
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
129 @@ -1,4 +1,4 @@
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 $ */
132  
133  /*-
134   * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
135 @@ -102,11 +102,35 @@
136   * SUCH DAMAGE.
137   */
138  
139 +#include <sys/cdefs.h>
140 +#ifndef lint
141 +#if 0
142 +static char sccsid[] = "@(#)cmds.c     8.6 (Berkeley) 10/9/94";
143 +#else
144 +__RCSID("$NetBSD: cmds.c,v 1.100 2002/11/30 03:10:55 lukem Exp $");
145 +#endif
146 +#endif /* not lint */
147 +
148  /*
149   * FTP User Program -- Command Routines.
150   */
151 -
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>
158 +
159 +#include <ctype.h>
160 +#include <err.h>
161 +#include <glob.h>
162 +#include <limits.h>
163 +#include <netdb.h>
164 +#include <paths.h>
165 +#include <stdio.h>
166 +#include <stdlib.h>
167 +#include <string.h>
168 +#include <time.h>
169 +#include <unistd.h>
170  
171  #include "ftp_var.h"
172  #include "version.h"
173 @@ -1008,7 +1032,7 @@
174                         gatemode = 0;
175                 else {
176                         if (argc == 3)
177 -                               gateport = strdup(argv[2]);
178 +                               gateport = xstrdup(argv[2]);
179                         (void)strlcpy(gsbuf, argv[1], sizeof(gsbuf));
180                         gateserver = gsbuf;
181                         gatemode = 1;
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
185 @@ -1,4 +1,4 @@
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 $        */
188  
189  /*-
190   * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
191 @@ -69,8 +69,16 @@
192   * SUCH DAMAGE.
193   */
194  
195 -#include "lukemftp.h"
196 +#include <sys/cdefs.h>
197 +#ifndef lint
198 +#if 0
199 +static char sccsid[] = "@(#)cmdtab.c   8.4 (Berkeley) 10/9/94";
200 +#else
201 +__RCSID("$NetBSD: cmdtab.c,v 1.40 2002/07/29 04:24:47 lukem Exp $");
202 +#endif
203 +#endif /* not lint */
204  
205 +#include <stdio.h>
206  #include "ftp_var.h"
207  
208  /*
209 @@ -123,7 +131,7 @@
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
221 @@ -36,11 +36,23 @@
222   * POSSIBILITY OF SUCH DAMAGE.
223   */
224  
225 +#include <sys/cdefs.h>
226 +#ifndef lint
227 +__RCSID("$NetBSD: complete.c,v 1.38 2000/05/01 10:35:17 lukem Exp $");
228 +#endif /* not lint */
229 +
230  /*
231   * FTP user program - command and file completion routines
232   */
233  
234 -#include "lukemftp.h"
235 +#include <sys/stat.h>
236 +
237 +#include <ctype.h>
238 +#include <err.h>
239 +#include <dirent.h>
240 +#include <stdio.h>
241 +#include <stdlib.h>
242 +#include <string.h>
243  
244  #include "ftp_var.h"
245  
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
249 @@ -33,7 +33,18 @@
250   * SUCH DAMAGE.
251   */
252  
253 -#include "lukemftp.h"
254 +#include <sys/cdefs.h>
255 +#ifndef lint
256 +#if 0
257 +static char sccsid[] = "@(#)domacro.c  8.3 (Berkeley) 4/2/94";
258 +#else
259 +__RCSID("$NetBSD: domacro.c,v 1.19 2002/02/01 05:04:43 itojun Exp $");
260 +#endif
261 +#endif /* not lint */
262 +
263 +#include <ctype.h>
264 +#include <stdio.h>
265 +#include <string.h>
266  
267  #include "ftp_var.h"
268  
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
272 @@ -1,7 +1,7 @@
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 $        */
275  
276  /*-
277 - * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
278 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
279   * All rights reserved.
280   *
281   * This code is derived from software contributed to The NetBSD Foundation
282 @@ -110,7 +110,6 @@
283  void   abortxfer(int);
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 *);
290 @@ -123,7 +122,7 @@
291  void   cmdtimeout(int);
292  void   cmdscanner(void);
293  int    command(const char *, ...)
294 -     ;
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);
304  char   *prompt(void);
305  void   proxabort(int);
306  void   proxtrans(const char *, const char *, const char *);
307  void   psabort(int);
308 -void   psummary(int);
309  void   pswitch(int);
310 -void   ptransfer(int);
311  void   put(int, char **);
312  void   pwd(int, char **);
313  void   quit(int, char **);
314 @@ -263,5 +259,3 @@
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
323 @@ -1,7 +1,7 @@
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 $  */
326  
327  /*-
328 - * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
329 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
330   * All rights reserved.
331   *
332   * This code is derived from software contributed to The NetBSD Foundation
333 @@ -39,11 +39,36 @@
334   * POSSIBILITY OF SUCH DAMAGE.
335   */
336  
337 +#include <sys/cdefs.h>
338 +#ifndef lint
339 +__RCSID("$NetBSD: fetch.c,v 1.141 2003/05/14 14:31:00 wiz Exp $");
340 +#endif /* not lint */
341 +
342  /*
343   * FTP User Program -- Command line file retrieval
344   */
345  
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>
352 +
353 +#include <netinet/in.h>
354 +
355 +#include <arpa/ftp.h>
356 +#include <arpa/inet.h>
357 +
358 +#include <ctype.h>
359 +#include <err.h>
360 +#include <errno.h>
361 +#include <netdb.h>
362 +#include <fcntl.h>
363 +#include <stdio.h>
364 +#include <stdlib.h>
365 +#include <string.h>
366 +#include <unistd.h>
367 +#include <time.h>
368  
369  #include "ftp_var.h"
370  #include "version.h"
371 @@ -155,7 +180,7 @@
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);
378         rval = 0;
379  
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).
389   *
390   * Examples:
391 - *      input url                       output path
392 + *      input URL                       output path
393   *      ---------                       -----------
394   *     "ftp://host"                    NULL
395   *     "http://host/"                  NULL
396 @@ -484,7 +509,8 @@
397                         rval = fetch_ftp(url);
398                         goto cleanup_fetch_url;
399                 }
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;
404         } else {
405                 if (debug)
406 @@ -1372,7 +1398,7 @@
407                     dir ? dir : "<null>", file ? file : "<null>");
408  
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)
413                         dirhasglob = 1;
414                 if (! EMPTYSTRING(file) && strpbrk(file, "*?[]{}") != NULL)
415 @@ -1741,7 +1767,7 @@
416                 }
417         }
418         if (debug)
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>");
422                 
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
427 @@ -1,6 +1,6 @@
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 $
430  .\"
431 -.\" Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
432 +.\" Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
433  .\" All rights reserved.
434  .\"
435  .\" This code is derived from software contributed to The NetBSD Foundation
436 @@ -68,7 +68,7 @@
437  .\"
438  .\"    @(#)ftp.1       8.3 (Berkeley) 10/9/94
439  .\"
440 -.Dd May 18, 2002
441 +.Dd January 20, 2003
442  .Dt FTP 1
443  .Os
444  .Sh NAME
445 @@ -76,7 +76,7 @@
446  .Nd
447  Internet file transfer program
448  .Sh SYNOPSIS
449 -.Nm ""
450 +.Nm
451  .Op Fl 46AadefginpRtvV
452  .Bk -words
453  .Op Fl N Ar netrc
454 @@ -88,46 +88,81 @@
455  .Op Fl P Ar port
456  .Ek
457  .Bk -words
458 +.Op Fl q Ar quittime
459 +.Ek
460 +.Bk -words
461  .Op Fl r Ar retry
462  .Ek
463  .Bk -words
464 +.\" [-T dir,max[,inc]]
465  .Oo
466 -.Fl T
467 +.Fl T Xo
468  .Sm off
469 -.Xo
470  .Ar dir ,
471  .Ar max
472  .Op , Ar inc
473 -.Xc
474  .Sm on
475 +.Xc
476  .Oc
477  .Ek
478  .Bk -words
479 +.\" [[user@]host [port]]
480  .Oo
481 -[\fIuser\fR@]\fIhost\fR
482 +.Oo Ar user Ns Li \&@ Oc Ns Ar host
483  .Op Ar port
484  .Oc
485  .Ek
486  .Bk -words
487 -[\fIuser\fR@]\fIhost\fR:[\fIpath\fR][/]
488 +.\" [[user@]host:[path][/]]
489 +.Sm off
490 +.Oo
491 +.Op Ar user Li \&@
492 +.Ar host Li \&:
493 +.Op Ar path
494 +.Op Li /
495 +.Oc
496 +.Sm on
497  .Ek
498  .Bk -words
499 -.Op file:///\fIpath\fR
500 +.\" [file:///path]
501 +.Sm off
502 +.Oo
503 +.Li file:/// Ar path
504 +.Oc
505 +.Sm on
506  .Ek
507  .Bk -words
508 -.Op ftp://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR[/]
509 +.\" [ftp://[user[:password]@]host[:port]/path[/]]
510 +.Sm off
511 +.Oo
512 +.Li ftp://
513 +.Oo Ar user
514 +.Op Li \&: Ar password
515 +.Li \&@ Oc
516 +.Ar host Oo Li \&: Ar port Oc
517 +.Li / Ar path
518 +.Op Li /
519 +.Op Li ;type= Ar X
520 +.Oc
521 +.Sm on
522  .Ek
523  .Bk -words
524 -.Op http://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR
525 +.\" [http://[user[:password]@]host[:port]/path]
526 +.Sm off
527 +.Oo
528 +.Li http://
529 +.Oo Ar user
530 +.Op Li \&: Ar password
531 +.Li \&@ Oc
532 +.Ar host Oo Li \&: Ar port Oc
533 +.Li / Ar path
534 +.Oc
535 +.Sm on
536  .Ek
537  .Op Ar \&.\&.\&.
538 -.Nm ""
539 -.Fl u Ar url
540 -.\".Ar ftp://[\fIuser\fR[:\fIpassword\fR]@]\fIhost\fR[:\fIport\fR]/\fIpath\fR[/[file]]
541 -.\"|
542 -.\".Ar [\fIuser\fR@]\fIhost\fR:[\fIpath\fR][/[\fIfile\fR]]
543 +.Nm
544  .Bk -words
545 -file
546 +.Fl u Ar URL Ar file
547  .Ek
548  .Op Ar \&.\&.\&.
549  .Sh DESCRIPTION
550 @@ -243,6 +278,10 @@
551  Retry the connection attempt if it failed, pausing for
552  .Ar wait
553  seconds.
554 +.It Fl q Ar quittime
555 +Quit if the connection has stalled for
556 +.Ar quittime
557 +seconds.
558  .It Fl R
559  Restart all non-proxied auto-fetches.
560  .It Fl t
561 @@ -266,11 +305,11 @@
562  Refer to
563  .Ic rate
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
568 -.Ar url
569 +.Ar URL
570  where
571 -.Ar url
572 +.Ar URL
573  is one of the ftp URL types as supported by auto-fetch
574  (with an optional target filename for single file uploads), and
575  .Ar file
576 @@ -869,7 +908,7 @@
577  .Tn FTP
578  server at that port.
579  If the
580 -.Ic auto-login
581 +.Ic "set auto-login"
582  option is on (default),
583  .Nm
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
587  .Ic "set pager"
588  option.
589 -.It Ic passive Op Ic auto
590 +.It Ic passive Op Cm auto
591  Toggle passive mode (if no arguments are given).
592  If
593 -.Ic auto
594 +.Cm auto
595  is given, act as if
596  .Ev FTPMODE
597  is set to
598 @@ -896,14 +935,17 @@
599  .Dv PASV
600  command for all data connections instead of a
601  .Dv PORT
602 -command.  The
603 +command.
604 +The
605  .Dv PASV
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
612  .Dv PORT
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
617  .Nm
618  through a gateway router or host that controls the directionality of
619  traffic.
620 @@ -965,34 +1007,34 @@
621  .Pp
622  When prompting is on, the following commands are available at a prompt:
623  .Bl -tag -width 2n -offset indent
624 -.It Ic a
625 +.It Cm a
626  Answer
627  .Sq yes
628  to the current file, and automatically answer
629  .Sq yes
630  to any remaining files for the current command.
631 -.It Ic n
632 +.It Cm n
633  Answer
634  .Sq no ,
635  and do not transfer the file.
636 -.It Ic p
637 +.It Cm p
638  Answer
639  .Sq yes
640  to the current file, and turn off prompt mode
641  (as is
642  .Dq prompt off
643  had been given).
644 -.It Ic q
645 +.It Cm q
646  Terminate the current operation.
647 -.It Ic y
648 +.It Cm y
649  Answer
650  .Sq yes ,
651  and transfer the file.
652 -.It Ic ?
653 +.It Cm ?
654  Display a help message.
655  .El
656  .Pp
657 -Any other reponse will answer
658 +Any other response will answer
659  .Sq yes
660  to the current file.
661  .It Ic proxy Ar ftp-command
662 @@ -1072,11 +1114,11 @@
663  .Ar direction
664  may be one of:
665  .Bl -tag -width "all" -offset indent -compact
666 -.It Ic all
667 +.It Cm all
668  Both directions.
669 -.It Ic get
670 +.It Cm get
671  Incoming transfers.
672 -.It Ic put
673 +.It Cm put
674  Outgoing transfers.
675  .El
676  .Pp
677 @@ -1240,7 +1282,7 @@
678  implementations which do ignore
679  .Dv PORT
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
683  Set
684  .Ar option
685  to
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
690 -.It anonpass
691 +.It Cm anonpass
692  Defaults to
693  .Ev $FTPANONPASS
694 -.It ftp_proxy
695 +.It Cm ftp_proxy
696  Defaults to
697  .Ev $ftp_proxy .
698 -.It http_proxy
699 +.It Cm http_proxy
700  Defaults to
701  .Ev $http_proxy .
702 -.It no_proxy
703 +.It Cm no_proxy
704  Defaults to
705  .Ev $no_proxy .
706 -.It pager
707 +.It Cm pager
708  Defaults to
709  .Ev $PAGER .
710 -.It prompt
711 +.It Cm prompt
712  Defaults to
713  .Ev $FTPPROMPT .
714 -.It rprompt
715 +.It Cm rprompt
716  Defaults to
717  .Ev $FTPRPROMPT .
718  .El
719 @@ -1415,13 +1457,14 @@
720  interpretation of the argument.
721  Supported suffixes are:
722  .Bl -tag -width 3n -offset indent -compact
723 -.It b
724 -Causes no modification. (Optional)
725 -.It k
726 +.It Li b
727 +Causes no modification.
728 +(Optional)
729 +.It Li k
730  Kilo; multiply the argument by 1024
731 -.It m
732 +.It Li m
733  Mega; multiply the argument by 1048576
734 -.It g
735 +.It Li g
736  Giga; multiply the argument by 1073741824
737  .El
738  .Pp
739 @@ -1447,7 +1490,15 @@
740  .Pp
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][/]
745 +.It Xo
746 +.Sm off
747 +.Op Ar user Li \&@
748 +.Ar host Li \&:
749 +.Op Ar path
750 +.Op Li /
751 +.Sm on
752 +.Xc
753  .Dq Classic
754  .Tn FTP
755  format.
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]
762 +.It Xo
763 +.Sm off
764 +.Li ftp://
765 +.Oo Ar user
766 +.Op Li \&: Ar password
767 +.Li \&@ Oc
768 +.Ar host Oo Li \&: Ar port Oc
769 +.Li / Ar path
770 +.Op Li /
771 +.Op Li ;type= Ar X
772 +.Sm on
773 +.Xc
774  An
775  .Tn FTP
776  URL, retrieved using the
777 @@ -1493,15 +1556,94 @@
778  .Ar password
779  if supplied, otherwise prompt the user for one.
780  .Pp
781 +If a suffix of
782 +.Sq ;type=A
783 +or
784 +.Sq ;type=I
785 +is supplied, then the transfer type will take place as
786 +ascii or binary (respectively).
787 +The default transfer type is binary.
788 +.Pp
789  In order to be compliant with
790  .Cm RFC 1738 ,
791  .Nm
792 -strips the leading
793 -.Sq /
794 -from
795 +interprets the
796 +.Ar path
797 +part of an
798 +.Dq ftp://
799 +auto-fetch URL as follows:
800 +.Bl -bullet
801 +.It
802 +The
803 +.Sq Li /
804 +immediately after the
805 +.Ar host Ns Oo Li \&: Ns Ar port Oc
806 +is interpreted as a separator before the
807 +.Ar path ,
808 +and not as part of the
809 +.Ar path
810 +itself.
811 +.It
812 +The
813 +.Ar path
814 +is interpreted as a
815 +.So Li / Sc Ns -separated
816 +list of name components.
817 +For all but the last such component,
818 +.Nm
819 +performs the equivalent of a
820 +.Ic cd
821 +command.
822 +For the last path component,
823 +.Nm
824 +performs the equivalent of a
825 +.Ic get
826 +command.
827 +.It
828 +Empty name components,
829 +which result from
830 +.Sq Li //
831 +within the
832 +.Ar path ,
833 +or from an extra
834 +.Sq Li /
835 +at the beginning of the
836  .Ar path ,
837 -resulting in a transfer relative from the default login directory of
838 -the user.
839 +will cause the equivalent of a
840 +.Ic cd
841 +command without a directory name.
842 +This is unlikely to be useful.
843 +.It
844 +Any
845 +.Sq Li \&% Ns Ar XX
846 +codes within the path components are decoded, with
847 +.Ar XX
848 +representing a character code in hexadecimal.
849 +This decoding takes place after the
850 +.Ar path
851 +has been split into components,
852 +but before each component is used in the equivalent of a
853 +.Ic cd
854 +or
855 +.Ic get
856 +command.
857 +Some often-used codes are
858 +.Sq Li \&%2F
859 +(which represents
860 +.Sq Li / )
861 +and
862 +.Sq Li \&%7E
863 +(which represents
864 +.Sq Li ~ ) .
865 +.El
866 +.Pp
867 +The above interpretation has the following consequences:
868 +.Bl -bullet
869 +.It
870 +The path is interpreted relative to the
871 +default login directory of the specified user or of the
872 +.Sq anonymous
873 +user.
874  If the
875  .Pa /
876  directory is required, use a leading path of
877 @@ -1519,15 +1661,57 @@
878  .Sq mypass ,
879  use
880  .Dq ftp://myname:mypass@localhost/%2fetc/motd
881 -.Pp
882 -If a suffix of
883 -.Sq ;type=A
884 -or
885 -.Sq ;type=I
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
890 +.It
891 +The exact
892 +.Ic cd
893 +and
894 +.Ic get
895 +commands can be controlled by careful choice of
896 +where to use
897 +.Sq /
898 +and where to use
899 +.Sq %2F
900 +(or
901 +.Sq %2f ) .
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
906 +.Dq "cd dir1" ,
907 +.Dq "cd dir2" ,
908 +.Dq "get file" .
909 +.It ftp://host/%2Fdir1/dir2/file
910 +.Dq "cd /dir1" ,
911 +.Dq "cd dir2" ,
912 +.Dq "get file" .
913 +.It ftp://host/dir1%2Fdir2/file
914 +.Dq "cd dir1/dir2" ,
915 +.Dq "get file" .
916 +.It ftp://host/%2Fdir1%2Fdir2/file
917 +.Dq "cd /dir1/dir2" ,
918 +.Dq "get file" .
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" .
923 +.El
924 +.It
925 +You must have appropriate access permission for each of the
926 +intermediate directories that is used in the equivalent of a
927 +.Ic cd
928 +command.
929 +.El
930 +.\" http://[user[:password]@]host[:port]/path
931 +.It Xo
932 +.Sm off
933 +.Li http://
934 +.Oo Ar user
935 +.Op Li \&: Ar password
936 +.Li \&@ Oc
937 +.Ar host Oo Li \&: Ar port Oc
938 +.Li / Ar path
939 +.Sm on
940 +.Xc
941  An
942  .Tn HTTP
943  URL, retrieved using the
944 @@ -1540,16 +1724,22 @@
945  proxy server.
946  If
947  .Tn HTTP
948 -authorisation is required to retrieve
949 +authorization is required to retrieve
950  .Ar path ,
951  and
952  .Sq user
953  (and optionally
954  .Sq password )
955  is in the URL, use them for the first attempt to authenticate.
956 -.It file:///path
957 +.\" file:///path
958 +.It Xo
959 +.Sm off
960 +.Li file:/// Ar path
961 +.Sm on
962 +.Xc
963  A local URL, copied from
964 -.Ar /path .
965 +.Pa / Ns Ar path
966 +on the local host.
967  .El
968  .Pp
969  Unless noted otherwise above, and
970 @@ -1736,7 +1926,7 @@
971  .Nm
972  supports only the default values for the remaining
973  file transfer parameters:
974 -.Ic mode  ,
975 +.Ic mode ,
976  .Ic form ,
977  and
978  .Ic struct .
979 @@ -1841,6 +2031,14 @@
980  .Ic init
981  is defined, it is automatically executed as the last step in the
982  auto-login process.
983 +For example,
984 +.Bd -literal -offset indent
985 +default
986 +macdef init
987 +epsv4 off
988 +.Ed
989 +.Pp
990 +followed by a blank line.
991  .El
992  .Sh COMMAND LINE EDITING
993  .Nm
994 @@ -1888,9 +2086,20 @@
995  The following formatting sequences are replaced by the given
996  information:
997  .Bl -tag -width "%% " -offset indent
998 -.It %/
999 +.It Li \&%/
1000  The current remote working directory.
1001 -.It %c[[0]\fIn\fR], %.[[0]\fIn\fR]
1002 +.\" %c[[0]n], %.[[0]n]
1003 +.It Xo
1004 +.Sm off
1005 +.Li \&%c
1006 +.Op Oo Li 0 Oc Ar n
1007 +.Sm on
1008 +.No ,
1009 +.Sm off
1010 +.Li \&%.
1011 +.Op Oo Li 0 Oc Ar n
1012 +.Sm on
1013 +.Xc
1014  The trailing component of the current remote working directory, or
1015  .Em n
1016  trailing components if a digit
1017 @@ -1902,21 +2111,28 @@
1018  .Sq 0 ,
1019  the number of skipped components precede the trailing component(s) in
1020  the format
1021 -.Dq /\fI\*[Lt]skipped\*[Gt]\fRtrailing
1022 +.\" ``/<number>trailing''
1023 +.Do
1024 +.Sm off
1025 +.Li / Li \*[Lt] Va number Li \*[Gt]
1026 +.Va trailing
1027 +.Sm on
1028 +.Dc
1029  (for
1030 -.Sq %c )
1031 +.Sq \&%c )
1032  or
1033 -.Dq ...trailing
1034 +.\" ``...trailing''
1035 +.Dq Li \&... Ns Va trailing
1036  (for
1037 -.Sq %. ) .
1038 -.It %M
1039 +.Sq \&%. ) .
1040 +.It Li \&%M
1041  The remote host name.
1042 -.It %m
1043 +.It Li \&%m
1044  The remote host name, up to the first
1045  .Sq \&. .
1046 -.It %n
1047 +.It Li \&%n
1048  The remote user name.
1049 -.It %%
1050 +.It Li \&%%
1051  A single
1052  .Sq % .
1053  .El
1054 @@ -1934,15 +2150,15 @@
1055  Overrides the default operation mode.
1056  Support values are:
1057  .Bl -tag -width "passive"
1058 -.It active
1059 +.It Cm active
1060  active mode
1061  .Tn FTP
1062  only
1063 -.It auto
1064 +.It Cm auto
1065  automatic determination of passive or active (this is the default)
1066 -.It gate
1067 +.It Cm gate
1068  gate-ftp mode
1069 -.It passive
1070 +.It Cm passive
1071  passive mode
1072  .Tn FTP
1073  only
1074 @@ -2028,6 +2244,21 @@
1075  Each entry may have an optional trailing ":port", which restricts
1076  the matching to connections to that port.
1077  .El
1078 +.Sh EXTENDED PASSIVE MODE AND FIREWALLS
1079 +Some firewall configurations do not allow
1080 +.Nm
1081 +to use extended passive mode.
1082 +If you find that even a simple
1083 +.Ic ls
1084 +appears to hang after printing a message such as this:
1085 +.Pp
1086 +.Dl 229 Entering Extended Passive Mode (|||58551|)
1087 +.Pp
1088 +then you will need to disable extended passive mode with
1089 +.Ic epsv4 off .
1090 +See the above section
1091 +.Sx The .netrc File
1092 +for an example of how to make this automatic.
1093  .Sh SEE ALSO
1094  .Xr getservbyname 3 ,
1095  .Xr editrc 5 ,
1096 @@ -2061,7 +2292,9 @@
1097  were implemented in
1098  .Nx 1.3
1099  and later releases
1100 -by Luke Mewburn \*[Lt]lukem@netbsd.org\*[Gt].
1101 +by
1102 +.An Luke Mewburn
1103 +.Aq lukem@NetBSD.org .
1104  .Pp
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
1110 @@ -98,9 +98,40 @@
1111   * SUCH DAMAGE.
1112   */
1113  
1114 -#include "lukemftp.h"
1115 +#include <sys/cdefs.h>
1116 +#ifndef lint
1117 +#if 0
1118 +static char sccsid[] = "@(#)ftp.c      8.6 (Berkeley) 10/27/94";
1119 +#else
1120 +__RCSID("$NetBSD: ftp.c,v 1.120 2002/06/05 10:20:49 lukem Exp $");
1121 +#endif
1122 +#endif /* not lint */
1123  
1124 +#include <sys/types.h>
1125 +#include <sys/stat.h>
1126 +#include <sys/socket.h>
1127 +#include <sys/time.h>
1128 +
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>
1135 +
1136 +#include <ctype.h>
1137 +#include <err.h>
1138 +#include <errno.h>
1139 +#include <netdb.h>
1140 +#include <stdio.h>
1141 +#include <stdlib.h>
1142 +#include <string.h>
1143 +#include <time.h>
1144 +#include <unistd.h>
1145 +#include <stdarg.h>
1146 +#ifndef USE_SELECT
1147 +#include <poll.h>
1148 +#endif
1149  
1150  #include "ftp_var.h"
1151  
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
1155 @@ -1,1055 +0,0 @@
1156 -FTP(1)                      NetBSD Reference Manual                     FTP(1)
1157 -
1158 -N\bNA\bAM\bME\bE
1159 -     f\bft\btp\bp - Internet file transfer program
1160 -
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.]
1167 -
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
1171 -     network site.
1172 -
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.
1176 -
1177 -     Options may be specified at the command line, or to the command inter-
1178 -     preter.
1179 -
1180 -     -\b-4\b4       Forces f\bft\btp\bp to only use IPv4 addresses.
1181 -
1182 -     -\b-6\b6       Forces f\bft\btp\bp to only use IPv6 addresses.
1183 -
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.
1189 -
1190 -     -\b-a\ba       Causes f\bft\btp\bp to bypass normal login procedure, and use an anony-
1191 -              mous login instead.
1192 -
1193 -     -\b-d\bd       Enables debugging.
1194 -
1195 -     -\b-e\be       Disables command line editing.  This is useful for Emacs ange-
1196 -              ftp mode.
1197 -
1198 -     -\b-f\bf       Forces a cache reload for transfers that go through the FTP or
1199 -              HTTP proxies.
1200 -
1201 -     -\b-g\bg       Disables file name globbing.
1202 -
1203 -     -\b-i\bi       Turns off interactive prompting during multiple file transfers.
1204 -
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.
1212 -
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
1215 -              more information.
1216 -
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.
1223 -
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.
1228 -
1229 -     -\b-P\bP _\bp_\bo_\br_\bt  Sets the port number to _\bp_\bo_\br_\bt.
1230 -
1231 -     -\b-r\br _\bw_\ba_\bi_\bt  Retry the connection attempt if it failed, pausing for _\bw_\ba_\bi_\bt sec-
1232 -              onds.
1233 -
1234 -     -\b-R\bR       Restart all non-proxied auto-fetches.
1235 -
1236 -     -\b-t\bt       Enables packet tracing.
1237 -
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.
1242 -
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.
1248 -
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.
1253 -
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.
1256 -
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:
1263 -
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.
1268 -
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.
1272 -
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.
1278 -
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.
1285 -
1286 -     a\bas\bsc\bci\bii\bi       Set the file transfer t\bty\byp\bpe\be to network ASCII.  This is the de-
1287 -                 fault type.
1288 -
1289 -     b\bbe\bel\bll\bl        Arrange that a bell be sounded after each file transfer com-
1290 -                 mand is completed.
1291 -
1292 -     b\bbi\bin\bna\bar\bry\by      Set the file transfer t\bty\byp\bpe\be to support binary image transfer.
1293 -
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-
1296 -                 it.
1297 -
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
1302 -                 lower case.
1303 -
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.
1307 -
1308 -     c\bcd\bdu\bup\bp        Change the remote machine working directory to the parent of
1309 -                 the current remote machine working directory.
1310 -
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.
1314 -
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.
1317 -
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
1326 -                 off.
1327 -
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 `-->'
1333 -
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.
1336 -
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.
1348 -
1349 -     d\bdi\bis\bsc\bco\bon\bnn\bne\bec\bct\bt  A synonym for c\bcl\blo\bos\bse\be.
1350 -
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.
1354 -
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
1360 -                 again.
1361 -
1362 -     e\bex\bxi\bit\bt        A synonym for b\bby\bye\be.
1363 -
1364 -     f\bfe\bea\bat\btu\bur\bre\bes\bs    Display what features the remote server supports (using the
1365 -                 FEAT command).
1366 -
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
1369 -                 per filename.
1370 -
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''.
1374 -
1375 -     f\bft\btp\bp _\bh_\bo_\bs_\bt [_\bp_\bo_\br_\bt]
1376 -                 A synonym for o\bop\bpe\ben\bn.
1377 -
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-
1386 -                 er.
1387 -
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.
1395 -
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).
1409 -
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.
1415 -
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-
1419 -                 mands.
1420 -
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
1424 -                 printed.
1425 -
1426 -     i\bim\bma\bag\bge\be       A synonym for b\bbi\bin\bna\bar\bry\by.
1427 -
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.
1431 -
1432 -     l\ble\bes\bss\bs _\bf_\bi_\bl_\be   A synonym for p\bpa\bag\bge\be.
1433 -
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.
1437 -
1438 -     l\blp\bpw\bwd\bd        Print the working directory on the local machine.
1439 -
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.
1442 -
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 `$'.
1459 -
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.
1462 -
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.
1468 -
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'.
1477 -
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.
1480 -
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-
1486 -                 put.
1487 -
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 ...'.
1493 -
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 ...'.
1499 -
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''.
1503 -
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-
1506 -                 chine.
1507 -
1508 -     m\bmo\bor\bre\be _\bf_\bi_\bl_\be   A synonym for p\bpa\bag\bge\be.
1509 -
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.
1515 -
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.
1518 -
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.
1521 -
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
1527 -                 _\bg_\be_\bt.
1528 -
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.
1531 -
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
1559 -
1560 -                       nmap $1.$2.$3 [$1,$2].[$2,file]
1561 -
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.
1569 -
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.
1585 -
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).
1592 -
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.
1595 -
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.)
1610 -
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.
1614 -
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.
1618 -
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.
1622 -
1623 -     p\bpr\bre\bes\bse\ber\brv\bve\be    Toggle preservation of modification times on retrieved files.
1624 -
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
1629 -                 h\bha\bas\bsh\bh.
1630 -
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.
1636 -
1637 -                 When prompting is on, the following commands are available at
1638 -                 a prompt:
1639 -
1640 -                       a\ba   Answer `yes' to the current file, and automatically
1641 -                           answer `yes' to any remaining files for the current
1642 -                           command.
1643 -
1644 -                       n\bn   Answer `no', and do not transfer the file.
1645 -
1646 -                       p\bp   Answer `yes' to the current file, and turn off
1647 -                           prompt mode (as is ``prompt off'' had been given).
1648 -
1649 -                       q\bq   Terminate the current operation.
1650 -
1651 -                       y\by   Answer `yes', and transfer the file.
1652 -
1653 -                       ?\b?   Display a help message.
1654 -
1655 -                 Any other reponse will answer `yes' to the current file.
1656 -
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.
1674 -
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.
1681 -
1682 -     p\bpw\bwd\bd         Print the name of the current working directory on the remote
1683 -                 machine.
1684 -
1685 -     q\bqu\bui\bit\bt        A synonym for b\bby\bye\be.
1686 -
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
1689 -                 server.
1690 -
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.
1694 -
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.
1699 -
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:
1702 -
1703 -                       SIGUSR1  Increment _\bm_\ba_\bx_\bi_\bm_\bu_\bm by _\bi_\bn_\bc_\br_\be_\bm_\be_\bn_\bt bytes.
1704 -
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.
1707 -
1708 -                 If _\bm_\ba_\bx_\bi_\bm_\bu_\bm is not supplied, the current throttle rates are
1709 -                 displayed.
1710 -
1711 -                 Note: r\bra\bat\bte\be is not yet implemented for ascii mode transfers.
1712 -
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.
1715 -
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.
1718 -
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.
1726 -
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).
1732 -
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.
1735 -
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.
1740 -
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-
1744 -                 to the file.
1745 -
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.
1749 -
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.
1752 -
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-
1756 -                 chine.
1757 -
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.
1768 -
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.
1771 -
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.
1781 -
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:
1786 -
1787 -                       anonpass    Defaults to $FTPANONPASS
1788 -
1789 -                       ftp_proxy   Defaults to $ftp_proxy.
1790 -
1791 -                       http_proxy  Defaults to $http_proxy.
1792 -
1793 -                       no_proxy    Defaults to $no_proxy.
1794 -
1795 -                       pager       Defaults to $PAGER.
1796 -
1797 -                       prompt      Defaults to $FTPPROMPT.
1798 -
1799 -                       rprompt     Defaults to $FTPRPROMPT.
1800 -
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.
1804 -
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.
1807 -
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.
1810 -
1811 -     s\bst\bta\bat\btu\bus\bs      Show the current status of f\bft\btp\bp.
1812 -
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''.
1816 -
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.
1821 -
1822 -     s\bsy\bys\bst\bte\bem\bm      Show the type of operating system running on the remote ma-
1823 -                 chine.
1824 -
1825 -     t\bte\ben\bne\bex\bx       Set the file transfer type to that needed to talk to TENEX
1826 -                 machines.
1827 -
1828 -     t\bth\bhr\bro\bot\btt\btl\ble\be    A synonym for r\bra\bat\bte\be.
1829 -
1830 -     t\btr\bra\bac\bce\be       Toggle packet tracing.
1831 -
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-
1835 -                 work ASCII.
1836 -
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.
1840 -
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.
1843 -
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.
1846 -
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.
1858 -
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.
1864 -
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.
1867 -
1868 -     ?\b? [_\bc_\bo_\bm_\bm_\ba_\bn_\bd]
1869 -                 A synonym for h\bhe\bel\blp\bp.
1870 -
1871 -     Command arguments which have embedded spaces may be quoted with quote `"'
1872 -     marks.
1873 -
1874 -     Commands which toggle settings can take an explicit o\bon\bn or o\bof\bff\bf argument to
1875 -     force the setting appropriately.
1876 -
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
1884 -
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.
1889 -
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.
1894 -
1895 -     The following formats are valid syntax for an auto-fetch element:
1896 -
1897 -     [user@]host:[path][/]
1898 -           ``Classic'' FTP format.
1899 -
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.
1902 -
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.
1907 -
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.
1914 -
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''
1923 -
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.
1927 -
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
1933 -           authenticate.
1934 -
1935 -     file:///path
1936 -           A local URL, copied from _\b/_\bp_\ba_\bt_\bh.
1937 -
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.
1940 -
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.
1945 -
1946 -     Direct HTTP transfers use HTTP 1.1.  Proxied FTP and HTTP transfers use
1947 -     HTTP 1.0.
1948 -
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.
1953 -
1954 -     If WWW or proxy WWW authentication is required, you will be prompted to
1955 -     enter a username and password to authenticate with.
1956 -
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.
1961 -
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
1970 -     requested file.
1971 -
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
1976 -     useful.
1977 -
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.
1981 -
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.
1984 -
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''.
1991 -
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-
1996 -          eration is used.
1997 -
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.
2002 -
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.
2007 -
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.
2014 -
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.
2017 -
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:
2024 -
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.
2032 -
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:
2036 -
2037 -                     default login anonymous password user@site
2038 -
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.
2042 -
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.
2047 -
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.
2055 -
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
2061 -               does not.
2062 -
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.
2070 -
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.
2076 -
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.
2079 -
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.
2084 -
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.
2088 -
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.
2091 -
2092 -     The following formatting sequences are replaced by the given information:
2093 -
2094 -           %/   The current remote working directory.
2095 -
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 `%.').
2102 -
2103 -           %M   The remote host name.
2104 -
2105 -           %m   The remote host name, up to the first `.'.
2106 -
2107 -           %n   The remote user name.
2108 -
2109 -           %%   A single `%'.
2110 -
2111 -E\bEN\bNV\bVI\bIR\bRO\bON\bNM\bME\bEN\bNT\bT
2112 -     f\bft\btp\bp uses the following environment variables.
2113 -
2114 -     FTPANONPASS    Password to send in an anonymous FTP transfer.  Defaults
2115 -                    to ```whoami`@''.
2116 -
2117 -     FTPMODE        Overrides the default operation mode.  Support values are:
2118 -
2119 -                    active   active mode FTP only
2120 -
2121 -                    auto     automatic determination of passive or active
2122 -                             (this is the default)
2123 -
2124 -                    gate     gate-ftp mode
2125 -
2126 -                    passive  passive mode FTP only
2127 -
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.
2130 -
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.
2133 -
2134 -     FTPSERVER      Host to use as gate-ftp server when g\bga\bat\bte\be is enabled.
2135 -
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''.
2139 -
2140 -     HOME           For default location of a _\b._\bn_\be_\bt_\br_\bc file, if one exists.
2141 -
2142 -     NETRC          An alternate location of the _\b._\bn_\be_\bt_\br_\bc file.
2143 -
2144 -     PAGER          Used by various commands to display files.  Defaults to
2145 -                    more(1) if empty or not set.
2146 -
2147 -     SHELL          For default shell.
2148 -
2149 -     ftp_proxy      URL of FTP proxy to use when making FTP URL requests (if
2150 -                    not defined, use the standard FTP protocol).
2151 -
2152 -                    _\bN_\bO_\bT_\bE: this is not used for interactive sessions, only for
2153 -                    command-line fetches.
2154 -
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.
2159 -
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)).
2163 -
2164 -                    _\bN_\bO_\bT_\bE: this is not used for interactive sessions, only for
2165 -                    command-line fetches.
2166 -
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.
2171 -
2172 -S\bSE\bEE\bE A\bAL\bLS\bSO\bO
2173 -     getservbyname(3), editrc(5), services(5), ftpd(8)
2174 -
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.
2178 -
2179 -H\bHI\bIS\bST\bTO\bOR\bRY\bY
2180 -     The f\bft\btp\bp command appeared in 4.2BSD.
2181 -
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>.
2188 -
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).
2192 -
2193 -B\bBU\bUG\bGS\bS
2194 -     Correct execution of many commands depends upon proper behavior by the
2195 -     remote server.
2196 -
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.
2201 -
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.
2209 -
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
2214 @@ -1,7 +1,7 @@
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 $       */
2217  
2218  /*-
2219 - * Copyright (c) 1996-2001 The NetBSD Foundation, Inc.
2220 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
2221   * All rights reserved.
2222   *
2223   * This code is derived from software contributed to The NetBSD Foundation
2224 @@ -111,14 +111,20 @@
2225  #define        NO_PROGRESS
2226  #endif
2227  
2228 +#include <sys/param.h>
2229 +
2230 +#include <netinet/in.h>
2231 +#include <arpa/inet.h>
2232 +
2233 +#include <setjmp.h>
2234 +#include <stringlist.h>
2235 +
2236  #ifndef NO_EDITCOMPLETE
2237  #include <histedit.h>
2238  #endif /* !NO_EDITCOMPLETE */
2239  
2240 -typedef void (*sigfunc)(int);
2241 -
2242  #include "extern.h"
2243 -
2244 +#include "progressbar.h"
2245  
2246  /*
2247   * Format of command table.
2248 @@ -175,7 +181,6 @@
2249  
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" */
2253  
2254  #define        FTP_PORT        21      /* default if ! getservbyname("ftp/tcp") */
2255  #define        HTTP_PORT       80      /* default if ! getservbyname("http/tcp") */
2256 @@ -204,9 +209,7 @@
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 */
2266 @@ -223,7 +226,6 @@
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 */
2274 @@ -252,9 +254,7 @@
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 */
2287  
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 */
2292  
2293  GLOBAL char   *hostname;       /* name of host connected to */
2294  GLOBAL int     unix_server;    /* server is unix, can use binary for ascii */
2295 @@ -287,8 +284,6 @@
2296  GLOBAL char   *outfile;        /* filename to output URLs to */
2297  GLOBAL int     restartautofetch; /* restart auto-fetch */
2298  
2299 -GLOBAL sigjmp_buf toplevel;    /* non-local goto stuff for cmd scanner */
2300 -
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 @@
2305  #endif
2306  
2307  #ifdef NO_LONG_LONG
2308 -# define LLF           "%ld"
2309 -# define LLFP(x)       "%" x "ld"
2310 -# define LLT           long
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)
2315  #else
2316 -#if HAVE_PRINTF_QD
2317 -# define LLF           "%qd"
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)
2324 -#else
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)
2332 -#endif
2333  #endif
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
2337 @@ -1,4 +1,4 @@
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 $    */
2340  
2341  /*-
2342   * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
2343 @@ -98,11 +98,36 @@
2344   * SUCH DAMAGE.
2345   */
2346  
2347 +#include <sys/cdefs.h>
2348 +#ifndef lint
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 */
2352 +
2353 +#ifndef lint
2354 +#if 0
2355 +static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 10/9/94";
2356 +#else
2357 +__RCSID("$NetBSD: main.c,v 1.84 2003/05/14 14:31:00 wiz Exp $");
2358 +#endif
2359 +#endif /* not lint */
2360 +
2361  /*
2362   * FTP User Program -- Command Interface.
2363   */
2364 +#include <sys/types.h>
2365 +#include <sys/socket.h>
2366  
2367 -#include "lukemftp.h"
2368 +#include <err.h>
2369 +#include <errno.h>
2370 +#include <netdb.h>
2371 +#include <paths.h>
2372 +#include <pwd.h>
2373 +#include <stdio.h>
2374 +#include <stdlib.h>
2375 +#include <string.h>
2376 +#include <unistd.h>
2377 +#include <locale.h>
2378  
2379  #define        GLOBAL          /* force GLOBAL decls in ftp_var.h to be declared */
2380  #include "ftp_var.h"
2381 @@ -123,9 +148,7 @@
2382         char *cp, *ep, *anonuser, *anonpass, *upload_path;
2383         int dumbterm, s, len, isupload;
2384  
2385 -#if 0                  /* XXX */
2386         setlocale(LC_ALL, "");
2387 -#endif
2388         setprogname(argv[0]);
2389  
2390         ftpport = "ftp";
2391 @@ -258,7 +281,7 @@
2392                 }
2393         }
2394  
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) {
2397                 switch (ch) {
2398                 case '4':
2399                         family = AF_INET;
2400 @@ -330,6 +353,12 @@
2401                         ftpport = optarg;
2402                         break;
2403  
2404 +               case 'q':
2405 +                       quit_time = strtol(optarg, &ep, 10);
2406 +                       if (quit_time < 1 || *ep != '\0')
2407 +                               errx(1, "bad quit value: %s", optarg);
2408 +                       break;
2409 +
2410                 case 'r':
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);
2419         exit(1);
2420  }
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
2424 @@ -0,0 +1,460 @@
2425 +/*     $NetBSD: progressbar.c,v 1.3 2003/02/28 09:53:49 lukem Exp $    */
2426 +
2427 +/*-
2428 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
2429 + * All rights reserved.
2430 + *
2431 + * This code is derived from software contributed to The NetBSD Foundation
2432 + * by Luke Mewburn.
2433 + *
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.
2437 + *
2438 + * Redistribution and use in source and binary forms, with or without
2439 + * modification, are permitted provided that the following conditions
2440 + * are met:
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.
2453 + *
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.
2465 + */
2466 +
2467 +#include <sys/cdefs.h>
2468 +#ifndef lint
2469 +__RCSID("$NetBSD: progressbar.c,v 1.3 2003/02/28 09:53:49 lukem Exp $");
2470 +#endif /* not lint */
2471 +
2472 +/*
2473 + * FTP User Program -- Misc support routines
2474 + */
2475 +#include <sys/types.h>
2476 +#include <sys/param.h>
2477 +
2478 +#include <err.h>
2479 +#include <errno.h>
2480 +#include <signal.h>
2481 +#include <stdio.h>
2482 +#include <stdlib.h>
2483 +#include <time.h>
2484 +#include <tzfile.h>
2485 +#include <unistd.h>
2486 +
2487 +#include "progressbar.h"
2488 +
2489 +#if !defined(NO_PROGRESS)
2490 +/*
2491 + * return non-zero if we're the current foreground process
2492 + */
2493 +int
2494 +foregroundproc(void)
2495 +{
2496 +       static pid_t pgrp = -1;
2497 +
2498 +       if (pgrp == -1)
2499 +               pgrp = getpgrp();
2500 +
2501 +       return (tcgetpgrp(fileno(ttyout)) == pgrp);
2502 +}
2503 +#endif /* !defined(NO_PROGRESS) */
2504 +
2505 +
2506 +#ifndef        NO_PROGRESS
2507 +static void updateprogressmeter(int);
2508 +
2509 +/*
2510 + * SIGALRM handler to update the progress meter
2511 + */
2512 +static void
2513 +updateprogressmeter(int dummy)
2514 +{
2515 +       int oerrno = errno;
2516 +
2517 +       progressmeter(0);
2518 +       errno = oerrno;
2519 +}
2520 +#endif /* NO_PROGRESS */
2521 +
2522 +
2523 +/*
2524 + * List of order of magnitude prefixes.
2525 + * The last is `P', as 2^64 = 16384 Petabytes
2526 + */
2527 +static const char prefixes[] = " KMGTP";
2528 +
2529 +/*
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
2536 + *   with flag = 0
2537 + * - After the transfer, call with flag = 1
2538 + */
2539 +static struct timeval start;
2540 +static struct timeval lastupdate;
2541 +
2542 +#define        BUFLEFT (sizeof(buf) - len)
2543 +
2544 +void
2545 +progressmeter(int flag)
2546 +{
2547 +       static off_t lastsize;
2548 +       off_t cursize;
2549 +       struct timeval now, wait;
2550 +#ifndef NO_PROGRESS
2551 +       struct timeval td;
2552 +       off_t abbrevsize, bytespersec;
2553 +       double elapsed;
2554 +       int ratio, barlength, i, len, remaining;
2555 +
2556 +                       /*
2557 +                        * Work variables for progress bar.
2558 +                        *
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.
2563 +                        */
2564 +       char            buf[256];       /* workspace for progress bar */
2565 +#define        BAROVERHEAD     43              /* non `*' portion of progress bar */
2566 +                                       /*
2567 +                                        * stars should contain at least
2568 +                                        * sizeof(buf) - BAROVERHEAD entries
2569 +                                        */
2570 +       static const char       stars[] =
2571 +"*****************************************************************************"
2572 +"*****************************************************************************"
2573 +"*****************************************************************************";
2574 +
2575 +#endif
2576 +
2577 +       if (flag == -1) {
2578 +               (void)gettimeofday(&start, NULL);
2579 +               lastupdate = start;
2580 +               lastsize = restart_point;
2581 +       }
2582 +
2583 +       (void)gettimeofday(&now, NULL);
2584 +       cursize = bytes + restart_point;
2585 +       timersub(&now, &lastupdate, &wait);
2586 +       if (cursize > lastsize) {
2587 +               lastupdate = now;
2588 +               lastsize = cursize;
2589 +               wait.tv_sec = 0;
2590 +       } else {
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);
2598 +                       alarmtimer(0);
2599 +                       siglongjmp(toplevel, 1);
2600 +               }
2601 +#endif /* !STANDALONE_PROGRESS */
2602 +       }
2603 +       /*
2604 +        * Always set the handler even if we are not the foreground process.
2605 +        */
2606 +#ifdef STANDALONE_PROGRESS
2607 +       if (progress) {
2608 +#else
2609 +       if (quit_time > 0 || progress) {
2610 +#endif /* !STANDALONE_PROGRESS */
2611 +               if (flag == -1) {
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);
2616 +                       alarmtimer(0);
2617 +               }
2618 +       }
2619 +#ifndef NO_PROGRESS
2620 +       if (!progress)
2621 +               return;
2622 +       len = 0;
2623 +
2624 +       /*
2625 +        * print progress bar only if we are foreground process.
2626 +        */
2627 +       if (! foregroundproc())
2628 +               return;
2629 +
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);
2636 +
2637 +                       /*
2638 +                        * calculate the length of the `*' bar, ensuring that
2639 +                        * the number of stars won't exceed the buffer size 
2640 +                        */
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, "");
2646 +               }
2647 +       }
2648 +
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 ",
2653 +           (LLT)abbrevsize,
2654 +           prefixes[i],
2655 +           i == 0 ? ' ' : 'B');
2656 +
2657 +       timersub(&now, &start, &td);
2658 +       elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
2659 +
2660 +       bytespersec = 0;
2661 +       if (bytes > 0) {
2662 +               bytespersec = bytes;
2663 +               if (elapsed > 0.0)
2664 +                       bytespersec /= elapsed;
2665 +       }
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),
2672 +           prefixes[i]);
2673 +
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 -");
2679 +               } else {
2680 +                       remaining = (int)
2681 +                           ((filesize - restart_point) / (bytes / elapsed) -
2682 +                           elapsed);
2683 +                       if (remaining >= 100 * SECSPERHOUR)
2684 +                               len += snprintf(buf + len, BUFLEFT,
2685 +                                   "   --:-- ETA");
2686 +                       else {
2687 +                               i = remaining / SECSPERHOUR;
2688 +                               if (i)
2689 +                                       len += snprintf(buf + len, BUFLEFT,
2690 +                                           "%2d:", i);
2691 +                               else
2692 +                                       len += snprintf(buf + len, BUFLEFT,
2693 +                                           "   ");
2694 +                               i = remaining % SECSPERHOUR;
2695 +                               len += snprintf(buf + len, BUFLEFT,
2696 +                                   "%02d:%02d ETA", i / 60, i % 60);
2697 +                       }
2698 +               }
2699 +       }
2700 +       if (flag == 1)
2701 +               len += snprintf(buf + len, BUFLEFT, "\n");
2702 +       (void)write(fileno(ttyout), buf, len);
2703 +
2704 +#endif /* !NO_PROGRESS */
2705 +}
2706 +
2707 +#ifndef STANDALONE_PROGRESS
2708 +/*
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.
2715 + */
2716 +void
2717 +ptransfer(int siginfo)
2718 +{
2719 +       struct timeval now, td, wait;
2720 +       double elapsed;
2721 +       off_t bytespersec;
2722 +       int remaining, hh, i, len;
2723 +
2724 +       char buf[256];          /* Work variable for transfer status. */
2725 +
2726 +       if (!verbose && !progress && !siginfo)
2727 +               return;
2728 +
2729 +       (void)gettimeofday(&now, NULL);
2730 +       timersub(&now, &start, &td);
2731 +       elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
2732 +       bytespersec = 0;
2733 +       if (bytes > 0) {
2734 +               bytespersec = bytes;
2735 +               if (elapsed > 0.0)
2736 +                       bytespersec /= elapsed;
2737 +       }
2738 +       len = 0;
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) {
2743 +               int days;
2744 +
2745 +               days = remaining / SECSPERDAY;
2746 +               remaining %= SECSPERDAY;
2747 +               len += snprintf(buf + len, BUFLEFT,
2748 +                   "%d day%s ", days, days == 1 ? "" : "s");
2749 +       }
2750 +       hh = remaining / SECSPERHOUR;
2751 +       remaining %= SECSPERHOUR;
2752 +       if (hh)
2753 +               len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
2754 +       len += snprintf(buf + len, BUFLEFT,
2755 +           "%02d:%02d ", remaining / 60, remaining % 60);
2756 +
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),
2762 +           prefixes[i]);
2763 +
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: ");
2771 +               if (hh)
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)");
2778 +       }
2779 +       len += snprintf(buf + len, BUFLEFT, "\n");
2780 +       (void)write(siginfo ? STDERR_FILENO : fileno(ttyout), buf, len);
2781 +}
2782 +
2783 +/*
2784 + * SIG{INFO,QUIT} handler to print transfer stats if a transfer is in progress
2785 + */
2786 +void
2787 +psummary(int notused)
2788 +{
2789 +       int oerrno = errno;
2790 +
2791 +       if (bytes > 0) {
2792 +               if (fromatty)
2793 +                       write(fileno(ttyout), "\n", 1);
2794 +               ptransfer(1);
2795 +       }
2796 +       errno = oerrno;
2797 +}
2798 +#endif /* !STANDALONE_PROGRESS */
2799 +
2800 +
2801 +/*
2802 + * Set the SIGALRM interval timer for wait seconds, 0 to disable.
2803 + */
2804 +void
2805 +alarmtimer(int wait)
2806 +{
2807 +       struct itimerval itv;
2808 +
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);
2813 +}
2814 +
2815 +
2816 +/*
2817 + * Install a POSIX signal handler, allowing the invoker to set whether
2818 + * the signal should be restartable or not
2819 + */
2820 +sigfunc
2821 +xsignal_restart(int sig, sigfunc func, int restartable)
2822 +{
2823 +       struct sigaction act, oact;
2824 +       act.sa_handler = func;
2825 +
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;
2831 +#else
2832 +#error "system must have SA_RESTART or SA_INTERRUPT"
2833 +#endif
2834 +       if (sigaction(sig, &act, &oact) < 0)
2835 +               return (SIG_ERR);
2836 +       return (oact.sa_handler);
2837 +}
2838 +
2839 +/*
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())
2842 + */
2843 +sigfunc
2844 +xsignal(int sig, sigfunc func)
2845 +{
2846 +       int restartable;
2847 +
2848 +       /*
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.
2856 +        */
2857 +
2858 +       switch(sig) {
2859 +#ifdef SIGINFO
2860 +       case SIGINFO:
2861 +#endif
2862 +       case SIGQUIT:
2863 +       case SIGUSR1:
2864 +       case SIGUSR2:
2865 +       case SIGWINCH:
2866 +               restartable = 1;
2867 +               break;
2868 +
2869 +       case SIGALRM:
2870 +       case SIGINT:
2871 +       case SIGPIPE:
2872 +               restartable = 0;
2873 +               break;
2874 +
2875 +       default:
2876 +               /*
2877 +                * This is unpleasant, but I don't know what would be better.
2878 +                * Right now, this "can't happen"
2879 +                */
2880 +               errx(1, "xsignal_restart called with signal %d", sig);
2881 +       }
2882 +
2883 +       return(xsignal_restart(sig, func, restartable));
2884 +}
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
2888 @@ -0,0 +1,99 @@
2889 +/*     $NetBSD: progressbar.h,v 1.3 2003/02/28 09:53:49 lukem Exp $    */
2890 +
2891 +/*-
2892 + * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
2893 + * All rights reserved.
2894 + *
2895 + * This code is derived from software contributed to The NetBSD Foundation
2896 + * by Luke Mewburn.
2897 + *
2898 + * Redistribution and use in source and binary forms, with or without
2899 + * modification, are permitted provided that the following conditions
2900 + * are met:
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.
2913 + *
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.
2925 + */
2926 +
2927 +#ifndef STANDALONE_PROGRESS
2928 +#include <setjmp.h>
2929 +#endif /* !STANDALONE_PROGRESS */
2930 +
2931 +#ifndef        GLOBAL
2932 +#define        GLOBAL  extern
2933 +#endif
2934 +
2935 +
2936 +#define        STALLTIME       5       /* # of seconds of no xfer before "stalling" */
2937 +
2938 +typedef void (*sigfunc)(int);
2939 +
2940 +
2941 +GLOBAL FILE   *ttyout;         /* stdout, or stderr if retrieving to stdout */
2942 +
2943 +GLOBAL int     progress;       /* display transfer progress bar */
2944 +GLOBAL int     ttywidth;       /* width of tty */
2945 +
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 */
2949 +
2950 +
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 */
2955 +
2956 +GLOBAL char   *direction;      /* direction transfer is occurring */
2957 +
2958 +GLOBAL sigjmp_buf toplevel;    /* non-local goto stuff for cmd scanner */
2959 +#endif /* !STANDALONE_PROGRESS */
2960 +
2961 +int    foregroundproc(void);
2962 +void   alarmtimer(int);
2963 +void   progressmeter(int);
2964 +sigfunc        xsignal(int, sigfunc);
2965 +sigfunc        xsignal_restart(int, sigfunc, int);
2966 +
2967 +#ifndef STANDALONE_PROGRESS
2968 +void   psummary(int);
2969 +void   ptransfer(int);
2970 +#endif /* !STANDALONE_PROGRESS */
2971 +
2972 +
2973 +#ifdef NO_LONG_LONG
2974 +# define LLF           "%ld"
2975 +# define LLFP(x)       "%" x "ld"
2976 +# define LLT           long
2977 +# define ULLF          "%lu"
2978 +# define ULLFP(x)      "%" x "lu"
2979 +# define ULLT          unsigned long
2980 +#else
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
2987 +#endif
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
2991 @@ -33,7 +33,26 @@
2992   * SUCH DAMAGE.
2993   */
2994  
2995 -#include "lukemftp.h"
2996 +#include <sys/cdefs.h>
2997 +#ifndef lint
2998 +#if 0
2999 +static char sccsid[] = "@(#)ruserpass.c        8.4 (Berkeley) 4/27/95";
3000 +#else
3001 +__RCSID("$NetBSD: ruserpass.c,v 1.28 2000/11/15 00:11:04 lukem Exp $");
3002 +#endif
3003 +#endif /* not lint */
3004 +
3005 +#include <sys/types.h>
3006 +#include <sys/stat.h>
3007 +
3008 +#include <ctype.h>
3009 +#include <err.h>
3010 +#include <errno.h>
3011 +#include <netdb.h>
3012 +#include <stdio.h>
3013 +#include <stdlib.h>
3014 +#include <string.h>
3015 +#include <unistd.h>
3016  
3017  #include "ftp_var.h"
3018  
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
3022 @@ -1,7 +1,7 @@
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 $ */
3025  
3026  /*-
3027 - * Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
3028 + * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
3029   * All rights reserved.
3030   *
3031   * This code is derived from software contributed to The NetBSD Foundation
3032 @@ -73,11 +73,36 @@
3033   * SUCH DAMAGE.
3034   */
3035  
3036 +#include <sys/cdefs.h>
3037 +#ifndef lint
3038 +__RCSID("$NetBSD: util.c,v 1.111 2003/02/28 09:54:51 lukem Exp $");
3039 +#endif /* not lint */
3040 +
3041  /*
3042   * FTP User Program -- Misc support routines
3043   */
3044 -
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>
3052 +
3053 +#include <ctype.h>
3054 +#include <err.h>
3055 +#include <errno.h>
3056 +#include <fcntl.h>
3057 +#include <glob.h>
3058 +#include <signal.h>
3059 +#include <limits.h>
3060 +#include <netdb.h>
3061 +#include <stdio.h>
3062 +#include <stdlib.h>
3063 +#include <string.h>
3064 +#include <termios.h>
3065 +#include <time.h>
3066 +#include <tzfile.h>
3067 +#include <unistd.h>
3068  
3069  #include "ftp_var.h"
3070  
3071 @@ -775,303 +800,6 @@
3072         code = ocode;
3073  }
3074  
3075 -#ifndef        NO_PROGRESS
3076 -
3077 -/*
3078 - * return non-zero if we're the current foreground process
3079 - */
3080 -int
3081 -foregroundproc(void)
3082 -{
3083 -       static pid_t pgrp = -1;
3084 -
3085 -       if (pgrp == -1)
3086 -#if GETPGRP_VOID
3087 -               pgrp = getpgrp();
3088 -#else /* ! GETPGRP_VOID */
3089 -               pgrp = getpgrp(0);
3090 -#endif /* ! GETPGRP_VOID */
3091 -
3092 -       return (tcgetpgrp(fileno(ttyout)) == pgrp);
3093 -}
3094 -
3095 -
3096 -static void updateprogressmeter(int);
3097 -
3098 -/*
3099 - * SIGALRM handler to update the progress meter
3100 - */
3101 -static void
3102 -updateprogressmeter(int dummy)
3103 -{
3104 -       int oerrno = errno;
3105 -
3106 -       progressmeter(0);
3107 -       errno = oerrno;
3108 -}
3109 -#endif /* NO_PROGRESS */
3110 -
3111 -
3112 -/*
3113 - * List of order of magnitude prefixes.
3114 - * The last is `P', as 2^64 = 16384 Petabytes
3115 - */
3116 -static const char prefixes[] = " KMGTP";
3117 -
3118 -/*
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
3125 - *   with flag = 0
3126 - * - After the transfer, call with flag = 1
3127 - */
3128 -static struct timeval start;
3129 -static struct timeval lastupdate;
3130 -
3131 -#define        BUFLEFT (sizeof(buf) - len)
3132 -
3133 -void
3134 -progressmeter(int flag)
3135 -{
3136 -       static off_t lastsize;
3137 -#ifndef NO_PROGRESS
3138 -       struct timeval now, td, wait;
3139 -       off_t cursize, abbrevsize, bytespersec;
3140 -       double elapsed;
3141 -       int ratio, barlength, i, len, remaining;
3142 -
3143 -                       /*
3144 -                        * Work variables for progress bar.
3145 -                        *
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.
3150 -                        */
3151 -       char            buf[256];       /* workspace for progress bar */
3152 -#define        BAROVERHEAD     43              /* non `*' portion of progress bar */
3153 -                                       /*
3154 -                                        * stars should contain at least
3155 -                                        * sizeof(buf) - BAROVERHEAD entries
3156 -                                        */
3157 -       const char      stars[] =
3158 -"*****************************************************************************"
3159 -"*****************************************************************************"
3160 -"*****************************************************************************";
3161 -
3162 -#endif
3163 -
3164 -       if (flag == -1) {
3165 -               (void)gettimeofday(&start, NULL);
3166 -               lastupdate = start;
3167 -               lastsize = restart_point;
3168 -       }
3169 -#ifndef NO_PROGRESS
3170 -       if (!progress)
3171 -               return;
3172 -       len = 0;
3173 -
3174 -       /*
3175 -        * print progress bar only if we are foreground process.
3176 -        */
3177 -       if (! foregroundproc())
3178 -               return;
3179 -
3180 -       (void)gettimeofday(&now, NULL);
3181 -       cursize = bytes + restart_point;
3182 -       timersub(&now, &lastupdate, &wait);
3183 -       if (cursize > lastsize) {
3184 -               lastupdate = now;
3185 -               lastsize = cursize;
3186 -               wait.tv_sec = 0;
3187 -       }
3188 -
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);
3195 -
3196 -                       /*
3197 -                        * calculate the length of the `*' bar, ensuring that
3198 -                        * the number of stars won't exceed the buffer size 
3199 -                        */
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, "");
3205 -               }
3206 -       }
3207 -
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 ",
3212 -           (LLT)abbrevsize,
3213 -           prefixes[i],
3214 -           i == 0 ? ' ' : 'B');
3215 -
3216 -       timersub(&now, &start, &td);
3217 -       elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
3218 -
3219 -       bytespersec = 0;
3220 -       if (bytes > 0) {
3221 -               bytespersec = bytes;
3222 -               if (elapsed > 0.0)
3223 -                       bytespersec /= elapsed;
3224 -       }
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),
3231 -           prefixes[i]);
3232 -
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;
3238 -                       if (i)
3239 -                               len += snprintf(buf + len, BUFLEFT, "%2d:", i);
3240 -                       else
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 -");
3247 -               } else {
3248 -                       remaining = (int)
3249 -                           ((filesize - restart_point) / (bytes / elapsed) -
3250 -                           elapsed);
3251 -                       if (remaining >= 100 * SECSPERHOUR)
3252 -                               len += snprintf(buf + len, BUFLEFT,
3253 -                                   "   --:-- ETA");
3254 -                       else {
3255 -                               i = remaining / SECSPERHOUR;
3256 -                               if (i)
3257 -                                       len += snprintf(buf + len, BUFLEFT,
3258 -                                           "%2d:", i);
3259 -                               else
3260 -                                       len += snprintf(buf + len, BUFLEFT,
3261 -                                           "   ");
3262 -                               i = remaining % SECSPERHOUR;
3263 -                               len += snprintf(buf + len, BUFLEFT,
3264 -                                   "%02d:%02d ETA", i / 60, i % 60);
3265 -                       }
3266 -               }
3267 -       }
3268 -       if (flag == 1)
3269 -               len += snprintf(buf + len, BUFLEFT, "\n");
3270 -       (void)write(fileno(ttyout), buf, len);
3271 -
3272 -       if (flag == -1) {
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);
3277 -               alarmtimer(0);
3278 -       }
3279 -#endif /* !NO_PROGRESS */
3280 -}
3281 -
3282 -/*
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.
3289 - */
3290 -void
3291 -ptransfer(int siginfo)
3292 -{
3293 -       struct timeval now, td, wait;
3294 -       double elapsed;
3295 -       off_t bytespersec;
3296 -       int remaining, hh, i, len;
3297 -
3298 -       char buf[256];          /* Work variable for transfer status. */
3299 -
3300 -       if (!verbose && !progress && !siginfo)
3301 -               return;
3302 -
3303 -       (void)gettimeofday(&now, NULL);
3304 -       timersub(&now, &start, &td);
3305 -       elapsed = td.tv_sec + (td.tv_usec / 1000000.0);
3306 -       bytespersec = 0;
3307 -       if (bytes > 0) {
3308 -               bytespersec = bytes;
3309 -               if (elapsed > 0.0)
3310 -                       bytespersec /= elapsed;
3311 -       }
3312 -       len = 0;
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) {
3317 -               int days;
3318 -
3319 -               days = remaining / SECSPERDAY;
3320 -               remaining %= SECSPERDAY;
3321 -               len += snprintf(buf + len, BUFLEFT,
3322 -                   "%d day%s ", days, days == 1 ? "" : "s");
3323 -       }
3324 -       hh = remaining / SECSPERHOUR;
3325 -       remaining %= SECSPERHOUR;
3326 -       if (hh)
3327 -               len += snprintf(buf + len, BUFLEFT, "%2d:", hh);
3328 -       len += snprintf(buf + len, BUFLEFT,
3329 -           "%02d:%02d ", remaining / 60, remaining % 60);
3330 -
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),
3336 -           prefixes[i]);
3337 -
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: ");
3345 -               if (hh)
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)");
3352 -       }
3353 -       len += snprintf(buf + len, BUFLEFT, "\n");
3354 -       (void)write(siginfo ? STDERR_FILENO : fileno(ttyout), buf, len);
3355 -}
3356 -
3357 -/*
3358 - * SIG{INFO,QUIT} handler to print transfer stats if a transfer is in progress
3359 - */
3360 -void
3361 -psummary(int notused)
3362 -{
3363 -       int oerrno = errno;
3364 -
3365 -       if (bytes > 0) {
3366 -               if (fromatty)
3367 -                       write(fileno(ttyout), "\n", 1);
3368 -               ptransfer(1);
3369 -       }
3370 -       errno = oerrno;
3371 -}
3372  
3373  /*
3374   * List words in stringlist, vertically arranged
3375 @@ -1158,20 +886,6 @@
3376  
3377  
3378  /*
3379 - * Set the SIGALRM interval timer for wait seconds, 0 to disable.
3380 - */
3381 -void
3382 -alarmtimer(int wait)
3383 -{
3384 -       struct itimerval itv;
3385 -
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);
3390 -}
3391 -
3392 -/*
3393   * Setup or cleanup EditLine structures
3394   */
3395  #ifndef NO_EDITCOMPLETE
3396 @@ -1552,85 +1266,4 @@
3397         if (s == NULL)
3398                 err(1, "Unable to allocate memory for string copy");
3399         return (s);
3400 -}
3401 -
3402 -/*
3403 - * Install a POSIX signal handler, allowing the invoker to set whether
3404 - * the signal should be restartable or not
3405 - */
3406 -sigfunc
3407 -xsignal_restart(int sig, sigfunc func, int restartable)
3408 -{
3409 -#ifdef ultrix  /* XXX: this is lame - how do we test sigvec vs. sigaction? */
3410 -       struct sigvec vec, ovec;
3411 -
3412 -       vec.sv_handler = func;
3413 -       sigemptyset(&vec.sv_mask);
3414 -       vec.sv_flags = 0;
3415 -       if (sigvec(sig, &vec, &ovec) < 0)
3416 -               return (SIG_ERR);
3417 -       return (ovec.sv_handler);
3418 -#else  /* ! ultrix */
3419 -       struct sigaction act, oact;
3420 -       act.sa_handler = func;
3421 -
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;
3427 -#else
3428 -#error "system must have SA_RESTART or SA_INTERRUPT"
3429 -#endif
3430 -       if (sigaction(sig, &act, &oact) < 0)
3431 -               return (SIG_ERR);
3432 -       return (oact.sa_handler);
3433 -#endif /* ! ultrix */
3434 -}
3435 -
3436 -/*
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())
3439 - */
3440 -sigfunc
3441 -xsignal(int sig, sigfunc func)
3442 -{
3443 -       int restartable;
3444 -
3445 -       /*
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.
3453 -        */
3454 -
3455 -       switch(sig) {
3456 -#ifdef SIGINFO
3457 -       case SIGINFO:
3458 -#endif
3459 -       case SIGQUIT:
3460 -       case SIGUSR1:
3461 -       case SIGUSR2:
3462 -       case SIGWINCH:
3463 -               restartable = 1;
3464 -               break;
3465 -
3466 -       case SIGALRM:
3467 -       case SIGINT:
3468 -       case SIGPIPE:
3469 -               restartable = 0;
3470 -               break;
3471 -
3472 -       default:
3473 -               /*
3474 -                * This is unpleasant, but I don't know what would be better.
3475 -                * Right now, this "can't happen"
3476 -                */
3477 -               errx(1, "xsignal_restart called with signal %d", sig);
3478 -       }
3479 -
3480 -       return(xsignal_restart(sig, func, restartable));
3481  }
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
3485 @@ -1,6 +1,6 @@
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 $       */
3488  /*-
3489 - * Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
3490 + * Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
3491   * All rights reserved.
3492   *
3493   * This code is derived from software contributed to The NetBSD Foundation
3494 @@ -40,5 +40,5 @@
3495  #endif
3496  
3497  #ifndef FTP_VERSION
3498 -#define        FTP_VERSION     "20020605"
3499 +#define        FTP_VERSION     "20030228"
3500  #endif