diff options
-rw-r--r-- | usr/src/cmd/iscsiadm/cmdparse.c | 10 | ||||
-rw-r--r-- | usr/src/cmd/isns/isnsadm/cmdparse.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/mpathadm/cmdparse.c | 10 | ||||
-rw-r--r-- | usr/src/common/cmdparse/cmdparse.c | 8 | ||||
-rw-r--r-- | usr/src/head/getopt.h | 16 |
5 files changed, 35 insertions, 18 deletions
diff --git a/usr/src/cmd/iscsiadm/cmdparse.c b/usr/src/cmd/iscsiadm/cmdparse.c index 882ff3c673..b1a2f84692 100644 --- a/usr/src/cmd/iscsiadm/cmdparse.c +++ b/usr/src/cmd/iscsiadm/cmdparse.c @@ -23,6 +23,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ + #include <stdlib.h> #include <stdio.h> #include <sys/types.h> @@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *); static void subUsageObject(uint_t, subcommand_t *, object_t *); static int getObject(char *, object_t **); static int getObjectRules(uint_t, objectRules_t **); -static char *getLongOption(int); +static const char *getLongOption(int); static optionProp_t *getOptions(uint_t, uint_t); static char *getOptionArgDesc(int); extern void seeMan(void); @@ -208,7 +212,7 @@ getOptions(uint_t object, uint_t subcommand) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -319,7 +323,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp) opCmd_t *opCmd = NULL; optionProp_t *options; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (getObjectRules(objp->value, &objRules) != 0) { diff --git a/usr/src/cmd/isns/isnsadm/cmdparse.c b/usr/src/cmd/isns/isnsadm/cmdparse.c index ccad6df26c..7303b347ac 100644 --- a/usr/src/cmd/isns/isnsadm/cmdparse.c +++ b/usr/src/cmd/isns/isnsadm/cmdparse.c @@ -22,6 +22,9 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ #include <stdlib.h> #include <stdio.h> @@ -69,7 +72,7 @@ static int getSubcommandProps(char *, subCommandProps_t **); static char *getExecBasename(char *); static void usage(uint_t); static void subUsage(uint_t, subCommandProps_t *); -static char *getLongOption(int); +static const char *getLongOption(int); static char *getOptionArgDesc(int); /* global data */ @@ -119,7 +122,7 @@ getSubcommandProps(char *subCommand, subCommandProps_t **subCommandProps) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -169,7 +172,7 @@ subUsage(uint_t usageType, subCommandProps_t *subcommand) { int i; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (usageType == GENERAL_USAGE) { (void) printf("%s:\t%s %s [", gettext("Usage"), commandName, diff --git a/usr/src/cmd/mpathadm/cmdparse.c b/usr/src/cmd/mpathadm/cmdparse.c index 9080e1cfdd..c4c2dd744a 100644 --- a/usr/src/cmd/mpathadm/cmdparse.c +++ b/usr/src/cmd/mpathadm/cmdparse.c @@ -22,6 +22,10 @@ * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +/* + * Copyright 2020 Joyent Inc. + */ + #include <stdlib.h> #include <stdio.h> @@ -70,7 +74,7 @@ static void subUsage(uint_t, subcommand_t *); static void subUsageObject(uint_t, subcommand_t *, object_t *); static int getObject(char *, object_t **); static int getObjectRules(uint_t, objectRules_t **); -static char *getLongOption(int); +static const char *getLongOption(int); static optionProp_t *getOptions(uint_t, uint_t); static char *getOptionArgDesc(int); @@ -207,7 +211,7 @@ getOptions(uint_t object, uint_t subcommand) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -317,7 +321,7 @@ subUsageObject(uint_t usageType, subcommand_t *subcommand, object_t *objp) opCmd_t *opCmd = NULL; optionProp_t *options; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (getObjectRules(objp->value, &objRules) != 0) { diff --git a/usr/src/common/cmdparse/cmdparse.c b/usr/src/common/cmdparse/cmdparse.c index 07ad6ed13a..bc55dc8dce 100644 --- a/usr/src/common/cmdparse/cmdparse.c +++ b/usr/src/common/cmdparse/cmdparse.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2020 Joyent Inc. */ #include <stdlib.h> @@ -71,7 +71,7 @@ static int getSubcommandProps(char *, subCommandProps_t **); static char *getExecBasename(char *); static void usage(uint_t); static void subUsage(uint_t, subCommandProps_t *); -static char *getLongOption(int); +static const char *getLongOption(int); static char *getOptionArgDesc(int); /* global data */ @@ -121,7 +121,7 @@ getSubcommandProps(char *subCommand, subCommandProps_t **subCommandProps) * on success, long option name * on failure, NULL */ -static char * +static const char * getLongOption(int shortOption) { struct option *op; @@ -171,7 +171,7 @@ subUsage(uint_t usageType, subCommandProps_t *subcommand) { int i; char *optionArgDesc; - char *longOpt; + const char *longOpt; if (usageType == GENERAL_USAGE) { (void) printf("%s:\t%s %s [", gettext("Usage"), commandName, diff --git a/usr/src/head/getopt.h b/usr/src/head/getopt.h index adf98d096c..2b72c23ddc 100644 --- a/usr/src/head/getopt.h +++ b/usr/src/head/getopt.h @@ -27,6 +27,10 @@ */ /* + * Copyright 2020 Joyent Inc. + */ + +/* * GNU-like getopt_long(), getopt_long_only(). * Solaris-specific getopt_clip(). */ @@ -49,11 +53,13 @@ extern "C" { #define optional_argument 2 struct option { - char *name; /* name of long option */ - int has_arg; /* whether option takes an argument */ - int *flag; /* if not NULL, set *flag to val when option found */ - int val; /* if flag is not NULL, value to set *flag to. */ - /* if flag is NULL, return value */ + const char *name; /* name of long option */ + int has_arg; /* whether option takes an argument */ + int *flag; /* if not NULL, set *flag to val when option */ + /* found */ + int val; /* if flag is not NULL, value to set *flag */ + /* to. */ + /* if flag is NULL, return value */ }; /* |