diff options
| author | Pádraig Brady <P@draigBrady.com> | 2009-09-23 10:10:51 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2009-09-23 14:33:40 +0100 |
| commit | a037e838e15c9a698f1634398e0fe2726398d575 (patch) | |
| tree | 7361ac5f2c3dbd8fc4763e6fa960e6646670dc79 /src/stty.c | |
| parent | maint: expr: avoid compiler warnings without GMP (diff) | |
| download | coreutils-a037e838e15c9a698f1634398e0fe2726398d575.tar.gz coreutils-a037e838e15c9a698f1634398e0fe2726398d575.zip | |
maint: Use logical rather than bitwise operators on bools
This is because bitwise operators are:
- confusing and inconsistent in a boolean context
- non short circuiting
- brittle in C89 where bool can be an int (so > 1)
Diffstat (limited to 'src/stty.c')
| -rw-r--r-- | src/stty.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/stty.c b/src/stty.c index 2f34fcc0a..254504860 100644 --- a/src/stty.c +++ b/src/stty.c @@ -817,13 +817,13 @@ main (int argc, char **argv) } /* Specifying both -a and -g gets an error. */ - if (verbose_output & recoverable_output) + if (verbose_output && recoverable_output) error (EXIT_FAILURE, 0, _("the options for verbose and stty-readable output styles are\n" "mutually exclusive")); /* Specifying any other arguments with -a or -g gets an error. */ - if (!noargs && (verbose_output | recoverable_output)) + if (!noargs && (verbose_output || recoverable_output)) error (EXIT_FAILURE, 0, _("when specifying an output style, modes may not be set")); @@ -849,7 +849,7 @@ main (int argc, char **argv) if (tcgetattr (STDIN_FILENO, &mode)) error (EXIT_FAILURE, errno, "%s", device_name); - if (verbose_output | recoverable_output | noargs) + if (verbose_output || recoverable_output || noargs) { max_col = screen_columns (); current_col = 0; @@ -883,7 +883,7 @@ main (int argc, char **argv) break; } } - if (!match_found & reversed) + if (!match_found && reversed) { error (0, 0, _("invalid argument %s"), quote (arg - 1)); usage (EXIT_FAILURE); |
