maint: with split lines, don't leave an operator at end of line

* src/copy.c (copy_reg): Split an expression before a binary operator,
not after it.
* src/cut.c (set_fields): Likewise.
* src/id.c (main): Likewise.
* src/install.c (setdefaultfilecon): Likewise.
* src/join.c (ignore_case): Likewise.
* src/pr.c (cols_ready_to_print, init_parameters, print_page): Likewise.
* src/stty.c (set_window_size): Likewise.
* src/wc.c (SUPPORT_OLD_MBRTOWC): Likewise.
* src/who.c (scan_entries): Likewise.
* src/test.c (binary_operator): Join a split line.
* src/extent-scan.c (extent_scan_read): Move an ">" from end of line
to beginning of the following.
Likewise for two other expressions.
This commit is contained in:
Jim Meyering committed 2012-05-02 10:31:47 +02:00
1 parent a18ba2f10a
commit b8a6996e25
11 files changed
+34 -34

No files matched your search

+2 -2
View File
@@ -1055,8 +1055,8 @@ copy_reg (char const *src_name, char const *dst_name,
make_holes, src_name, dst_name,
UINTMAX_MAX, &n_read,
&wrote_hole_at_eof)
|| (wrote_hole_at_eof &&
ftruncate (dest_desc, n_read) < 0))
|| (wrote_hole_at_eof
&& ftruncate (dest_desc, n_read) < 0))
{
error (0, errno, _("failed to extend %s"), quote (dst_name));
return_val = false;
+2 -2
View File
@@ -372,8 +372,8 @@ set_fields (const char *fieldstr)
initial = (lhs_specified ? value : 1);
value = 0;
}
else if (*fieldstr == ',' ||
isblank (to_uchar (*fieldstr)) || *fieldstr == '\0')
else if (*fieldstr == ','
|| isblank (to_uchar (*fieldstr)) || *fieldstr == '\0')
{
in_digits = false;
/* Ending the string, or this field/byte sublist. */
+6 -6
View File
@@ -133,11 +133,11 @@ extent_scan_read (struct extent_scan *scan)
unsigned int i = 0;
for (i = 0; i < fiemap->fm_mapped_extents; i++)
{
assert (fm_extents[i].fe_logical <=
OFF_T_MAX - fm_extents[i].fe_length);
assert (fm_extents[i].fe_logical
<= OFF_T_MAX - fm_extents[i].fe_length);
if (si && last_ei->ext_flags ==
(fm_extents[i].fe_flags & ~FIEMAP_EXTENT_LAST)
if (si && last_ei->ext_flags
== (fm_extents[i].fe_flags & ~FIEMAP_EXTENT_LAST)
&& (last_ei->ext_logical + last_ei->ext_length
== fm_extents[i].fe_logical))
{
@@ -147,8 +147,8 @@ extent_scan_read (struct extent_scan *scan)
last_ei->ext_flags = fm_extents[i].fe_flags;
}
else if ((si == 0 && scan->scan_start > fm_extents[i].fe_logical)
|| (si && last_ei->ext_logical + last_ei->ext_length >
fm_extents[i].fe_logical))
|| (si && (last_ei->ext_logical + last_ei->ext_length
> fm_extents[i].fe_logical)))
{
/* BTRFS before 2.6.38 could return overlapping extents
for sparse files. We adjust the returned extents
+2 -2
View File
@@ -191,8 +191,8 @@ main (int argc, char **argv)
invalid value that will be not displayed in print_full_info(). */
if (selinux_enabled
&& n_ids == 0
&& (just_context ||
(default_format && ! getenv ("POSIXLY_CORRECT"))))
&& (just_context
|| (default_format && ! getenv ("POSIXLY_CORRECT"))))
{
/* Report failure only if --context (-Z) was explicitly requested. */
if (getcon (&context) && just_context)
+2 -2
View File
@@ -359,8 +359,8 @@ setdefaultfilecon (char const *file)
/* If there's an error determining the context, or it has none,
return to allow default context */
if ((matchpathcon (file, st.st_mode, &scontext) != 0) ||
STREQ (scontext, "<<none>>"))
if ((matchpathcon (file, st.st_mode, &scontext) != 0)
|| STREQ (scontext, "<<none>>"))
{
if (scontext != NULL)
freecon (scontext);
+1 -1
View File
@@ -173,7 +173,7 @@ static struct line uni_blank;
/* If nonzero, ignore case when comparing join fields. */
static bool ignore_case;
/* If nonzero, treat the first line of each file as column headers -
/* If nonzero, treat the first line of each file as column headers --
join them without checking for ordering */
static bool join_header_lines;
+11 -11
View File
@@ -781,9 +781,9 @@ cols_ready_to_print (void)
n = 0;
for (q = column_vector, i = 0; i < columns; ++q, ++i)
if (q->status == OPEN ||
q->status == FF_FOUND || /* With -b: To print a header only */
(storing_columns && q->lines_stored > 0 && q->lines_to_print > 0))
if (q->status == OPEN
|| q->status == FF_FOUND /* With -b: To print a header only */
|| (storing_columns && q->lines_stored > 0 && q->lines_to_print > 0))
++n;
return n;
}
@@ -1275,13 +1275,13 @@ init_parameters (int number_of_files)
/* To allow input tab-expansion (-e sensitive) use:
if (number_separator == input_tab_char)
number_width = chars_per_number +
TAB_WIDTH (chars_per_input_tab, chars_per_number); */
number_width = chars_per_number
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
/* Estimate chars_per_text without any margin and keep it constant. */
if (number_separator == '\t')
number_width = chars_per_number +
TAB_WIDTH (chars_per_default_tab, chars_per_number);
number_width = (chars_per_number
+ TAB_WIDTH (chars_per_default_tab, chars_per_number));
else
number_width = chars_per_number + 1;
@@ -1297,8 +1297,8 @@ init_parameters (int number_of_files)
power_10 = 10 * power_10;
}
chars_per_column = (chars_per_line - chars_used_by_number -
(columns - 1) * col_sep_length) / columns;
chars_per_column = (chars_per_line - chars_used_by_number
- (columns - 1) * col_sep_length) / columns;
if (chars_per_column < 1)
error (EXIT_FAILURE, 0, _("page width too narrow"));
@@ -1836,8 +1836,8 @@ print_page (void)
{
if (empty_line)
align_empty_cols = true;
else if (p->status == CLOSED ||
(p->status == ON_HOLD && FF_only))
else if (p->status == CLOSED
|| (p->status == ON_HOLD && FF_only))
align_column (p);
}
}
+2 -2
View File
@@ -1344,8 +1344,8 @@ set_window_size (int rows, int cols, char const *device_name)
it's almost certainly a "struct winsize" instead.
At any rate, the bug manifests itself when ws_row == 0; the symptom is
that ws_row is set to ws_col, and ws_col is set to (ws_xpixel<<16) +
ws_ypixel. Since GNU stty sets rows and columns separately, this bug
that ws_row is set to ws_col, and ws_col is set to (ws_xpixel<<16)
+ ws_ypixel. Since GNU stty sets rows and columns separately, this bug
caused "stty rows 0 cols 0" to set rows to cols and cols to 0, while
"stty cols 0 rows 0" would do the right thing. On a little-endian
machine like the sun386i, the problem is the same, but for ws_col == 0.
+2 -2
View File
@@ -367,8 +367,8 @@ binary_operator (bool l_is_l)
test_syntax_error (_("unknown binary operator"), argv[op]);
}
if (argv[op][0] == '=' && (!argv[op][1] ||
((argv[op][1] == '=') && !argv[op][2])))
if (argv[op][0] == '='
&& (!argv[op][1] || ((argv[op][1] == '=') && !argv[op][2])))
{
bool value = STREQ (argv[pos], argv[pos + 2]);
pos += 3;
+1 -1
View File
@@ -292,7 +292,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus)
/* Back-up the state before each multibyte character conversion and
move the last incomplete character of the buffer to the front
of the buffer. This is needed because we don't know whether
the 'mbrtowc' function updates the state when it returns -2, -
the 'mbrtowc' function updates the state when it returns -2, --
this is the ISO C 99 and glibc-2.2 behaviour - or not - amended
ANSI C, glibc-2.1 and Solaris 5.7 behaviour. We don't have an
autoconf test for this, yet. */
+3 -3
View File
@@ -590,9 +590,9 @@ scan_entries (size_t n, const STRUCT_UTMP *utmp_buf)
while (n--)
{
if (!my_line_only ||
strncmp (ttyname_b, utmp_buf->ut_line,
sizeof (utmp_buf->ut_line)) == 0)
if (!my_line_only
|| strncmp (ttyname_b, utmp_buf->ut_line,
sizeof (utmp_buf->ut_line)) == 0)
{
if (need_users && IS_USER_PROCESS (utmp_buf))
print_user (utmp_buf, boottime);