* mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.
Keep track of optional argumnts and fix up optind afterwards. * mkpasswd.c (main): Ditto.
This commit is contained in:
parent
c7aa4aec42
commit
01dd3162ff
@ -1,3 +1,9 @@
|
|||||||
|
2008-08-18 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.
|
||||||
|
Keep track of optional argumnts and fix up optind afterwards.
|
||||||
|
* mkpasswd.c (main): Ditto.
|
||||||
|
|
||||||
2008-08-17 Christopher Faylor <me+cygwin@cgf.cx>
|
2008-08-17 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* cygcheck.cc (print_version): Update copyright dates.
|
* cygcheck.cc (print_version): Update copyright dates.
|
||||||
|
@ -744,6 +744,7 @@ main (int argc, char **argv)
|
|||||||
int c, i;
|
int c, i;
|
||||||
char *disp_groupname = NULL;
|
char *disp_groupname = NULL;
|
||||||
BOOL in_domain;
|
BOOL in_domain;
|
||||||
|
int optional_args = 0;
|
||||||
|
|
||||||
if (!isatty (1))
|
if (!isatty (1))
|
||||||
setmode (1, O_BINARY);
|
setmode (1, O_BINARY);
|
||||||
@ -768,6 +769,7 @@ main (int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */
|
||||||
while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -784,6 +786,8 @@ main (int argc, char **argv)
|
|||||||
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
||||||
opt = optarg ?:
|
opt = optarg ?:
|
||||||
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
||||||
|
if (opt == argv[optind])
|
||||||
|
++optional_args;
|
||||||
for (i = 0; i < print_domlist; ++i)
|
for (i = 0; i < print_domlist; ++i)
|
||||||
if (domlist[i].domain == domlist[print_domlist].domain
|
if (domlist[i].domain == domlist[print_domlist].domain
|
||||||
&& ((!domlist[i].str && !opt)
|
&& ((!domlist[i].str && !opt)
|
||||||
@ -864,6 +868,7 @@ skip:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optind += optional_args;
|
||||||
if (argv[optind])
|
if (argv[optind])
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
@ -719,6 +719,7 @@ main (int argc, char **argv)
|
|||||||
char *disp_username = NULL;
|
char *disp_username = NULL;
|
||||||
char passed_home_path[PATH_MAX];
|
char passed_home_path[PATH_MAX];
|
||||||
BOOL in_domain;
|
BOOL in_domain;
|
||||||
|
int optional_args = 0;
|
||||||
|
|
||||||
passed_home_path[0] = '\0';
|
passed_home_path[0] = '\0';
|
||||||
if (!isatty (1))
|
if (!isatty (1))
|
||||||
@ -740,6 +741,7 @@ main (int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */
|
||||||
while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -756,6 +758,8 @@ main (int argc, char **argv)
|
|||||||
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
domlist[print_domlist].domain = (c == 'd' || c == 'D');
|
||||||
opt = optarg ?:
|
opt = optarg ?:
|
||||||
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
|
||||||
|
if (opt == argv[optind])
|
||||||
|
++optional_args;
|
||||||
for (i = 0; i < print_domlist; ++i)
|
for (i = 0; i < print_domlist; ++i)
|
||||||
if (domlist[i].domain == domlist[print_domlist].domain
|
if (domlist[i].domain == domlist[print_domlist].domain
|
||||||
&& ((!domlist[i].str && !opt)
|
&& ((!domlist[i].str && !opt)
|
||||||
@ -852,6 +856,7 @@ skip:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optind += optional_args;
|
||||||
if (argv[optind])
|
if (argv[optind])
|
||||||
{
|
{
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
Loading…
Reference in New Issue
Block a user