diff options
author | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-21 07:46:47 +0000 |
---|---|---|
committer | Martynas Venckus <martynas@cvs.openbsd.org> | 2008-06-21 07:46:47 +0000 |
commit | 0d378bf6f459984aa2f7ca84f810d5d98e8f8f15 (patch) | |
tree | c4430726bcac8aee79e4a3dd3de6b8f74e178dac /usr.bin | |
parent | bc4d94e5cba9bb3e6350e44ccfc5cf277d84b302 (diff) |
use optopt to get invalid flag, instead of return value of getopt,
which is always '?'; ok djm@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/sftp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/ssh/sftp.c b/usr.bin/ssh/sftp.c index 1602f9b36d9..332903be685 100644 --- a/usr.bin/ssh/sftp.c +++ b/usr.bin/ssh/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.101 2008/06/08 20:15:29 dtucker Exp $ */ +/* $OpenBSD: sftp.c,v 1.102 2008/06/21 07:46:46 martynas Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -343,7 +343,7 @@ infer_path(const char *p, char **ifp) static int parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag) { - extern int optind, optreset, opterr; + extern int opterr, optind, optopt, optreset; int ch; optind = optreset = 1; @@ -357,7 +357,7 @@ parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag) *pflag = 1; break; default: - error("%s: Invalid flag -%c", cmd, ch); + error("%s: Invalid flag -%c", cmd, optopt); return -1; } } @@ -368,7 +368,7 @@ parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag) static int parse_ls_flags(char **argv, int argc, int *lflag) { - extern int optind, optreset, opterr; + extern int opterr, optind, optopt, optreset; int ch; optind = optreset = 1; @@ -407,7 +407,7 @@ parse_ls_flags(char **argv, int argc, int *lflag) *lflag |= LS_TIME_SORT; break; default: - error("ls: Invalid flag -%c", ch); + error("ls: Invalid flag -%c", optopt); return -1; } } @@ -418,7 +418,7 @@ parse_ls_flags(char **argv, int argc, int *lflag) static int parse_df_flags(const char *cmd, char **argv, int argc, int *hflag, int *iflag) { - extern int optind, optreset, opterr; + extern int opterr, optind, optopt, optreset; int ch; optind = optreset = 1; @@ -434,7 +434,7 @@ parse_df_flags(const char *cmd, char **argv, int argc, int *hflag, int *iflag) *iflag = 1; break; default: - error("%s: Invalid flag -%c", cmd, ch); + error("%s: Invalid flag -%c", cmd, optopt); return -1; } } |