Skip to content

Commit 84358f6

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/pgut.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,14 +1046,16 @@ pgut_getopt(int argc, char **argv, pgut_option options[])
10461046
struct option *longopts;
10471047
size_t len;
10481048

1049+
10491050
len = option_length(options);
10501051
longopts = pgut_newarray(struct option, len + 1);
10511052
option_copy(longopts, options, len);
10521053

10531054
optstring = longopts_to_optstring(longopts, len);
10541055

10551056
/* Assign named options */
1056-
while ((c = getopt_long(argc>2 ? argc - 1 : argc, argc>2 ? argv + 1: argv, optstring, longopts, &optindex)) != -1)
1057+
optind = 2;
1058+
while ((c = getopt_long(argc, argv, optstring, longopts, &optindex)) != -1)
10571059
{
10581060
opt = option_find(c, options);
10591061
if (opt && opt->allowed < SOURCE_CMDLINE)

0 commit comments

Comments
 (0)