]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
avoid clash between for getopt's struct option
authorDamien Miller <djm@mindrot.org>
Mon, 27 Feb 2023 06:07:52 +0000 (17:07 +1100)
committerDamien Miller <djm@mindrot.org>
Mon, 27 Feb 2023 06:10:12 +0000 (17:10 +1100)
Since we don't use getopt_long() nothing outside the getopt()
implementation itself uses this structure, so move it into the
source to remove it from visibility and clashes with libc's

ok dtucker@

openbsd-compat/getopt.h
openbsd-compat/getopt_long.c

index 8eb12447ed6433df6dce8d2cc54c51bdfd8d35be..65c8bc7fb60e853e8e2c17bcbe04f565d148699d 100644 (file)
@@ -40,6 +40,7 @@
 #define required_argument  1
 #define optional_argument  2
 
+#if 0
 struct option {
        /* name of long option */
        const char *name;
@@ -58,6 +59,8 @@ int    getopt_long(int, char * const *, const char *,
            const struct option *, int *);
 int     getopt_long_only(int, char * const *, const char *,
            const struct option *, int *);
+#endif
+
 #ifndef _GETOPT_DEFINED_
 #define _GETOPT_DEFINED_
 int     getopt(int, char * const *, const char *);
index 1a5001f7d98a7b96efbaaa0e457f7ea4794b373a..c2863a789f6bb2fd6596a9bac735d551aaae2b61 100644 (file)
 
 #include "log.h"
 
+struct option {
+       /* name of long option */
+       const char *name;
+       /*
+        * one of no_argument, required_argument, and optional_argument:
+        * whether option takes an argument
+        */
+       int has_arg;
+       /* if not NULL, set *flag to val when option found */
+       int *flag;
+       /* if flag not NULL, value to set *flag to; else return value */
+       int val;
+};
+
 int    opterr = 1;             /* if error message should be printed */
 int    optind = 1;             /* index into parent argv vector */
 int    optopt = '?';           /* character checked for validity */