diff --git a/compat.h b/compat.h index a91172c9..76ef70df 100644 --- a/compat.h +++ b/compat.h @@ -466,11 +466,11 @@ int utf8proc_wctomb(char *, wchar_t); #endif /* getopt.c */ -extern int BSDopterr; -extern int BSDoptind; -extern int BSDoptopt; -extern int BSDoptreset; -extern const char *BSDoptarg; +extern int BSDopterr; +extern int BSDoptind; +extern int BSDoptopt; +extern int BSDoptreset; +extern char *BSDoptarg; int BSDgetopt(int, char *const *, const char *); #define getopt(ac, av, o) BSDgetopt(ac, av, o) #define opterr BSDopterr diff --git a/compat/getopt_long.c b/compat/getopt_long.c index cd00e7e0..3d4df3fc 100644 --- a/compat/getopt_long.c +++ b/compat/getopt_long.c @@ -121,7 +121,7 @@ int opterr = 1; /* if error message should be printed */ int optind = 1; /* index into parent argv vector */ int optopt = '?'; /* character checked for validity */ int optreset; /* reset getopt */ -const char *optarg; /* argument associated with option */ +char *optarg; /* argument associated with option */ #define PRINT_ERROR ((opterr) && (*options != ':')) @@ -134,7 +134,7 @@ const char *optarg; /* argument associated with option */ #define BADARG ((*options == ':') ? (int)':' : (int)'?') #define INORDER (int)1 -#define EMSG "" +#define EMSG (char *)"" static int getopt_internal(int, char * const *, const char *, const struct option *, int *, int); @@ -143,7 +143,7 @@ static int parse_long_options(char * const *, const char *, static int gcd(int, int); static void permute_args(int, int, int, char * const *); -static const char *place = EMSG; /* option letter processing */ +static char *place = EMSG; /* option letter processing */ /* XXX: set optreset to 1 rather than these two */ static int nonopt_start = -1; /* first non option argument (for permute) */ @@ -221,7 +221,7 @@ static int parse_long_options(char * const *nargv, const char *options, const struct option *long_options, int *idx, int short_too) { - const char *current_argv, *has_equal; + char *current_argv, *has_equal; size_t current_argv_len; int i, match;