summaryrefslogtreecommitdiff
path: root/src/getopt.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
committerPaul Smith <psmith@gnu.org>2023-01-08 18:44:25 -0500
commitb99b6cdf3c18ee96da1775f7300d463fe5fe7ebb (patch)
tree27f48ebdc15c65e5042b39aab130ac2f50a70e3e /src/getopt.c
parent36f955b0e8d2c1b5be292eb84475c44eea6403c8 (diff)
downloadmake-git-b99b6cdf3c18ee96da1775f7300d463fe5fe7ebb.tar.gz
Update support for OS/2
Patches provided by KO Myung-Hun <komh78@gmail.com> * NEWS: Add a note. * AUTHORS: Add a new author. * README.OS2: Updates to build instructions. * src/dir.c (dir_contents_file_exists_p): Use a stack copy when modifying a const string. * src/job.c (construct_command_argv_internal): Ditto. Reuse variables rather than re-defining them. (exec_command): Cast a const string (we don't change it anyway). * src/getopt.c (_getopt_initialize): Reference unused variables. (_getopt_internal): Add block braces to quiet the compiler. * src/main.c (main): Cast argument to child_execute_job(). * src/posixos.c (set_blocking): Reference unused variables. * src/remake.c (f_mtime): Delete useless code.
Diffstat (limited to 'src/getopt.c')
-rw-r--r--src/getopt.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/getopt.c b/src/getopt.c
index bc1f1caf..7a792de8 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -436,6 +436,10 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
nonoption_flags_len = 0;
#endif
+ /* Make the compiler happy. */
+ (void)argc;
+ (void)argv;
+
return optstring;
}
@@ -677,17 +681,18 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
else
{
if (opterr)
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option '--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option '%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
-
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option '--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option '%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
nextchar += strlen (nextchar);
optopt = pfound->val;