summaryrefslogtreecommitdiff
path: root/usr.bin/ftp/main.c
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 /usr.bin/ftp/main.c
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
Diffstat (limited to 'usr.bin/ftp/main.c')
-rw-r--r--usr.bin/ftp/main.c25
1 files changed, 14 insertions, 11 deletions
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);