diff options
author | pst <pst@FreeBSD.org> | 1994-09-29 20:55:25 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1994-09-29 20:55:25 +0000 |
commit | bc1378c899feed3395ae56bf6006a483d7d9ab92 (patch) | |
tree | 459b9d758e9dc7548e339c1c902cf0bff4a8c962 /usr.bin/ftp/main.c | |
parent | def775d41d9008a9bd6b2b65d1bdbaf8d448a2e7 (diff) | |
download | FreeBSD-src-bc1378c899feed3395ae56bf6006a483d7d9ab92.zip FreeBSD-src-bc1378c899feed3395ae56bf6006a483d7d9ab92.tar.gz |
Add -p flag and pftp alias for passive ftp
Diffstat (limited to 'usr.bin/ftp/main.c')
-rw-r--r-- | usr.bin/ftp/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index 52a95b0..0edff5e 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -58,6 +58,7 @@ static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 4/3/94"; #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <string.h> #include "ftp_var.h" @@ -76,8 +77,14 @@ main(argc, argv) doglob = 1; interactive = 1; autologin = 1; + passivemode = 0; - while ((ch = getopt(argc, argv, "dgintv")) != EOF) { + cp = strrchr(argv[0], '/'); + cp = (cp == NULL) ? argv[0] : cp+1; + if (strcmp(cp, "pftp") == 0) + passivemode = 1; + + while ((ch = getopt(argc, argv, "dginptv")) != EOF) { switch (ch) { case 'd': options |= SO_DEBUG; @@ -96,6 +103,10 @@ main(argc, argv) autologin = 0; break; + case 'p': + passivemode = 1; + break; + case 't': trace++; break; @@ -106,7 +117,7 @@ main(argc, argv) default: (void)fprintf(stderr, - "usage: ftp [-dgintv] [host [port]]\n"); + "usage: ftp [-dginptv] [host [port]]\n"); exit(1); } } @@ -118,7 +129,6 @@ main(argc, argv) verbose++; cpend = 0; /* no pending replies */ proxy = 0; /* proxy not active */ - passivemode = 0;/* passive mode not active */ crflag = 1; /* strip c.r. on ascii gets */ sendport = -1; /* not using ports */ /* |