This results in a net reduction of about 120 lines.
if (ignore_garbage)
{
- size_t i;
- for (i = 0; n > 0 && i < n;)
- if (isbase (inbuf[sum + i]) || inbuf[sum + i] == '=')
- i++;
- else
- memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i);
+ for (size_t i = 0; n > 0 && i < n;)
+ {
+ if (isbase (inbuf[sum + i]) || inbuf[sum + i] == '=')
+ i++;
+ else
+ memmove (inbuf + sum + i, inbuf + sum + i + 1, --n - i);
+ }
}
sum += n;
static void
fill_r (void)
{
- int i;
-
r[0] = GEN;
- for (i = 1; i < 8; i++)
+ for (int i = 1; i < 8; i++)
r[i] = (r[i - 1] << 1) ^ ((r[i - 1] & SBIT) ? GEN : 0);
}
crc_remainder (int m)
{
uint_fast32_t rem = 0;
- int i;
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
if (BIT (i) & m)
rem ^= r[i];
int
main (void)
{
- int i;
-
fill_r ();
printf ("static uint_fast32_t const crctab[256] =\n{\n 0x00000000");
- for (i = 0; i < 51; i++)
+ for (int i = 0; i < 51; i++)
{
printf (",\n 0x%08x, 0x%08x, 0x%08x, 0x%08x, 0x%08x",
crc_remainder (i * 5 + 1), crc_remainder (i * 5 + 2),
return false;
}
- unsigned int i;
bool empty_extent = false;
- for (i = 0; i < scan.ei_count || empty_extent; i++)
+ for (unsigned int i = 0; i < scan.ei_count || empty_extent; i++)
{
off_t ext_start;
off_t ext_len;
/* cp file1...filen edir
Copy the files 'file1' through 'filen'
to the existing directory 'edir'. */
- int i;
/* Initialize these hash tables only if we'll need them.
The problems they're used to detect can arise only if
src_info_init (x);
}
- for (i = 0; i < n_files; i++)
+ for (int i = 0; i < n_files; i++)
{
char *dst_name;
bool parent_exists = true; /* True if dir_name (dst_name) exists. */
static void
split_file (void)
{
- size_t i;
-
- for (i = 0; i < control_used; i++)
+ for (size_t i = 0; i < control_used; i++)
{
uintmax_t j;
if (controls[i].regexpr)
static void
delete_all_files (bool in_signal_handler)
{
- unsigned int i;
-
if (! remove_files)
return;
- for (i = 0; i < files_created; i++)
+ for (unsigned int i = 0; i < files_created; i++)
{
const char *name = make_filename (i);
if (unlink (name) != 0 && !in_signal_handler)
static void
parse_patterns (int argc, int start, char **argv)
{
- int i; /* Index into ARGV. */
struct control *p; /* New control record created. */
uintmax_t val;
static uintmax_t last_val = 0;
- for (i = start; i < argc; i++)
+ for (int i = start; i < argc; i++)
{
if (*argv[i] == '/' || *argv[i] == '%')
{
static void
translate_charset (char const *new_trans)
{
- int i;
-
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
trans_table[i] = new_trans[trans_table[i]];
translation_needed = true;
}
static void
scanargs (int argc, char *const *argv)
{
- int i;
size_t blocksize = 0;
uintmax_t count = (uintmax_t) -1;
uintmax_t skip = 0;
uintmax_t seek = 0;
- for (i = optind; i < argc; i++)
+ for (int i = optind; i < argc; i++)
{
char const *name = argv[i];
char const *val = strchr (name, '=');
static void
translate_buffer (char *buf, size_t nread)
{
- char *cp;
size_t i;
-
+ char *cp;
for (i = nread, cp = buf; i; i--, cp++)
*cp = trans_table[to_uchar (*cp)];
}
swab_buffer (char *buf, size_t *nread)
{
char *bufstart = buf;
- char *cp;
- size_t i;
/* Is a char left from last time? */
if (char_is_saved)
positions toward the end, working from the end of the buffer
toward the beginning. This way we only move half of the data. */
- cp = bufstart + *nread; /* Start one char past the last. */
- for (i = *nread / 2; i; i--, cp -= 2)
+ char *cp = bufstart + *nread; /* Start one char past the last. */
+ for (size_t i = *nread / 2; i; i--, cp -= 2)
*cp = *(cp - 2);
return ++bufstart;
static void
copy_with_block (char const *buf, size_t nread)
{
- size_t i;
-
- for (i = nread; i; i--, buf++)
+ for (size_t i = nread; i; i--, buf++)
{
if (*buf == newline_character)
{
static void
copy_with_unblock (char const *buf, size_t nread)
{
- size_t i;
- char c;
static size_t pending_spaces = 0;
- for (i = 0; i < nread; i++)
+ for (size_t i = 0; i < nread; i++)
{
- c = buf[i];
+ char c = buf[i];
if (col++ >= conversion_blocksize)
{
{
/* If the final input line didn't end with a '\n', pad
the output block to 'conversion_blocksize' chars. */
- size_t i;
- for (i = col; i < conversion_blocksize; i++)
+ for (size_t i = col; i < conversion_blocksize; i++)
output_char (space_character);
}
if (optind < argc)
{
- int i;
-
/* Open each of the given entries to make sure any corresponding
partition is automounted. This must be done before reading the
file system table. */
stats = xnmalloc (argc - optind, sizeof *stats);
- for (i = optind; i < argc; ++i)
+ for (int i = optind; i < argc; ++i)
{
/* Prefer to open with O_NOCTTY and use fstat, but fall back
on using "stat", in case the file is unreadable. */
if (optind < argc)
{
- int i;
-
/* Display explicitly requested empty file systems. */
show_listed_fs = true;
- for (i = optind; i < argc; ++i)
+ for (int i = optind; i < argc; ++i)
if (argv[i])
get_entry (argv[i], &stats[i - optind]);
Clear the accumulators for *all* levels between prev_level
and the current one. The depth may change dramatically,
e.g., from 1 to 10. */
- size_t i;
if (n_alloc <= level)
{
n_alloc = level * 2;
}
- for (i = prev_level + 1; i <= level; i++)
+ for (size_t i = prev_level + 1; i <= level; i++)
{
duinfo_init (&dulvl[i].ent);
duinfo_init (&dulvl[i].subdir);
validate_tab_stops (uintmax_t const *tabs, size_t entries)
{
uintmax_t prev_tab = 0;
- size_t i;
- for (i = 0; i < entries; i++)
+ for (size_t i = 0; i < entries; i++)
{
if (tabs[i] == 0)
die (EXIT_FAILURE, 0, _("tab size cannot be 0"));
{
gid_t *groups;
- int i;
int n_groups = xgetgroups (username, (pwd ? pwd->pw_gid : egid), &groups);
if (n_groups < 0)
return false;
}
- for (i = 0; i < n_groups; i++)
+ for (int i = 0; i < n_groups; i++)
if (groups[i] != rgid && groups[i] != egid)
{
putchar (delim);
{
gid_t *groups;
- int i;
gid_t primary_group;
if (username)
if (n_groups > 0)
fputs (_(" groups="), stdout);
- for (i = 0; i < n_groups; i++)
+ for (int i = 0; i < n_groups; i++)
{
if (i > 0)
putchar (',');
static void
free_spareline (void)
{
- size_t i;
-
- for (i = 0; i < ARRAY_CARDINALITY (spareline); i++)
+ for (size_t i = 0; i < ARRAY_CARDINALITY (spareline); i++)
{
if (spareline[i])
{
{
if (seq->count == seq->alloc)
{
- size_t i;
seq->lines = X2NREALLOC (seq->lines, &seq->alloc);
- for (i = seq->count; i < seq->alloc; i++)
+ for (size_t i = seq->count; i < seq->alloc; i++)
seq->lines[i] = NULL;
}
static void
delseq (struct seq *seq)
{
- size_t i;
- for (i = 0; i < seq->alloc; i++)
+ for (size_t i = 0; i < seq->alloc; i++)
{
freeline (seq->lines[i]);
free (seq->lines[i]);
while (seq1.count && seq2.count)
{
- size_t i;
diff = keycmp (seq1.lines[0], seq2.lines[0],
join_field_1, join_field_2);
if (diff < 0)
if (print_pairables)
{
- for (i = 0; i < seq1.count - 1; ++i)
+ for (size_t i = 0; i < seq1.count - 1; ++i)
{
size_t j;
for (j = 0; j < seq2.count - 1; ++j)
if (target_directory)
{
- int i;
-
/* Create the data structure we'll use to record which hard links we
create. Used to ensure that ln detects an obscure corner case that
might result in user data loss. Create it only if needed. */
}
ok = true;
- for (i = 0; i < n_files; ++i)
+ for (int i = 0; i < n_files; ++i)
{
char *dest_base;
char *dest = file_name_concat (target_directory,
n_pos = obstack_object_size (os) / sizeof (dired_pos);
if (n_pos > 0)
{
- size_t i;
- size_t *pos;
-
- pos = (size_t *) obstack_finish (os);
+ size_t *pos = (size_t *) obstack_finish (os);
fputs (prefix, stdout);
- for (i = 0; i < n_pos; i++)
+ for (size_t i = 0; i < n_pos; i++)
printf (" %lu", (unsigned long int) pos[i]);
putchar ('\n');
}
case locale_time_style:
if (hard_locale (LC_TIME))
{
- int i;
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
long_time_format[i] =
dcgettext (NULL, long_time_format[i], LC_TIME);
}
static void
clear_files (void)
{
- size_t i;
-
- for (i = 0; i < cwd_n_used; i++)
+ for (size_t i = 0; i < cwd_n_used; i++)
{
struct fileinfo *f = sorted_file[i];
free_ent (f);
static void
initialize_ordering_vector (void)
{
- size_t i;
- for (i = 0; i < cwd_n_used; i++)
+ for (size_t i = 0; i < cwd_n_used; i++)
sorted_file[i] = &cwd_file[i];
}
{
struct fileinfo const *f = sorted_file[filesno];
size_t name_length = length_of_file_name_and_frills (f);
- size_t i;
- for (i = 0; i < max_cols; ++i)
+ for (size_t i = 0; i < max_cols; ++i)
{
if (column_info[i].valid_len)
{
static bool _GL_ATTRIBUTE_PURE
hex_digits (unsigned char const *s)
{
- unsigned int i;
- for (i = 0; i < digest_hex_bytes; i++)
+ for (unsigned int i = 0; i < digest_hex_bytes; i++)
{
if (!isxdigit (*s))
return false;
fputs (") = ", stdout);
}
- size_t i;
-
/* Output a leading backslash if the file name contains
a newline or backslash. */
if (!prefix_tag && needs_escape)
putchar ('\\');
- for (i = 0; i < (digest_hex_bytes / 2); ++i)
+ for (size_t i = 0; i < (digest_hex_bytes / 2); ++i)
printf ("%02x", bin_buffer[i]);
if (!prefix_tag)
if (target_directory)
{
- int i;
-
/* Initialize the hash table only if we'll need it.
The problem it is used to detect can arise only if there are
two or more files to move. */
dest_info_init (&x);
ok = true;
- for (i = 0; i < n_files; ++i)
+ for (int i = 0; i < n_files; ++i)
ok &= movefile (file[i], target_directory, true, &x);
}
else
static void
dump_hexl_mode_trailer (size_t n_bytes, const char *block)
{
- size_t i;
fputs (" >", stdout);
- for (i = n_bytes; i > 0; i--)
+ for (size_t i = n_bytes; i > 0; i--)
{
unsigned char c = *block++;
unsigned char c2 = (isprint (c) ? c : '.');
}
else
{
- size_t i;
-
prev_pair_equal = false;
- for (i = 0; i < n_specs; i++)
+ for (size_t i = 0; i < n_specs; i++)
{
int datum_width = width_bytes[spec[i].size];
int fields_per_block = bytes_per_block / datum_width;
static int _GL_ATTRIBUTE_PURE
get_lcm (void)
{
- size_t i;
int l_c_m = 1;
- for (i = 0; i < n_specs; i++)
+ for (size_t i = 0; i < n_specs; i++)
l_c_m = lcm (l_c_m, width_bytes[spec[i].size]);
return l_c_m;
}
bool somedone = false;
char const *delimptr = delims;
size_t delims_saved = 0; /* Number of delims saved in 'delbuf'. */
- size_t i;
- for (i = 0; i < nfiles && files_open; i++)
+ for (size_t i = 0; i < nfiles && files_open; i++)
{
int chr IF_LINT ( = 0); /* Input character. */
int err IF_LINT ( = 0); /* Input errno value. */
{
if (argc_names)
{
- int i;
-
- for (i = 0; i < argc_names; i++)
+ for (int i = 0; i < argc_names; i++)
if (STREQ_LEN (UT_USER (utmp_buf), argv_names[i], UT_USER_SIZE))
{
print_entry (utmp_buf);
static void
long_pinky (const int argc_names, char *const argv_names[])
{
- int i;
-
- for (i = 0; i < argc_names; i++)
+ for (int i = 0; i < argc_names; i++)
print_long_entry (argv_names[i]);
}
print_files (n_files, file_names);
else
{
- unsigned int i;
- for (i = 0; i < n_files; i++)
+ for (unsigned int i = 0; i < n_files; i++)
print_files (1, &file_names[i]);
}
}
static bool
init_fps (int number_of_files, char **av)
{
- int i, files_left;
COLUMN *p;
- FILE *firstfp;
- char const *firstname;
total_files = 0;
if (parallel_files)
{
- files_left = number_of_files;
+ int files_left = number_of_files;
for (p = column_vector; files_left--; ++p, ++av)
{
if (! open_file (*av, p))
p->lines_stored = 0;
}
- firstname = p->name;
- firstfp = p->fp;
+ char const *firstname = p->name;
+ FILE *firstfp = p->fp;
+ int i;
for (i = columns - 1, ++p; i; --i, ++p)
{
p->name = firstname;
static void
pad_down (unsigned int lines)
{
- unsigned int i;
-
if (use_form_feed)
putchar ('\f');
else
- for (i = lines; i; --i)
+ for (unsigned int i = lines; i; --i)
putchar ('\n');
}
static bool
skip_to_page (uintmax_t page)
{
- uintmax_t n;
- int i;
- int j;
- COLUMN *p;
-
- for (n = 1; n < page; ++n)
+ for (uintmax_t n = 1; n < page; ++n)
{
- for (i = 1; i < lines_per_body; ++i)
+ COLUMN *p;
+ int j;
+
+ for (int i = 1; i < lines_per_body; ++i)
{
for (j = 1, p = column_vector; j <= columns; ++j, ++p)
if (p->status == OPEN)
print_stored (COLUMN *p)
{
COLUMN *q;
- int i;
int line = p->current_line++;
char *first = &buff[line_vector[line]];
if (p->status == FF_FOUND)
{
+ int i;
for (i = 1, q = column_vector; i <= columns; ++i, ++q)
q->status = ON_HOLD;
if (column_vector->lines_to_print <= 0)
{
char *buf = xnmalloc (3, n);
char *p = buf;
- size_t i;
- for (i = 0; i < n; i++)
+ for (size_t i = 0; i < n; i++)
{
memcpy (p, "../", 3);
p += 3;
{
/* OPTIND is unreliable, so iterate through the arguments looking
for a file name that looks like an option. */
- int i;
- for (i = 1; i < argc; i++)
+ for (int i = 1; i < argc; i++)
{
char const *arg = argv[i];
struct stat st;
{
struct field_range_pair *c = frp;
size_t n = n_frp;
- size_t i;
frp = NULL;
n_frp = 0;
if (c[0].lo > 1)
add_range_pair (1, c[0].lo - 1);
- for (i = 1; i < n; ++i)
+ for (size_t i = 1; i < n; ++i)
{
if (c[i-1].hi + 1 == c[i].lo)
continue;
bool rhs_specified = false;
bool dash_found = false; /* True if a '-' is found in this field. */
- size_t i;
bool in_digits = false;
/* Collect and store in RP the range end points. */
qsort (frp, n_frp, sizeof (frp[0]), compare_ranges);
/* Merge range pairs (e.g. `2-5,3-4' becomes `2-5'). */
- for (i = 0; i < n_frp; ++i)
+ for (size_t i = 0; i < n_frp; ++i)
{
for (size_t j = i + 1; j < n_frp; ++j)
{
write_permuted_output_reservoir (size_t n_lines, struct linebuffer *lines,
size_t const *permutation)
{
- size_t i;
-
- for (i = 0; i < n_lines; i++)
+ for (size_t i = 0; i < n_lines; i++)
{
const struct linebuffer *p = &lines[permutation[i]];
if (fwrite (p->buffer, sizeof (char), p->length, stdout) != p->length)
size_t used;
char *lim;
char **line;
- size_t i;
size_t n_lines;
/* TODO: We should limit the amount of data read here,
*pline = line = xnmalloc (n_lines + 1, sizeof *line);
line[0] = p = buf;
- for (i = 1; i <= n_lines; i++)
+ for (size_t i = 1; i <= n_lines; i++)
line[i] = p = next_line (p, eolbyte, lim - p);
return n_lines;
write_permuted_lines (size_t n_lines, char *const *line,
size_t const *permutation)
{
- size_t i;
-
- for (i = 0; i < n_lines; i++)
+ for (size_t i = 0; i < n_lines; i++)
{
char *const *p = line + permutation[i];
size_t len = p[1] - p[0];
write_permuted_numbers (size_t n_lines, size_t lo_input,
size_t const *permutation, char eolbyte)
{
- size_t i;
-
- for (i = 0; i < n_lines; i++)
+ for (size_t i = 0; i < n_lines; i++)
{
unsigned long int n = lo_input + permutation[i];
if (printf ("%lu%c", n, eolbyte) < 0)
write_random_numbers (struct randint_source *s, size_t count,
size_t lo_input, size_t hi_input, char eolbyte)
{
- size_t i;
const randint range = hi_input - lo_input + 1;
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
unsigned long int j = lo_input + randint_choose (s, range);
if (printf ("%lu%c", j, eolbyte) < 0)
write_random_lines (struct randint_source *s, size_t count,
char *const *lines, size_t n_lines)
{
- size_t i;
-
- for (i = 0; i < count; i++)
+ for (size_t i = 0; i < count; i++)
{
const randint j = randint_choose (s, n_lines);
char *const *p = lines + j;
int
main (int argc, char **argv)
{
- int i;
double seconds = 0.0;
bool ok = true;
usage (EXIT_FAILURE);
}
- for (i = optind; i < argc; i++)
+ for (int i = optind; i < argc; i++)
{
double s;
const char *p;
This extra room might be needed when preparing to read EOF. */
size_t size = worst_case_per_input_byte + 1;
- size_t i;
-
- for (i = 0; i < nfiles; i++)
+ for (size_t i = 0; i < nfiles; i++)
{
struct stat st;
off_t file_size;
avoid_trashing_input (struct sortfile *files, size_t ntemps,
size_t nfiles, char const *outfile)
{
- size_t i;
bool got_outstat = false;
struct stat outstat;
struct tempnode *tempcopy = NULL;
- for (i = ntemps; i < nfiles; i++)
+ for (size_t i = ntemps; i < nfiles; i++)
{
bool is_stdin = STREQ (files[i].name, "-");
bool same;
static void
check_inputs (char *const *files, size_t nfiles)
{
- size_t i;
- for (i = 0; i < nfiles; i++)
+ for (size_t i = 0; i < nfiles; i++)
{
if (STREQ (files[i], "-"))
continue;
if (! output_file_created)
{
- size_t i;
struct tempnode *node = temphead;
struct sortfile *tempfiles = xnmalloc (ntemps, sizeof *tempfiles);
- for (i = 0; node; i++)
+ for (size_t i = 0; node; i++)
{
tempfiles[i].name = node->name;
tempfiles[i].temp = node;
if (tok.n_tok)
{
- size_t i;
free (files);
files = tok.tok;
nfiles = tok.n_tok;
- for (i = 0; i < nfiles; i++)
+ for (size_t i = 0; i < nfiles; i++)
{
if (STREQ (files[i], "-"))
die (SORT_FAILURE, 0, _("when reading file names from stdin, "
if (mergeonly)
{
struct sortfile *sortfiles = xcalloc (nfiles, sizeof *sortfiles);
- size_t i;
- for (i = 0; i < nfiles; ++i)
+ for (size_t i = 0; i < nfiles; ++i)
sortfiles[i].name = files[i];
merge (sortfiles, 0, nfiles, outfile);
with glibc's statvfs implementation. */
uintmax_t fsid = 0;
int words = sizeof statfsbuf->f_fsid / sizeof *p;
- int i;
- for (i = 0; i < words && i * sizeof *p < sizeof fsid; i++)
+ for (int i = 0; i < words && i * sizeof *p < sizeof fsid; i++)
{
uintmax_t u = p[words - 1 - i];
fsid |= u << (i * CHAR_BIT * sizeof *p);
main (int argc, char *argv[])
{
int c;
- int i;
bool fs = false;
bool terse = false;
char *format = NULL;
format2 = default_format (fs, terse, /* device= */ true);
}
- for (i = optind; i < argc; i++)
+ for (int i = optind; i < argc; i++)
ok &= (fs
? do_statfs (argv[i], format)
: do_stat (argv[i], format, format2));
set_libstdbuf_options (void)
{
bool env_set = false;
- size_t i;
- for (i = 0; i < ARRAY_CARDINALITY (stdbuf); i++)
+ for (size_t i = 0; i < ARRAY_CARDINALITY (stdbuf); i++)
{
if (stdbuf[i].optarg)
{
quotef (device_name));
#ifdef TESTING
{
- size_t i;
printf ("new_mode: mode\n");
- for (i = 0; i < sizeof (new_mode); i++)
+ for (size_t i = 0; i < sizeof (new_mode); i++)
printf ("0x%02x: 0x%02x\n",
*(((unsigned char *) &new_mode) + i),
*(((unsigned char *) &mode) + i));
static void
display_recoverable (struct termios *mode)
{
- size_t i;
-
printf ("%lx:%lx:%lx:%lx",
(unsigned long int) mode->c_iflag,
(unsigned long int) mode->c_oflag,
(unsigned long int) mode->c_cflag,
(unsigned long int) mode->c_lflag);
- for (i = 0; i < NCCS; ++i)
+ for (size_t i = 0; i < NCCS; ++i)
printf (":%lx", (unsigned long int) mode->c_cc[i]);
putchar ('\n');
}
static speed_t _GL_ATTRIBUTE_PURE
string_to_baud (const char *arg)
{
- int i;
-
- for (i = 0; speeds[i].string != NULL; ++i)
+ for (int i = 0; speeds[i].string != NULL; ++i)
if (STREQ (arg, speeds[i].string))
return speeds[i].speed;
return (speed_t) -1;
static unsigned long int _GL_ATTRIBUTE_PURE
baud_to_value (speed_t speed)
{
- int i;
-
- for (i = 0; speeds[i].string != NULL; ++i)
+ for (int i = 0; speeds[i].string != NULL; ++i)
if (speed == speeds[i].speed)
return speeds[i].value;
return 0;
while (1)
{
- size_t i;
size_t bytes_read = safe_read (fd, buf, sizeof buf);
if (bytes_read == 0)
return false;
}
- for (i = 0; i < bytes_read; i++)
+ for (size_t i = 0; i < bytes_read; i++)
s += buf[i];
total_bytes += bytes_read;
}
static void
buf_free (Buf *x)
{
- size_t i;
- for (i = 0; i < x->n_bufs; i++)
+ for (size_t i = 0; i < x->n_bufs; i++)
free (x->p[i].start);
obstack_free (OBS, NULL);
}
print_line (FILE *out_stream, const Buf *x,
const Line_ptr *bol, const Line_ptr *bol_next)
{
- size_t i;
- for (i = bol->i; i <= bol_next->i; i++)
+ for (size_t i = bol->i; i <= bol_next->i; i++)
{
char *a = (i == bol->i ? bol->ptr : x->p[i].start);
char *b = (i == bol_next->i ? bol_next->ptr : ONE_PAST_END (x, i));
xset_binary_mode (STDOUT_FILENO, O_BINARY);
{
- size_t i;
ok = true;
- for (i = 0; file[i]; ++i)
+ for (size_t i = 0; file[i]; ++i)
ok &= tac_file (file[i]);
}
static bool
any_live_files (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
/* In inotify mode, ignore may be set for files
which may later be replaced with new files.
So always consider files live in -F mode. */
if (reopen_inaccessible_files && follow_mode == Follow_name)
return true;
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
{
if (0 <= f[i].fd)
return true;
static bool
any_remote_file (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
if (0 <= f[i].fd && f[i].remote)
return true;
return false;
static bool
any_non_remote_file (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
if (0 <= f[i].fd && ! f[i].remote)
return true;
return false;
static bool
any_symlinks (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
struct stat st;
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
if (lstat (f[i].name, &st) == 0 && S_ISLNK (st.st_mode))
return true;
return false;
static bool
any_non_regular (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
if (0 <= f[i].fd && ! S_ISREG (f[i].mode))
return true;
return false;
static bool
tailable_stdin (const struct File_spec *f, size_t n_files)
{
- size_t i;
-
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
if (!f[i].ignore && STREQ (f[i].name, "-"))
return true;
return false;
ignore any "-" operand that corresponds to a pipe or FIFO. */
size_t n_viable = 0;
- size_t i;
- for (i = 0; i < n_files; i++)
+ for (size_t i = 0; i < n_files; i++)
{
bool is_a_fifo_or_pipe =
(STREQ (f[i].name, "-")
{
size_t n_upper = 0;
size_t n_lower = 0;
- unsigned int i;
int c1 = 0;
int c2 = 0;
count old_s1_len = s1->length;
if (!s2->has_char_class)
return;
- for (i = 0; i < N_CHARS; i++)
+ for (int i = 0; i < N_CHARS; i++)
{
if (isupper (i))
n_upper++;
fstatus[0].failed = 1;
else
{
- size_t i;
-
- for (i = 0; i < nfiles; i++)
+ for (size_t i = 0; i < nfiles; i++)
fstatus[i].failed = (! file[i] || STREQ (file[i], "-")
? fstat (STDIN_FILENO, &fstatus[i].st)
: stat (file[i], &fstatus[i].st));
{
int minimum_width = 1;
uintmax_t regular_total = 0;
- size_t i;
- for (i = 0; i < nfiles; i++)
+ for (size_t i = 0; i < nfiles; i++)
if (! fstatus[i].failed)
{
if (S_ISREG (fstatus[i].st.st_mode))
fstatus = get_input_fstatus (nfiles, files);
number_width = compute_number_width (nfiles, fstatus);
- int i;
ok = true;
- for (i = 0; /* */; i++)
+ for (int i = 0; /* */; i++)
{
bool skip_file = false;
enum argv_iter_err ai_err;