/* 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);
#endif
}
- if (! (number | show_ends | squeeze_blank))
+ if (! (number || show_ends || squeeze_blank))
{
file_open_mode |= O_BINARY;
if (O_BINARY && ! isatty (STDOUT_FILENO))
/* 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);
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);
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);
}
}
- 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);
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);
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)));
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);
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
}
}
- 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);
/* 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)
static void
process_signals (void)
{
- while (interrupt_signal | info_signal_count)
+ while (interrupt_signal || info_signal_count)
{
int interrupt;
int infos;
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))
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))
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);
error (EXIT_FAILURE, 0, _("input line is too long"));
}
- convert &= convert_entire_line | !! isblank (c);
+ convert &= convert_entire_line || !! isblank (c);
}
if (c < 0)
{
if (nextarg ("&"))
{
- r = eval2 (evaluate & ~ null (l));
+ r = eval2 (evaluate && !null (l));
if (null (l) || null (r))
{
freev (l);
{
if (nextarg ("|"))
{
- r = eval1 (evaluate & null (l));
+ r = eval1 (evaluate && null (l));
if (null (l))
{
freev (l);
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"));
}
/* 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)
/* 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)
static void
process_signals (void)
{
- while (interrupt_signal | stop_signal_count)
+ while (interrupt_signal || stop_signal_count)
{
int sig;
int stops;
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');
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;
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);
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"));
}
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;
od [file] [[+]offset[.][b]]
*/
- if (!modern | traditional)
+ if (!modern || traditional)
{
uintmax_t o1;
uintmax_t o2;
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
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"));
{
if (old_w)
{
- if (parallel_files | explicit_columns)
+ if (parallel_files || explicit_columns)
{
/* activate -W */
truncate_lines = true;
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)
{
/* 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;
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;
if (cols_ready_to_print () <= 0 && !extremities)
break;
- if (double_space & pv)
+ if (double_space && pv)
{
putchar ('\n');
--lines_left_on_page;
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;
output_position);
}
- if (truncate_lines & !parallel_files)
+ if (truncate_lines && !parallel_files)
input_position += number_width;
}
\f
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 ();
{
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;
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";
/* 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
/* Conditionally output the `reference' field. */
- if (auto_reference | input_reference)
+ if (auto_reference || input_reference)
{
fputs (" \"", stdout);
print_field (reference);
fputs ("}{", stdout);
print_field (head);
putchar ('}');
- if (auto_reference | input_reference)
+ if (auto_reference || input_reference)
{
putchar ('{');
print_field (reference);
}
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. */
}
}
- 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);
{
while (ptr < lim && *ptr != tab)
++ptr;
- if (ptr < lim && (eword | echar))
+ if (ptr < lim && (eword || echar))
++ptr;
}
else
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;
if (keylist)
{
diff = keycompare (a, b);
- if (diff | unique | stable)
+ if (diff || unique || stable)
return diff;
}
{
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
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;
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 != ',')
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;
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;
}
/* 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"));
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;
break;
}
}
- if (!match_found & reversed)
+ if (!match_found && reversed)
{
error (0, 0, _("invalid argument %s"), quote (arg - 1));
usage (EXIT_FAILURE);
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. */
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);
{
/* 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
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);
}
prev_blank = blank;
- convert &= convert_entire_line | blank;
+ convert &= convert_entire_line || blank;
}
if (c < 0)
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
`(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;
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;