diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-13 21:28:39 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-13 21:28:39 +0000 |
commit | f84737984a98eb23286c85d77142082c7418b236 (patch) | |
tree | 884b5e617d13d56e95f8af501946f1884d8f8a9a | |
parent | 70df2b71189e4ff3b482b4b7b4620af3397ebb8b (diff) |
Make both ls and dir send a LIST command. Perviously, ls would use
NLST but some ftp server (notably wu-ftpd 2.6.x) only list files
in the output of NLST. This behavior appears to be RFC conforming
and it makes things like "mget *" behave more sanely. To get just
the file list you can still use the "nlist" command.
-rw-r--r-- | usr.bin/ftp/cmds.c | 11 | ||||
-rw-r--r-- | usr.bin/ftp/ftp.1 | 68 |
2 files changed, 35 insertions, 44 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index e03c32c5149..b3f46775d01 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.32 1999/12/08 12:57:06 itojun Exp $ */ +/* $OpenBSD: cmds.c,v 1.33 2000/06/13 21:28:38 millert Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: cmds.c,v 1.32 1999/12/08 12:57:06 itojun Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.33 2000/06/13 21:28:38 millert Exp $"; #endif #endif /* not lint */ @@ -1169,7 +1169,7 @@ ls(argc, argv) code = -1; return; } - cmd = strcmp(argv[0], "dir") == 0 ? "LIST" : "NLST"; + cmd = strcmp(argv[0], "nlist") == 0 ? "NLST" : "LIST"; oldargv2 = argv[2]; if (strcmp(argv[2], "-") && !globulize(&argv[2])) { code = -1; @@ -1202,7 +1202,6 @@ mls(argc, argv) { sig_t oldintr; int ointer, i; - int dolist; char mode[1], *dest, *odest; if (argc < 2 && !another(&argc, &argv, "remote-files")) @@ -1221,15 +1220,13 @@ usage: code = -1; return; } - dolist = strcmp(argv[0], "mls"); mname = argv[0]; mflag = 1; oldintr = signal(SIGINT, mabort); (void)setjmp(jabort); for (i = 1; mflag && i < argc-1; ++i) { *mode = (i == 1) ? 'w' : 'a'; - recvrequest(dolist ? "LIST" : "NLST", dest, argv[i], mode, - 0, 0); + recvrequest("LIST", dest, argv[i], mode, 0, 0); if (!mflag && fromatty) { ointer = interactive; interactive = 1; diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1 index d35d3e5eb78..8d027fd5ed8 100644 --- a/usr.bin/ftp/ftp.1 +++ b/usr.bin/ftp/ftp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ftp.1,v 1.29 2000/03/07 21:11:09 aaron Exp $ +.\" $OpenBSD: ftp.1,v 1.30 2000/06/13 21:28:38 millert Exp $ .\" $NetBSD: ftp.1,v 1.22 1997/08/18 10:20:22 lukem Exp $ .\" .\" Copyright (c) 1985, 1989, 1990, 1993 @@ -288,30 +288,8 @@ prints each command sent to the remote machine, preceded by the string .Ql \-\-> . .It Ic dir Op Ar remote-directory Op Ar local-file -Print a listing of the contents of a -directory on the remote machine. -The listing includes any system-dependent information that the server -chooses to include; for example, most -.Ux -systems will produce -output from the command -.Ql ls \-l . -(See also -.Ic ls . ) -If -.Ar remote-directory -is left unspecified, the current working directory is used. -If interactive prompting is on, -.Nm -will prompt the user to verify that the last argument is indeed the -target local file for receiving -.Ic dir -output. -If no local file is specified, or if -.Ar local-file -is -.Dq - , -the output is sent to the terminal. +A synonym for +.Ic ls . .It Ic disconnect A synonym for .Ic close . @@ -435,8 +413,14 @@ A synonym for .It Ic lpwd Print the working directory on the local machine. .It Ic \&ls Op Ar remote-directory Op Ar local-file -Print a list of the files in a +Print a listing of the contents of a directory on the remote machine. +The listing includes any system-dependent information that the server +chooses to include; for example, most +.Ux +systems will produce +output from the command +.Ql ls \-l . If .Ar remote-directory is left unspecified, the current working directory is used. @@ -495,15 +479,8 @@ Delete the .Ar remote-files on the remote machine. .It Ic mdir Ar remote-files local-file -Like -.Ic dir , -except multiple remote files may be specified. -If interactive prompting is on, -.Nm -will prompt the user to verify that the last argument is indeed the -target local file for receiving -.Ic mdir -output. +A synonym for +.Ic mls . .It Ic mget Ar remote-files Expand the .Ar remote-files @@ -576,8 +553,25 @@ exist on the current system, the remote file is considered Otherwise, this command is identical to .Ar get . .It Ic nlist Op Ar remote-directory Op Ar local-file -A synonym for -.Ic ls . +Print a list of the files in a +directory on the remote machine. +If +.Ar remote-directory +is left unspecified, the current working directory is used. +If interactive prompting is on, +.Nm +will prompt the user to verify that the last argument is indeed the +target local file for receiving +.Ic nlist +output. +If no local file is specified, or if +.Ar local-file +is +.Dq - , +the output is sent to the terminal. Note that on some servers, the +.Ic nlist +command will only return information on normal files (not directories +or special files). .It Ic nmap Op Ar inpattern outpattern Set or unset the filename mapping mechanism. If no arguments are specified, the filename mapping mechanism is unset. |