summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/getopt_long.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2023-02-27 07:07:52 +0100
committerDamien Miller <djm@mindrot.org>2023-02-27 07:10:12 +0100
commit01dbeb3084d714bbd001ff9d03b9de542e8cdf58 (patch)
tree50237240ebea54abc66df90c42acf3690e20faf0 /openbsd-compat/getopt_long.c
parentRevert explicit chmods on private keys. (diff)
downloadopenssh-01dbeb3084d714bbd001ff9d03b9de542e8cdf58.tar.xz
openssh-01dbeb3084d714bbd001ff9d03b9de542e8cdf58.zip
avoid clash between for getopt's struct option
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@
Diffstat (limited to '')
-rw-r--r--openbsd-compat/getopt_long.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/openbsd-compat/getopt_long.c b/openbsd-compat/getopt_long.c
index 1a5001f7d..c2863a789 100644
--- a/openbsd-compat/getopt_long.c
+++ b/openbsd-compat/getopt_long.c
@@ -72,6 +72,20 @@
#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 */