summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2019-10-23 16:49:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2019-10-23 16:49:00 +0000
commit35b77fe6a5273351fc2e0639a14a19aee2f7cdc1 (patch)
tree589d4c185c29425519d955350aec23e96de169a5
parent46c6fd49da4496173727f259368c4334c95b18eb (diff)
Add new -N name option, so that calling scripts can change the
progname and produce better error messages discussed with aja and jca
-rw-r--r--usr.bin/ftp/ftp.112
-rw-r--r--usr.bin/ftp/main.c25
2 files changed, 24 insertions, 13 deletions
diff --git a/usr.bin/ftp/ftp.1 b/usr.bin/ftp/ftp.1
index ed8d7e0c90f..7f963bfe9db 100644
--- a/usr.bin/ftp/ftp.1
+++ b/usr.bin/ftp/ftp.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ftp.1,v 1.115 2019/05/16 12:44:17 florian Exp $
+.\" $OpenBSD: ftp.1,v 1.116 2019/10/23 16:48:59 deraadt Exp $
.\" $NetBSD: ftp.1,v 1.22 1997/08/18 10:20:22 lukem Exp $
.\"
.\" Copyright (c) 1985, 1989, 1990, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
.\"
-.Dd $Mdocdate: May 16 2019 $
+.Dd $Mdocdate: October 23 2019 $
.Dt FTP 1
.Os
.Sh NAME
@@ -47,6 +47,7 @@
.Op Ar host Op Ar port
.Nm ftp
.Op Fl C
+.Op Fl N Ar name
.Op Fl o Ar output
.Op Fl s Ar srcaddr
.Sm off
@@ -58,6 +59,7 @@
.Nm ftp
.Op Fl C
.Op Fl c Ar cookie
+.Op Fl N Ar name
.Op Fl o Ar output
.Op Fl S Ar ssl_options
.Op Fl s Ar srcaddr
@@ -72,11 +74,13 @@
.Ar ...
.Nm ftp
.Op Fl C
+.Op Fl N Ar name
.Op Fl o Ar output
.Op Fl s Ar srcaddr
.Pf file: Ar
.Nm ftp
.Op Fl C
+.Op Fl N Ar name
.Op Fl o Ar output
.Op Fl s Ar srcaddr
.Ar host : Ns / Ns Ar file Ns Op /
@@ -203,6 +207,10 @@ If no entry exists,
will prompt for the remote machine login name (default is the user
identity on the local machine) and, if necessary, prompt for a password
and an account with which to log in.
+.It Fl N Ar name
+Use this alternative name instead of
+.Nm
+in some error reports.
.It Fl o Ar output
When fetching a single file or URL, save the contents in
.Ar output .
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index 822dab3b382..5f32501f161 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.129 2019/05/16 12:44:18 florian Exp $ */
+/* $OpenBSD: main.c,v 1.130 2019/10/23 16:48:59 deraadt Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -297,7 +297,7 @@ main(volatile int argc, char *argv[])
httpuseragent = NULL;
while ((ch = getopt(argc, argv,
- "46AaCc:dD:Eegik:Mmno:pP:r:S:s:tU:vVw:")) != -1) {
+ "46AaCc:dD:EeN:gik:Mmno:pP:r:S:s:tU:vVw:")) != -1) {
switch (ch) {
case '4':
family = PF_INET;
@@ -310,6 +310,9 @@ main(volatile int argc, char *argv[])
passivemode = 0;
break;
+ case 'N':
+ setprogname(optarg);
+ break;
case 'a':
anonftp = 1;
break;
@@ -943,25 +946,25 @@ usage(void)
"ftp [-46AadEegiMmnptVv] [-D title] [-k seconds] [-P port] "
"[-r seconds]\n"
" [-s srcaddr] [host [port]]\n"
- " ftp [-C] [-o output] [-s srcaddr]\n"
+ " ftp [-C] [-N name] [-o output] [-s srcaddr]\n"
" ftp://[user:password@]host[:port]/file[/] ...\n"
- " ftp [-C] [-c cookie] [-o output] [-S ssl_options] "
+ " ftp [-C] [-c cookie] [-N name] [-o output] [-S ssl_options] "
"[-s srcaddr]\n"
" [-U useragent] [-w seconds] "
"http[s]://[user:password@]host[:port]/file ...\n"
- " ftp [-C] [-o output] [-s srcaddr] file:file ...\n"
- " ftp [-C] [-o output] [-s srcaddr] host:/file[/] ...\n"
+ " ftp [-C] [-N name] [-o output] [-s srcaddr] file:file ...\n"
+ " ftp [-C] [-N name] [-o output] [-s srcaddr] host:/file[/] ...\n"
#else /* !SMALL */
- "ftp [-o output] "
+ "ftp [-N name] [-o output] "
"ftp://[user:password@]host[:port]/file[/] ...\n"
#ifndef NOSSL
- " ftp [-o output] [-S ssl_options] [-w seconds] "
+ " ftp [-N name] [-o output] [-S ssl_options] [-w seconds] "
"http[s]://[user:password@]host[:port]/file ...\n"
#else
- " ftp [-o output] [-w seconds] http://host[:port]/file ...\n"
+ " ftp [-N name] [-o output] [-w seconds] http://host[:port]/file ...\n"
#endif /* NOSSL */
- " ftp [-o output] file:file ...\n"
- " ftp [-o output] host:/file[/] ...\n"
+ " ftp [-N name] [-o output] file:file ...\n"
+ " ftp [-N name] [-o output] host:/file[/] ...\n"
#endif /* !SMALL */
);
exit(1);