4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-03-05 22:46:03 +08:00

* newlib/libc/stdlib/getopt.c (getopt_internal): Add missing braces.

This commit is contained in:
Corinna Vinschen 2013-11-13 20:04:18 +00:00
parent 02365c2064
commit 2b2290caba
2 changed files with 20 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2013-11-13 Gregory Pietsch <gpietsch@comcast.net>
* newlib/libc/stdlib/getopt.c (getopt_internal): Add missing braces.
2013-11-13 Freddie Chopin <freddie_chopin@op.pl> 2013-11-13 Freddie Chopin <freddie_chopin@op.pl>
* newlib/libc/include/getopt.h (struct option): name field should be * newlib/libc/include/getopt.h (struct option): name field should be

View File

@ -317,6 +317,7 @@ getopt_internal (int argc, char *const argv[], const char *shortopts,
{ {
/* we have ambiguous options */ /* we have ambiguous options */
if (data->opterr) if (data->opterr)
{
fputs (argv[0], stderr); fputs (argv[0], stderr);
fputs (": option `", stderr); fputs (": option `", stderr);
fputs (argv[data->optind], stderr); fputs (argv[data->optind], stderr);
@ -325,6 +326,7 @@ getopt_internal (int argc, char *const argv[], const char *shortopts,
fputs ("' or `--", stderr); fputs ("' or `--", stderr);
fputs (longopts[optindex].name, stderr); fputs (longopts[optindex].name, stderr);
fputs ("')\n", stderr); fputs ("')\n", stderr);
}
return (data->optopt = '?'); return (data->optopt = '?');
} }
} }
@ -342,10 +344,12 @@ getopt_internal (int argc, char *const argv[], const char *shortopts,
{ {
/* couldn't find option in shortopts */ /* couldn't find option in shortopts */
if (data->opterr) if (data->opterr)
{
fputs (argv[0], stderr); fputs (argv[0], stderr);
fputs (": invalid option -- `-", stderr); fputs (": invalid option -- `-", stderr);
fputc (argv[data->optind][data->optwhere], stderr); fputc (argv[data->optind][data->optwhere], stderr);
fputs ("'\n", stderr); fputs ("'\n", stderr);
}
data->optwhere++; data->optwhere++;
if (argv[data->optind][data->optwhere] == '\0') if (argv[data->optind][data->optwhere] == '\0')
{ {