From f184bcf89e0925921583f857858871fdf81ce337 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 29 Jun 2008 22:45:13 +1000 Subject: [PATCH] - (djm) OpenBSD CVS Sync - martynas@cvs.openbsd.org 2008/06/21 07:46:46 [sftp.c] use optopt to get invalid flag, instead of return value of getopt, which is always '?'; ok djm@ --- ChangeLog | 9 ++++++++- sftp.c | 14 +++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37d133630..892eb90de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20080629 + - (djm) OpenBSD CVS Sync + - martynas@cvs.openbsd.org 2008/06/21 07:46:46 + [sftp.c] + use optopt to get invalid flag, instead of return value of getopt, + which is always '?'; ok djm@ + 20080628 - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec] RFC.nroff lacks a license, remove it (it is long gone in OpenBSD). @@ -4417,4 +4424,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5024 2008/06/28 06:01:35 djm Exp $ +$Id: ChangeLog,v 1.5025 2008/06/29 12:45:13 djm Exp $ diff --git a/sftp.c b/sftp.c index 9b8bf389c..f361378ee 100644 --- a/sftp.c +++ b/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 * @@ -364,7 +364,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; @@ -378,7 +378,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; } } @@ -389,7 +389,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; @@ -428,7 +428,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; } } @@ -439,7 +439,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; @@ -455,7 +455,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; } }