summaryrefslogtreecommitdiff
path: root/src/pr.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/pr.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/pr.c')
-rw-r--r--src/pr.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/pr.c b/src/pr.c
index c1a66a970..40c35e400 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;