- (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@
This commit is contained in:
Damien Miller 2008-06-29 22:45:13 +10:00
parent 493f032440
commit f184bcf89e
2 changed files with 15 additions and 8 deletions

View File

@ -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 20080628
- (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec] - (djm) [RFC.nroff contrib/cygwin/Makefile contrib/suse/openssh.spec]
RFC.nroff lacks a license, remove it (it is long gone in OpenBSD). 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 OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ 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 $

14
sftp.c
View File

@ -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> * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
* *
@ -364,7 +364,7 @@ infer_path(const char *p, char **ifp)
static int static int
parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag) 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; int ch;
optind = optreset = 1; optind = optreset = 1;
@ -378,7 +378,7 @@ parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag)
*pflag = 1; *pflag = 1;
break; break;
default: default:
error("%s: Invalid flag -%c", cmd, ch); error("%s: Invalid flag -%c", cmd, optopt);
return -1; return -1;
} }
} }
@ -389,7 +389,7 @@ parse_getput_flags(const char *cmd, char **argv, int argc, int *pflag)
static int static int
parse_ls_flags(char **argv, int argc, int *lflag) parse_ls_flags(char **argv, int argc, int *lflag)
{ {
extern int optind, optreset, opterr; extern int opterr, optind, optopt, optreset;
int ch; int ch;
optind = optreset = 1; optind = optreset = 1;
@ -428,7 +428,7 @@ parse_ls_flags(char **argv, int argc, int *lflag)
*lflag |= LS_TIME_SORT; *lflag |= LS_TIME_SORT;
break; break;
default: default:
error("ls: Invalid flag -%c", ch); error("ls: Invalid flag -%c", optopt);
return -1; return -1;
} }
} }
@ -439,7 +439,7 @@ parse_ls_flags(char **argv, int argc, int *lflag)
static int static int
parse_df_flags(const char *cmd, char **argv, int argc, int *hflag, int *iflag) 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; int ch;
optind = optreset = 1; optind = optreset = 1;
@ -455,7 +455,7 @@ parse_df_flags(const char *cmd, char **argv, int argc, int *hflag, int *iflag)
*iflag = 1; *iflag = 1;
break; break;
default: default:
error("%s: Invalid flag -%c", cmd, ch); error("%s: Invalid flag -%c", cmd, optopt);
return -1; return -1;
} }
} }