From: Pádraig Brady Date: Wed, 23 Sep 2009 09:10:51 +0000 (+0100) Subject: maint: Use logical rather than bitwise operators on bools X-Git-Tag: v8.0~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a037e838e15c9a698f1634398e0fe2726398d575;p=platform%2Fupstream%2Fcoreutils.git 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) --- diff --git a/src/cat.c b/src/cat.c index d939681..9008957 100644 --- a/src/cat.c +++ b/src/cat.c @@ -388,7 +388,7 @@ cat ( /* Are line numbers to be written at empty lines (-n)? */ - if (number & !number_nonblank) + if (number && !number_nonblank) { next_line_num (); bpout = stpcpy (bpout, line_num_print); @@ -657,7 +657,7 @@ main (int argc, char **argv) #endif } - if (! (number | show_ends | squeeze_blank)) + if (! (number || show_ends || squeeze_blank)) { file_open_mode |= O_BINARY; if (O_BINARY && ! isatty (STDOUT_FILENO)) @@ -719,8 +719,8 @@ main (int argc, char **argv) /* Select which version of `cat' to use. If any format-oriented options were given use `cat'; otherwise use `simple_cat'. */ - if (! (number | show_ends | show_nonprinting - | show_tabs | squeeze_blank)) + if (! (number || show_ends || show_nonprinting + || show_tabs || squeeze_blank)) { insize = MAX (insize, outsize); inbuf = xmalloc (insize + page_size - 1); diff --git a/src/chcon.c b/src/chcon.c index fb68402..fbfdb4d 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -549,7 +549,7 @@ main (int argc, char **argv) usage (1); } - if (recurse & preserve_root) + if (recurse && preserve_root) { static struct dev_ino dev_ino_buf; root_dev_ino = get_root_dev_ino (&dev_ino_buf); diff --git a/src/chgrp.c b/src/chgrp.c index 71582b5..b9e3f43 100644 --- a/src/chgrp.c +++ b/src/chgrp.c @@ -293,7 +293,7 @@ main (int argc, char **argv) gid = parse_group (group_name); } - if (chopt.recurse & preserve_root) + if (chopt.recurse && preserve_root) { static struct dev_ino dev_ino_buf; chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf); diff --git a/src/chmod.c b/src/chmod.c index e6f2b0b..da35003 100644 --- a/src/chmod.c +++ b/src/chmod.c @@ -279,7 +279,7 @@ process_file (FTS *fts, FTSENT *ent) } } - if (chmod_succeeded & diagnose_surprises) + if (chmod_succeeded && diagnose_surprises) { mode_t naively_expected_mode = mode_adjust (old_mode, S_ISDIR (old_mode) != 0, 0, change, NULL); @@ -523,7 +523,7 @@ main (int argc, char **argv) umask_value = umask (0); } - if (recurse & preserve_root) + if (recurse && preserve_root) { static struct dev_ino dev_ino_buf; root_dev_ino = get_root_dev_ino (&dev_ino_buf); diff --git a/src/chown-core.c b/src/chown-core.c index 705a29b..e7dacf6 100644 --- a/src/chown-core.c +++ b/src/chown-core.c @@ -440,7 +440,7 @@ change_file_owner (FTS *fts, FTSENT *ent, if (chopt->verbosity != V_off) { bool changed = - ((do_chown & ok & symlink_changed) + ((do_chown && ok && symlink_changed) && ! ((uid == (uid_t) -1 || uid == file_stats->st_uid) && (gid == (gid_t) -1 || gid == file_stats->st_gid))); diff --git a/src/chown.c b/src/chown.c index 12df061..4b75986 100644 --- a/src/chown.c +++ b/src/chown.c @@ -317,7 +317,7 @@ main (int argc, char **argv) optind++; } - if (chopt.recurse & preserve_root) + if (chopt.recurse && preserve_root) { static struct dev_ino dev_ino_buf; chopt.root_dev_ino = get_root_dev_ino (&dev_ino_buf); diff --git a/src/copy.c b/src/copy.c index 067b1e7..e3c5c52 100644 --- a/src/copy.c +++ b/src/copy.c @@ -363,11 +363,11 @@ set_owner (const struct cp_options *x, char const *dst_name, int dest_desc, group. Avoid the window by first changing to a restrictive temporary mode if necessary. */ - if (!new_dst && (x->preserve_mode | x->move_mode | x->set_mode)) + if (!new_dst && (x->preserve_mode || x->move_mode || x->set_mode)) { mode_t old_mode = dst_sb->st_mode; mode_t new_mode = - (x->preserve_mode | x->move_mode ? src_sb->st_mode : x->mode); + (x->preserve_mode || x->move_mode ? src_sb->st_mode : x->mode); mode_t restrictive_temp_mode = old_mode & new_mode & S_IRWXU; if ((USE_ACL diff --git a/src/cp.c b/src/cp.c index 4b5934e..f3fc1aa 100644 --- a/src/cp.c +++ b/src/cp.c @@ -1089,7 +1089,7 @@ main (int argc, char **argv) } } - if (x.hard_link & x.symbolic_link) + if (x.hard_link && x.symbolic_link) { error (0, 0, _("cannot make both hard and symbolic links")); usage (EXIT_FAILURE); @@ -1130,7 +1130,7 @@ main (int argc, char **argv) /* If --force (-f) was specified and we're in link-creation mode, first remove any existing destination file. */ - if (x.unlink_dest_after_failed_open & (x.hard_link | x.symbolic_link)) + if (x.unlink_dest_after_failed_open && (x.hard_link || x.symbolic_link)) x.unlink_dest_before_opening = true; if (x.preserve_security_context) diff --git a/src/dd.c b/src/dd.c index 6f5e826..c7fe563 100644 --- a/src/dd.c +++ b/src/dd.c @@ -769,7 +769,7 @@ install_signal_handlers (void) static void process_signals (void) { - while (interrupt_signal | info_signal_count) + while (interrupt_signal || info_signal_count) { int interrupt; int infos; diff --git a/src/df.c b/src/df.c index fd59aea..411e61a 100644 --- a/src/df.c +++ b/src/df.c @@ -332,10 +332,10 @@ show_dev (char const *disk, char const *mount_point, bool negate_used; double pct = -1; - if (me_remote & show_local_fs) + if (me_remote && show_local_fs) return; - if (me_dummy & !show_all_fs & !show_listed_fs) + if (me_dummy && !show_all_fs && !show_listed_fs) return; if (!selected_fstype (fstype) || excluded_fstype (fstype)) @@ -430,7 +430,7 @@ show_dev (char const *disk, char const *mount_point, total = fsu.fsu_blocks; available = fsu.fsu_bavail; negate_available = (fsu.fsu_bavail_top_bit_set - & known_value (available)); + && known_value (available)); available_to_root = fsu.fsu_bfree; if (known_value (total)) diff --git a/src/du.c b/src/du.c index de0cdbd..9831a17 100644 --- a/src/du.c +++ b/src/du.c @@ -843,7 +843,7 @@ main (int argc, char **argv) if (!ok) usage (EXIT_FAILURE); - if (opt_all & opt_summarize_only) + if (opt_all && opt_summarize_only) { error (0, 0, _("cannot both summarize and show all entries")); usage (EXIT_FAILURE); diff --git a/src/expand.c b/src/expand.c index 074f778..afc574b 100644 --- a/src/expand.c +++ b/src/expand.c @@ -344,7 +344,7 @@ expand (void) error (EXIT_FAILURE, 0, _("input line is too long")); } - convert &= convert_entire_line | !! isblank (c); + convert &= convert_entire_line || !! isblank (c); } if (c < 0) diff --git a/src/expr.c b/src/expr.c index 6e72a44..851f728 100644 --- a/src/expr.c +++ b/src/expr.c @@ -925,7 +925,7 @@ eval1 (bool evaluate) { if (nextarg ("&")) { - r = eval2 (evaluate & ~ null (l)); + r = eval2 (evaluate && !null (l)); if (null (l) || null (r)) { freev (l); @@ -956,7 +956,7 @@ eval (bool evaluate) { if (nextarg ("|")) { - r = eval1 (evaluate & null (l)); + r = eval1 (evaluate && null (l)); if (null (l)) { freev (l); diff --git a/src/id.c b/src/id.c index 1016ec3..601e770 100644 --- a/src/id.c +++ b/src/id.c @@ -187,7 +187,7 @@ main (int argc, char **argv) if (just_user + just_group + just_group_list + just_context > 1) error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice")); - if (just_user + just_group + just_group_list == 0 && (use_real | use_name)) + if (just_user + just_group + just_group_list == 0 && (use_real || use_name)) error (EXIT_FAILURE, 0, _("cannot print only names or real IDs in default format")); diff --git a/src/install.c b/src/install.c index 03cb9ed..ca03096 100644 --- a/src/install.c +++ b/src/install.c @@ -563,7 +563,7 @@ main (int argc, char **argv) } /* Check for invalid combinations of arguments. */ - if (dir_arg & strip_files) + if (dir_arg && strip_files) error (EXIT_FAILURE, 0, _("the strip option may not be used when installing a directory")); if (dir_arg && target_directory) diff --git a/src/ls.c b/src/ls.c index 28fc3e5..1bb6873 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); diff --git a/src/md5sum.c b/src/md5sum.c index 06a46bb..e004c5e 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -661,21 +661,21 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (status_only & !do_check) + if (status_only && !do_check) { error (0, 0, _("the --status option is meaningful only when verifying checksums")); usage (EXIT_FAILURE); } - if (warn & !do_check) + if (warn && !do_check) { error (0, 0, _("the --warn option is meaningful only when verifying checksums")); usage (EXIT_FAILURE); } - if (quiet & !do_check) + if (quiet && !do_check) { error (0, 0, _("the --quiet option is meaningful only when verifying checksums")); diff --git a/src/od.c b/src/od.c index 2682857..ef88830 100644 --- a/src/od.c +++ b/src/od.c @@ -878,7 +878,7 @@ open_next_file (void) } while (in_stream == NULL); - if (limit_bytes_to_format & !flag_dump_strings) + if (limit_bytes_to_format && !flag_dump_strings) setvbuf (in_stream, NULL, _IONBF, 0); return ok; @@ -1742,7 +1742,7 @@ it must be one character from [doxn]"), od [file] [[+]offset[.][b]] */ - if (!modern | traditional) + if (!modern || traditional) { uintmax_t o1; uintmax_t o2; diff --git a/src/pathchk.c b/src/pathchk.c index cf7b8eb..a23b53c 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -270,7 +270,7 @@ validate_file_name (char *file, bool check_basic_portability, if (check_extra_portability && ! no_leading_hyphen (file)) return false; - if ((check_basic_portability | check_extra_portability) + if ((check_basic_portability || check_extra_portability) && filelen == 0) { /* Fail, since empty names are not portable. As of diff --git a/src/pr.c b/src/pr.c index c1a66a9..40c35e4 100644 --- a/src/pr.c +++ b/src/pr.c @@ -1095,11 +1095,11 @@ main (int argc, char **argv) if (first_page_number == 0) first_page_number = 1; - if (parallel_files & explicit_columns) + if (parallel_files && explicit_columns) error (EXIT_FAILURE, 0, _("cannot specify number of columns when printing in parallel")); - if (parallel_files & print_across_flag) + if (parallel_files && print_across_flag) error (EXIT_FAILURE, 0, _("cannot specify both printing across and printing in parallel")); @@ -1111,7 +1111,7 @@ main (int argc, char **argv) { if (old_w) { - if (parallel_files | explicit_columns) + if (parallel_files || explicit_columns) { /* activate -W */ truncate_lines = true; @@ -1128,7 +1128,7 @@ main (int argc, char **argv) else if (!use_col_separator) { /* No -S option read */ - if (old_s & (parallel_files | explicit_columns)) + if (old_s && (parallel_files || explicit_columns)) { if (!truncate_lines) { @@ -1415,7 +1415,7 @@ init_funcs (void) /* When numbering lines of parallel files, we enlarge the first column to accomodate the number. Looks better than the Sys V approach. */ - if (parallel_files & numbered_lines) + if (parallel_files && numbered_lines) h_next = h + chars_per_column + number_width; else h_next = h + chars_per_column; @@ -1466,7 +1466,7 @@ init_funcs (void) Doesn't need to be stored unless we intend to balance columns on the last page. */ - if (storing_columns & balance_columns) + if (storing_columns && balance_columns) { p->char_func = store_char; p->print_func = print_stored; @@ -1863,7 +1863,7 @@ print_page (void) if (cols_ready_to_print () <= 0 && !extremities) break; - if (double_space & pv) + if (double_space && pv) { putchar ('\n'); --lines_left_on_page; @@ -1877,9 +1877,9 @@ print_page (void) pad_vertically = pv; - if (pad_vertically & extremities) + if (pad_vertically && extremities) pad_down (lines_left_on_page + lines_per_footer); - else if (keep_FF & print_a_FF) + else if (keep_FF && print_a_FF) { putchar ('\f'); print_a_FF = false; @@ -2069,7 +2069,7 @@ add_line_number (COLUMN *p) output_position); } - if (truncate_lines & !parallel_files) + if (truncate_lines && !parallel_files) input_position += number_width; } @@ -2458,7 +2458,7 @@ read_line (COLUMN *p) if ((c = getc (p->fp)) != '\n') ungetc (c, p->fp); FF_only = true; - if (print_a_header & !storing_columns) + if (print_a_header && !storing_columns) { pad_vertically = true; print_header (); @@ -2486,10 +2486,10 @@ read_line (COLUMN *p) { pad_vertically = true; - if (print_a_header & !storing_columns) + if (print_a_header && !storing_columns) print_header (); - if (parallel_files & align_empty_cols) + if (parallel_files && align_empty_cols) { /* We have to align empty columns at the beginning of a line. */ k = separators_not_printed; diff --git a/src/ptx.c b/src/ptx.c index 49cbe89..4947a0f 100644 --- a/src/ptx.c +++ b/src/ptx.c @@ -455,7 +455,7 @@ initialize_regex (void) if (!*context_regex.string) context_regex.string = NULL; } - else if (gnu_extensions & !input_reference) + else if (gnu_extensions && !input_reference) context_regex.string = "[.?!][]\"')}]*\\($\\|\t\\| \\)[ \t\n]*"; else context_regex.string = "\n"; @@ -1296,7 +1296,7 @@ fix_output_parameters (void) /* If the reference appears to the left of the output line, reserve some space for it right away, including one gap size. */ - if ((auto_reference | input_reference) & !right_reference) + if ((auto_reference || input_reference) && !right_reference) line_width -= reference_max_width + gap_size; /* The output lines, minimally, will contain from left to right a left @@ -1660,7 +1660,7 @@ output_one_roff_line (void) /* Conditionally output the `reference' field. */ - if (auto_reference | input_reference) + if (auto_reference || input_reference) { fputs (" \"", stdout); print_field (reference); @@ -1699,7 +1699,7 @@ output_one_tex_line (void) fputs ("}{", stdout); print_field (head); putchar ('}'); - if (auto_reference | input_reference) + if (auto_reference || input_reference) { putchar ('{'); print_field (reference); @@ -1791,12 +1791,12 @@ output_one_dumb_line (void) } else - if ((auto_reference | input_reference) & right_reference) + if ((auto_reference || input_reference) && right_reference) print_spaces (half_line_width - (keyafter.end - keyafter.start) - (keyafter_truncation ? truncation_string_length : 0)); - if ((auto_reference | input_reference) & right_reference) + if ((auto_reference || input_reference) && right_reference) { /* Output the `reference' field. */ diff --git a/src/rm.c b/src/rm.c index 64e095d..2b62e5b 100644 --- a/src/rm.c +++ b/src/rm.c @@ -325,7 +325,7 @@ main (int argc, char **argv) } } - if (x.recursive & preserve_root) + if (x.recursive && preserve_root) { static struct dev_ino dev_ino_buf; x.root_dev_ino = get_root_dev_ino (&dev_ino_buf); diff --git a/src/sort.c b/src/sort.c index 57ee145..0213fee 100644 --- a/src/sort.c +++ b/src/sort.c @@ -1474,7 +1474,7 @@ limfield (const struct line *line, const struct keyfield *key) { while (ptr < lim && *ptr != tab) ++ptr; - if (ptr < lim && (eword | echar)) + if (ptr < lim && (eword || echar)) ++ptr; } else @@ -2030,7 +2030,7 @@ keycompare (const struct line *a, const struct line *b) if (key->random) diff = compare_random (texta, lena, textb, lenb); - else if (key->numeric | key->general_numeric | key->human_numeric) + else if (key->numeric || key->general_numeric || key->human_numeric) { char savea = *lima, saveb = *limb; @@ -2195,7 +2195,7 @@ compare (const struct line *a, const struct line *b) if (keylist) { diff = keycompare (a, b); - if (diff | unique | stable) + if (diff || unique || stable) return diff; } @@ -3299,7 +3299,7 @@ main (int argc, char **argv) { bool minus_pos_usage = (optind != argc && argv[optind][0] == '-' && ISDIGIT (argv[optind][1])); - obsolete_usage |= minus_pos_usage & ~posixly_correct; + obsolete_usage |= minus_pos_usage && !posixly_correct; if (obsolete_usage) { /* Treat +POS1 [-POS2] as a key if possible; but silently @@ -3308,7 +3308,7 @@ main (int argc, char **argv) s = parse_field_count (optarg + 1, &key->sword, NULL); if (s && *s == '.') s = parse_field_count (s + 1, &key->schar, NULL); - if (! (key->sword | key->schar)) + if (! (key->sword || key->schar)) key->sword = SIZE_MAX; if (! s || *set_ordering (s, key, bl_start)) key = NULL; @@ -3399,7 +3399,7 @@ main (int argc, char **argv) badfieldspec (optarg, N_("character offset is zero")); } } - if (! (key->sword | key->schar)) + if (! (key->sword || key->schar)) key->sword = SIZE_MAX; s = set_ordering (s, key, bl_start); if (*s != ',') @@ -3588,14 +3588,14 @@ main (int argc, char **argv) if (! (key->ignore || key->translate || (key->skipsblanks - | key->reverse - | key->skipeblanks - | key->month - | key->numeric - | key->version - | key->general_numeric - | key->human_numeric - | key->random))) + || key->reverse + || key->skipeblanks + || key->month + || key->numeric + || key->version + || key->general_numeric + || key->human_numeric + || key->random))) { key->ignore = gkey.ignore; key->translate = gkey.translate; @@ -3616,13 +3616,13 @@ main (int argc, char **argv) if (!keylist && (gkey.ignore || gkey.translate || (gkey.skipsblanks - | gkey.skipeblanks - | gkey.month - | gkey.numeric - | gkey.general_numeric - | gkey.human_numeric - | gkey.random - | gkey.version))) + || gkey.skipeblanks + || gkey.month + || gkey.numeric + || gkey.general_numeric + || gkey.human_numeric + || gkey.random + || gkey.version))) { insertkey (&gkey); need_random |= gkey.random; diff --git a/src/stty.c b/src/stty.c index 2f34fcc..2545048 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); diff --git a/src/tail.c b/src/tail.c index 3eb27db..f9f8c39 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1126,7 +1126,7 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval) break; } - if ((!any_input | blocking) && fflush (stdout) != 0) + if ((!any_input || blocking) && fflush (stdout) != 0) error (EXIT_FAILURE, errno, _("write error")); /* If nothing was read, sleep and/or check for dead writers. */ diff --git a/src/test.c b/src/test.c index 2b04e43..27db19d 100644 --- a/src/test.c +++ b/src/test.c @@ -318,7 +318,7 @@ binary_operator (bool l_is_l) struct timespec lt, rt; bool le, re; pos += 3; - if (l_is_l | r_is_l) + if (l_is_l || r_is_l) test_syntax_error (_("-nt does not accept -l"), NULL); le = get_mtime (argv[op - 1], <); re = get_mtime (argv[op + 1], &rt); @@ -331,7 +331,7 @@ binary_operator (bool l_is_l) { /* ef - hard link? */ pos += 3; - if (l_is_l | r_is_l) + if (l_is_l || r_is_l) test_syntax_error (_("-ef does not accept -l"), NULL); return (stat (argv[op - 1], &stat_buf) == 0 && stat (argv[op + 1], &stat_spare) == 0 @@ -347,7 +347,7 @@ binary_operator (bool l_is_l) struct timespec lt, rt; bool le, re; pos += 3; - if (l_is_l | r_is_l) + if (l_is_l || r_is_l) test_syntax_error (_("-ot does not accept -l"), NULL); le = get_mtime (argv[op - 1], <); re = get_mtime (argv[op + 1], &rt); diff --git a/src/unexpand.c b/src/unexpand.c index ff969ee..cfbc46b 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -429,7 +429,7 @@ unexpand (void) } prev_blank = blank; - convert &= convert_entire_line | blank; + convert &= convert_entire_line || blank; } if (c < 0) diff --git a/src/wc.c b/src/wc.c index 15a723a..52e899e 100644 --- a/src/wc.c +++ b/src/wc.c @@ -205,10 +205,10 @@ wc (int fd, char const *file_x, struct fstatus *fstatus) else #endif { - count_bytes = print_bytes | print_chars; + count_bytes = print_bytes || print_chars; count_chars = false; } - count_complicated = print_words | print_linelength; + count_complicated = print_words || print_linelength; /* When counting only bytes, save some line- and word-counting overhead. If FD is a `regular' Unix file, using lseek is enough @@ -220,7 +220,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus) `(dd ibs=99k skip=1 count=0; ./wc -c) < /etc/group' should make wc report `0' bytes. */ - if (count_bytes & !count_chars & !print_lines & !count_complicated) + if (count_bytes && !count_chars && !print_lines && !count_complicated) { off_t current_pos, end_pos; @@ -637,8 +637,8 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (! (print_lines | print_words | print_chars | print_bytes - | print_linelength)) + if (! (print_lines || print_words || print_chars || print_bytes + || print_linelength)) print_lines = print_words = print_bytes = true; bool read_tokens = false;