Skip to content

Commit e54b151

Browse files
committed
changes in the parsing command line options
1 parent c7bfcdb commit e54b151

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/pgut.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ longopts_to_optstring(const struct option opts[], const size_t len)
989989
s = result;
990990
for (i = 0; i < len; i++)
991991
{
992-
if (!isprint(opts[i].val))
992+
if (opts[i].val > 128 || !isprint(opts[i].val))
993993
continue;
994994
*s++ = opts[i].val;
995995
if (opts[i].has_arg != no_argument)
@@ -1053,7 +1053,7 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
10531053
optstring = longopts_to_optstring(longopts, len);
10541054

10551055
/* Assign named options */
1056-
while ((c = getopt_long(argc, argv, optstring, longopts, &optindex)) != -1)
1056+
while ((c = getopt_long(argc>2 ? argc - 1 : argc, argc>2 ? argv + 1: argv, optstring, longopts, &optindex)) != -1)
10571057
{
10581058
opt = option_find(c, options);
10591059
if (opt && opt->allowed < SOURCE_CMDLINE)

0 commit comments

Comments
 (0)