diff options
author | Jim Meyering <jim@meyering.net> | 2004-06-01 13:17:08 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-06-01 13:17:08 +0000 |
commit | 70a47639378887eaa828e19ff0cfdaacc3d90684 (patch) | |
tree | 1118d09d2eb90eb09a467d6566abcf1933bff13b | |
parent | a0009d0ec1c5cdc1a122d2133300740e5b528ba9 (diff) | |
download | coreutils-70a47639378887eaa828e19ff0cfdaacc3d90684.tar.xz |
(binary_operator, and, or, main):
Prefer the notation `STREQ (a, b)' over `!strcmp (a, b)'
and `STREQ (a, b)' over `strcmp (a, b) == 0'.
-rw-r--r-- | src/test.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/test.c b/src/test.c index ef2b35f96..ee8351add 100644 --- a/src/test.c +++ b/src/test.c @@ -382,7 +382,7 @@ binary_operator (bool l_is_l) advance (0); op = pos + 1; - if ((op < argc - 2) && (strcmp (argv[op + 1], "-l") == 0)) + if ((op < argc - 2) && STREQ (argv[op + 1], "-l")) { r_is_l = 1; advance (0); @@ -583,14 +583,14 @@ binary_operator (bool l_is_l) if (argv[op][0] == '=' && !argv[op][1]) { - value = (strcmp (argv[pos], argv[pos + 2]) == 0); + value = STREQ (argv[pos], argv[pos + 2]); pos += 3; return (TRUE == value); } - if (strcmp (argv[op], "!=") == 0) + if (STREQ (argv[op], "!=")) { - value = (strcmp (argv[pos], argv[pos + 2]) != 0); + value = !STREQ (argv[pos], argv[pos + 2]); pos += 3; return (TRUE == value); } @@ -789,7 +789,7 @@ and (void) int value; value = term (); - while ((pos < argc) && strcmp (argv[pos], "-a") == 0) + while ((pos < argc) && STREQ (argv[pos], "-a")) { advance (0); value = TRUTH_AND (value, and ()); @@ -809,7 +809,7 @@ or (void) value = and (); - while ((pos < argc) && strcmp (argv[pos], "-o") == 0) + while ((pos < argc) && STREQ (argv[pos], "-o")) { advance (0); value = TRUTH_OR (value, or ()); @@ -1097,7 +1097,7 @@ main (int margc, char **margv) allows "[ --help" and "[ --version" to have the usual GNU behavior, but it requires "test --help" and "test --version" to exit silently with status 1. */ - if (margc < 2 || strcmp (margv[margc - 1], "]") != 0) + if (margc < 2 || !STREQ (margv[margc - 1], "]")) { parse_long_options (margc, margv, PROGRAM_NAME, GNU_PACKAGE, VERSION, usage, AUTHORS, (char const *) NULL); |