Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp * Add support for `fget localfile', which reads ...



details:   https://anonhg.NetBSD.org/src/rev/d47de7a904b3
branches:  trunk
changeset: 485573:d47de7a904b3
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon May 01 09:44:53 2000 +0000

description:
* Add support for `fget localfile', which reads a list of filenames to
  retrieve from localfile.  Based on work by Darren Reed.
* Crank version.
* Update copyright dates.

diffstat:

 usr.bin/ftp/cmds.c    |  45 ++++++++++++++++++++++++++++++++++++++++++---
 usr.bin/ftp/cmdtab.c  |   8 +++++---
 usr.bin/ftp/extern.h  |   5 +++--
 usr.bin/ftp/fetch.c   |   6 +++---
 usr.bin/ftp/ftp.1     |   8 ++++++--
 usr.bin/ftp/ftp.c     |   6 +++---
 usr.bin/ftp/ftp_var.h |   4 ++--
 usr.bin/ftp/util.c    |   6 +++---
 usr.bin/ftp/version.h |   4 ++--
 9 files changed, 69 insertions(+), 23 deletions(-)

diffs (258 lines):

diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/cmds.c
--- a/usr.bin/ftp/cmds.c        Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/cmds.c        Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: cmds.c,v 1.83 2000/04/13 08:13:30 lukem Exp $  */
+/*     $NetBSD: cmds.c,v 1.84 2000/05/01 09:44:53 lukem Exp $  */
 
 /*-
- * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -107,7 +107,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmds.c,v 1.83 2000/04/13 08:13:30 lukem Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.84 2000/05/01 09:44:53 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -131,6 +131,7 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <util.h>
 
 #include "ftp_var.h"
 #include "version.h"
@@ -741,6 +742,44 @@
        mflag = 0;
 }
 
+/*
+ * Read list of filenames from a local file and get those
+ */
+void
+fget(argc, argv)
+       int argc;
+       char *argv[];
+{
+       char    *buf, *mode;
+       FILE    *fp;
+
+       if (argc != 2) {
+               fprintf(ttyout, "usage: %s localfile\n", argv[0]);
+               code = -1;
+               return;
+       }
+
+       fp = fopen(argv[1], "r");
+       if (fp == NULL) {
+               fprintf(ttyout, "Cannot open source file %s\n", argv[1]);
+               code = -1;
+               return;
+       }
+
+       argv[0] = "get";
+       mode = restart_point ? "r+w" : "w";
+
+       for (;
+           (buf = fparseln(fp, NULL, NULL, "\0\0\0", 0)) != NULL;
+           free(buf)) {
+               if (buf[0] == '\0')
+                       continue;
+               argv[1] = buf;
+               (void)getit(argc, argv, 0, mode);
+       }
+       fclose(fp);
+}
+
 char *
 onoff(bool)
        int bool;
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/cmdtab.c
--- a/usr.bin/ftp/cmdtab.c      Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/cmdtab.c      Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: cmdtab.c,v 1.34 1999/11/12 02:50:38 lukem Exp $        */
+/*     $NetBSD: cmdtab.c,v 1.35 2000/05/01 09:44:54 lukem Exp $        */
 
 /*-
- * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -74,7 +74,7 @@
 #if 0
 static char sccsid[] = "@(#)cmdtab.c   8.4 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmdtab.c,v 1.34 1999/11/12 02:50:38 lukem Exp $");
+__RCSID("$NetBSD: cmdtab.c,v 1.35 2000/05/01 09:44:54 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -116,6 +116,7 @@
 char   mdeletehelp[] = "delete multiple files";
 char   mdirhelp[] =    "list contents of multiple remote directories";
 char   mgethelp[] =    "get multiple files";
+char   fgethelp[] =    "get files using a localfile as a source of names";
 char   mkdirhelp[] =   "make directory on the remote machine";
 char   mlshelp[] =     "list contents of multiple remote directories";
 char   modehelp[] =    "set file transfer mode";
@@ -197,6 +198,7 @@
        { "edit",       edithelp,       0, 0, 0, CMPL0          setedit },
        { "epsv4",      epsv4help,      0, 0, 0, CMPL0          setepsv4 },
        { "exit",       quithelp,       0, 0, 0, CMPL0          quit },
+       { "fget",       fgethelp,       1, 1, 1, CMPL(l)        fget },
        { "form",       formhelp,       0, 1, 1, CMPL0          setform },
        { "ftp",        connecthelp,    0, 0, 1, CMPL0          setpeer },
        { "gate",       gatehelp,       0, 0, 0, CMPL0          setgate },
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/extern.h
--- a/usr.bin/ftp/extern.h      Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/extern.h      Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: extern.h,v 1.52 2000/01/31 22:01:04 lukem Exp $        */
+/*     $NetBSD: extern.h,v 1.53 2000/05/01 09:44:54 lukem Exp $        */
 
 /*-
- * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -135,6 +135,7 @@
 char   *domap __P((char *));
 void   doproxy __P((int, char **));
 char   *dotrans __P((char *));
+void   fget __P((int, char **));
 int    foregroundproc __P((void));
 void   formatbuf __P((char *, size_t, const char *));
 void   ftpvis __P((char *, size_t, const char *, size_t));
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/fetch.c       Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: fetch.c,v 1.109 2000/04/13 08:17:56 lukem Exp $        */
+/*     $NetBSD: fetch.c,v 1.110 2000/05/01 09:44:54 lukem Exp $        */
 
 /*-
- * Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.109 2000/04/13 08:17:56 lukem Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.110 2000/05/01 09:44:54 lukem Exp $");
 #endif /* not lint */
 
 /*
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/ftp.1
--- a/usr.bin/ftp/ftp.1 Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/ftp.1 Mon May 01 09:44:53 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: ftp.1,v 1.61 1999/12/21 13:00:19 lukem Exp $
+.\"    $NetBSD: ftp.1,v 1.62 2000/05/01 09:44:54 lukem Exp $
 .\"
 .\" Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -68,7 +68,7 @@
 .\"
 .\"    @(#)ftp.1       8.3 (Berkeley) 10/9/94
 .\"
-.Dd December 20, 1999
+.Dd May 1, 2000
 .Dt FTP 1
 .Os
 .Sh NAME
@@ -444,6 +444,10 @@
 .It Ic exit
 A synonym for
 .Ic bye .
+.It Ic fget Ar localfile
+Retrieve the files listed in
+.Ar localfile ,
+which has one line per filename.
 .It Ic form Ar format
 Set the file transfer
 .Ic form
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/ftp.c
--- a/usr.bin/ftp/ftp.c Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/ftp.c Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ftp.c,v 1.93 2000/03/14 16:36:05 itojun Exp $  */
+/*     $NetBSD: ftp.c,v 1.94 2000/05/01 09:44:55 lukem Exp $   */
 
 /*-
- * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -103,7 +103,7 @@
 #if 0
 static char sccsid[] = "@(#)ftp.c      8.6 (Berkeley) 10/27/94";
 #else
-__RCSID("$NetBSD: ftp.c,v 1.93 2000/03/14 16:36:05 itojun Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.94 2000/05/01 09:44:55 lukem Exp $");
 #endif
 #endif /* not lint */
 
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/ftp_var.h
--- a/usr.bin/ftp/ftp_var.h     Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/ftp_var.h     Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ftp_var.h,v 1.52 2000/01/31 22:01:05 lukem Exp $       */
+/*     $NetBSD: ftp_var.h,v 1.53 2000/05/01 09:44:55 lukem Exp $       */
 
 /*-
- * Copyright (c) 1996-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/util.c
--- a/usr.bin/ftp/util.c        Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/util.c        Mon May 01 09:44:53 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: util.c,v 1.93 2000/04/24 05:59:39 itojun Exp $ */
+/*     $NetBSD: util.c,v 1.94 2000/05/01 09:44:55 lukem Exp $  */
 
 /*-
- * Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -75,7 +75,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: util.c,v 1.93 2000/04/24 05:59:39 itojun Exp $");
+__RCSID("$NetBSD: util.c,v 1.94 2000/05/01 09:44:55 lukem Exp $");
 #endif /* not lint */
 
 /*
diff -r 3b9e4fe01f9b -r d47de7a904b3 usr.bin/ftp/version.h
--- a/usr.bin/ftp/version.h     Mon May 01 09:32:59 2000 +0000
+++ b/usr.bin/ftp/version.h     Mon May 01 09:44:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.7 2000/04/13 08:23:52 lukem Exp $        */
+/*     $NetBSD: version.h,v 1.8 2000/05/01 09:44:55 lukem Exp $        */
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,5 +40,5 @@
 #endif
 
 #ifndef FTP_VERSION
-#define        FTP_VERSION     "20000413"
+#define        FTP_VERSION     "20000501"
 #endif



Home | Main Index | Thread Index | Old Index