[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] Fix [-Werror=dangling-else] on OS/2
From: |
KO Myung-Hun |
Subject: |
[PATCH 8/8] Fix [-Werror=dangling-else] on OS/2 |
Date: |
Sun, 20 Nov 2022 23:42:57 +0900 |
* src/getopt.c (_getopt_internal): Insert explicit braces.
---
src/getopt.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/getopt.c b/src/getopt.c
index fc7cead4..1535a3d5 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -680,16 +680,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);
--
2.30.0
- [PATCH 0/8] Fix compilation on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 1/8] Update README.OS2, KO Myung-Hun, 2022/11/20
- [PATCH 3/8] Fix assignment of read-only location error on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 4/8] Fix [-Werror=unused-variable] on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 2/8] Define a HAVE___STRCHRNUL macro properly, KO Myung-Hun, 2022/11/20
- [PATCH 5/8] Fix [-Werror=discarded-qualifiers] on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 6/8] Fix [-Werror=incompatible-pointer-types] on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 7/8] Fix [-Werror=shadow] on OS/2, KO Myung-Hun, 2022/11/20
- [PATCH 8/8] Fix [-Werror=dangling-else] on OS/2,
KO Myung-Hun <=