summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-09-23 10:10:51 +0100
committerPádraig Brady <P@draigBrady.com>2009-09-23 14:33:40 +0100
commita037e838e15c9a698f1634398e0fe2726398d575 (patch)
tree7361ac5f2c3dbd8fc4763e6fa960e6646670dc79 /src/ls.c
parentade8dd2096e1898edefadf2314d4e1ec654adda5 (diff)
downloadcoreutils-a037e838e15c9a698f1634398e0fe2726398d575.tar.xz
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/ls.c')
-rw-r--r--src/ls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ls.c b/src/ls.c
index 28fc3e5a8..1bb6873ed 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -324,7 +324,7 @@ static bool color_symlink_as_referent;
/* mode of appropriate file for colorization */
#define FILE_OR_LINK_MODE(File) \
- ((color_symlink_as_referent & (File)->linkok) \
+ ((color_symlink_as_referent && (File)->linkok) \
? (File)->linkmode : (File)->stat.st_mode)
@@ -1176,7 +1176,7 @@ stophandler (int sig)
static void
process_signals (void)
{
- while (interrupt_signal | stop_signal_count)
+ while (interrupt_signal || stop_signal_count)
{
int sig;
int stops;
@@ -2477,7 +2477,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
DEV_INO_PUSH (dir_stat.st_dev, dir_stat.st_ino);
}
- if (recursive | print_dir_name)
+ if (recursive || print_dir_name)
{
if (!first)
DIRED_PUTCHAR ('\n');
@@ -2885,7 +2885,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode,
f->filetype = symbolic_link;
else if (S_ISDIR (f->stat.st_mode))
{
- if (command_line_arg & !immediate_dirs)
+ if (command_line_arg && !immediate_dirs)
f->filetype = arg_directory;
else
f->filetype = directory;
@@ -3652,7 +3652,7 @@ print_long_format (const struct fileinfo *f)
DIRED_INDENT ();
- if (print_owner | print_group | print_author | print_scontext)
+ if (print_owner || print_group || print_author || print_scontext)
{
DIRED_FPUTS (buf, stdout, p - buf);