Bugzilla – Attachment 2259 Details for
Bug 1448
Report wrong command-line options
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
apply portability changes to getopt_long.c switch over to it and remove getopt.c
getopt3.patch (text/plain), 8.55 KB, created by
Darren Tucker
on 2013-05-10 16:11:10 AEST
(
hide
)
Description:
apply portability changes to getopt_long.c switch over to it and remove getopt.c
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2013-05-10 16:11:10 AEST
Size:
8.55 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >RCS file: /var/cvs/openssh/ChangeLog,v >retrieving revision 1.6315 >diff -u -p -r1.6315 ChangeLog >--- ChangeLog 10 May 2013 05:38:11 -0000 1.6315 >+++ ChangeLog 10 May 2013 06:07:21 -0000 >@@ -5,6 +5,10 @@ > getopt.c. Preprocessed source is identical other than line numbers. > - (dtucker) [openbsd-compat/getopt_long.c] Import from OpenBSD. No > portability changes yet. >+ - (dtucker) [openbsd-compat/Makefile.in openbsd-compat/getopt.c >+ openbsd-compat/getopt_long.c regress/modpipe.c] Remove getopt.c, add >+ portability code to getopt_long.c and switch over Makefile and the ugly >+ hack in modpipe.c > > 20130423 > - (djm) [auth.c configure.ac misc.c monitor.c monitor_wrap.c] Support >Index: openbsd-compat/Makefile.in >=================================================================== >RCS file: /var/cvs/openssh/openbsd-compat/Makefile.in,v >retrieving revision 1.50 >diff -u -p -r1.50 Makefile.in >--- openbsd-compat/Makefile.in 15 Feb 2013 01:13:02 -0000 1.50 >+++ openbsd-compat/Makefile.in 10 May 2013 06:07:21 -0000 >@@ -16,7 +16,7 @@ RANLIB=@RANLIB@ > INSTALL=@INSTALL@ > LDFLAGS=-L. @LDFLAGS@ > >-OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o >+OPENBSD=base64.o basename.o bindresvport.o daemon.o dirname.o fmt_scaled.o getcwd.o getgrouplist.o getopt_long.o getrrsetbyname.o glob.o inet_aton.o inet_ntoa.o inet_ntop.o mktemp.o pwcache.o readpassphrase.o realpath.o rresvport.o setenv.o setproctitle.o sha2.o sigact.o strlcat.o strlcpy.o strmode.o strnlen.o strptime.o strsep.o strtonum.o strtoll.o strtoul.o strtoull.o timingsafe_bcmp.o vis.o > > COMPAT=bsd-arc4random.o bsd-asprintf.o bsd-closefrom.o bsd-cray.o bsd-cygwin_util.o bsd-getpeereid.o getrrsetbyname-ldns.o bsd-misc.o bsd-nextstep.o bsd-openpty.o bsd-poll.o bsd-setres_id.o bsd-snprintf.o bsd-statvfs.o bsd-waitpid.o fake-rfc2553.o openssl-compat.o xmmap.o xcrypt.o > >Index: openbsd-compat/getopt.c >=================================================================== >RCS file: openbsd-compat/getopt.c >diff -N openbsd-compat/getopt.c >--- openbsd-compat/getopt.c 10 May 2013 05:35:27 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,131 +0,0 @@ >-/* >- * Copyright (c) 1987, 1993, 1994 >- * The Regents of the University of California. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * 3. Neither the name of the University nor the names of its contributors >- * may be used to endorse or promote products derived from this software >- * without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND >- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE >- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >- * SUCH DAMAGE. >- */ >- >-/* OPENBSD ORIGINAL: lib/libc/stdlib/getopt.c */ >- >-#include "includes.h" >-#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET) >- >-/* some defines to make it easier to keep the code in sync with upstream */ >-/* #define getopt BSDgetopt is in defines.h */ >-#define opterr BSDopterr >-#define optind BSDoptind >-#define optopt BSDoptopt >-#define optreset BSDoptreset >-#define optarg BSDoptarg >- >-#if defined(LIBC_SCCS) && !defined(lint) >-static char *rcsid = "$OpenBSD: getopt.c,v 1.5 2003/06/02 20:18:37 millert Exp $"; >-#endif /* LIBC_SCCS and not lint */ >- >-#include <stdio.h> >-#include <stdlib.h> >-#include <string.h> >- >-int opterr = 1, /* if error message should be printed */ >- optind = 1, /* index into parent argv vector */ >- optopt, /* character checked for validity */ >- optreset; /* reset getopt */ >-char *optarg; /* argument associated with option */ >- >-#define BADCH (int)'?' >-#define BADARG (int)':' >-#define EMSG "" >- >-/* >- * getopt -- >- * Parse argc/argv argument vector. >- */ >-int >-getopt(nargc, nargv, ostr) >- int nargc; >- char * const *nargv; >- const char *ostr; >-{ >- extern char *__progname; >- static char *place = EMSG; /* option letter processing */ >- char *oli; /* option letter list index */ >- >- if (ostr == NULL) >- return (-1); >- >- if (optreset || !*place) { /* update scanning pointer */ >- optreset = 0; >- if (optind >= nargc || *(place = nargv[optind]) != '-') { >- place = EMSG; >- return (-1); >- } >- if (place[1] && *++place == '-') { /* found "--" */ >- ++optind; >- place = EMSG; >- return (-1); >- } >- } /* option letter okay? */ >- if ((optopt = (int)*place++) == (int)':' || >- !(oli = strchr(ostr, optopt))) { >- /* >- * if the user didn't specify '-' as an option, >- * assume it means -1. >- */ >- if (optopt == (int)'-') >- return (-1); >- if (!*place) >- ++optind; >- if (opterr && *ostr != ':') >- (void)fprintf(stderr, >- "%s: illegal option -- %c\n", __progname, optopt); >- return (BADCH); >- } >- if (*++oli != ':') { /* don't need argument */ >- optarg = NULL; >- if (!*place) >- ++optind; >- } >- else { /* need an argument */ >- if (*place) /* no white space */ >- optarg = place; >- else if (nargc <= ++optind) { /* no arg */ >- place = EMSG; >- if (*ostr == ':') >- return (BADARG); >- if (opterr) >- (void)fprintf(stderr, >- "%s: option requires an argument -- %c\n", >- __progname, optopt); >- return (BADCH); >- } >- else /* white space */ >- optarg = nargv[optind]; >- place = EMSG; >- ++optind; >- } >- return (optopt); /* dump back option letter */ >-} >- >-#endif /* !defined(HAVE_GETOPT) || !defined(HAVE_OPTRESET) */ >Index: openbsd-compat/getopt_long.c >=================================================================== >RCS file: /var/cvs/openssh/openbsd-compat/getopt_long.c,v >retrieving revision 1.1 >diff -u -p -r1.1 getopt_long.c >--- openbsd-compat/getopt_long.c 10 May 2013 05:38:12 -0000 1.1 >+++ openbsd-compat/getopt_long.c 10 May 2013 06:07:21 -0000 >@@ -49,7 +49,22 @@ > * POSSIBILITY OF SUCH DAMAGE. > */ > >+/* OPENBSD ORIGINAL: lib/libc/stdlib/getopt_long.c */ >+#include "includes.h" >+ >+#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET) >+#include "log.h" >+ >+/* >+ * Some defines to make it easier to keep the code in sync with upstream. >+ * getopt opterr optind optopt optreset optarg are all in defines.h which is >+ * pulled in by includes.h. >+ */ >+#define warnx logit >+ >+#if 0 > #include <err.h> >+#endif > #include <errno.h> > #include <getopt.h> > #include <stdlib.h> >@@ -484,6 +499,7 @@ getopt(int nargc, char * const *nargv, c > return (getopt_internal(nargc, nargv, options, NULL, NULL, 0)); > } > >+#if 0 > /* > * getopt_long -- > * Parse argc/argv argument vector. >@@ -509,3 +525,6 @@ getopt_long_only(int nargc, char * const > return (getopt_internal(nargc, nargv, options, long_options, idx, > FLAG_PERMUTE|FLAG_LONGONLY)); > } >+#endif >+ >+#endif /* !defined(HAVE_GETOPT) || !defined(HAVE_OPTRESET) */ >Index: regress/modpipe.c >=================================================================== >RCS file: /var/cvs/openssh/regress/modpipe.c,v >retrieving revision 1.6 >diff -u -p -r1.6 modpipe.c >--- regress/modpipe.c 4 Mar 2013 22:49:03 -0000 1.6 >+++ regress/modpipe.c 10 May 2013 06:07:21 -0000 >@@ -25,7 +25,7 @@ > #include <stdarg.h> > #include <stdlib.h> > #include <errno.h> >-#include "openbsd-compat/getopt.c" >+#include "openbsd-compat/getopt_long.c" > > static void err(int, const char *, ...) __attribute__((format(printf, 2, 3))); > static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1448
:
2257
|
2258
| 2259