Age | Commit message (Collapse) | Author |
|
More generally, resize integer variables to fit use more precisely.
(ADD_RANGE_PAIR): Remove unnecessary parens.
(struct range_pair): Make members to be of type size_t, not unsigned.
(max_range_endpoint, eol_range_start): Now size_t, not unsigned.
(suppress_non_delimited, output_delimiter_specified,
have_read_stdin, print_kth, set_fields): Now bool, nt int.
(delim): Now unsigned char, not int.
(mark_printable_field, is_printable_field, is_range_start_index,
set_fields, set_fields, cut_bytes, cut_fields):
Use size_t, not unsigned, for field and byte counts.
(hash_int): Use uintptr_t, not unsigned, for pointers converted
to integers. This squeezes more info out of them.
(set_fields, cut_bytes, cut_fields, main):
Use bool, not int, for booleans.
(set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
|
|
to avoid potential overflow in pointer arithmetic.
(set_fields): Use not `1', but rather `sizeof *printable_field' as
second argument to xcalloc.
|
|
type changes (unsigned int -> size_t) in hash.c.
|
|
of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
Update the call to parse_long_options so that `AUTHORS, NULL' are the
last parameters.
* src/true.c (main): Append NULL to version_etc argument list.
* src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
|
|
Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
Mark each WRITTEN_BY string as translatable.
|
|
|
|
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
|
|
(cut_fields): Invoke getndelim2 rather than getdelim2.
|
|
E.g., `cut -f2' would do so.
|
|
|
|
(printable_field): Change type to `unsigned char'.
(mark_printable_field, is_printable_field): New functions.
Use them in place of all direct accesses of `printable_field'.
|
|
|
|
Don't include closeout.h.
|
|
|
|
|
|
|
|
|
|
determine range endpoints.
|
|
extract the 1,000,000-th field of some huge input file?
The first step is to rearrange things so that the values
in the printable_field array are all 0/1 rather than 0/1/2.
(RANGE_START_SENTINEL): Remove.
Store range-start indices in a hash table, rather than
overloading the `printable_field' array.
(range_start_ht): New global.
(hash_int, hash_compare_ints, is_range_start_index): New functions.
(print_kth): Use is_range_start_index; don't test printable_field.
(set_fields): Detect overflow.
(set_fields): Insert each range-start index into range_start_ht.
(main): Call set_fields only once, and only after
output_delimiter_specified and (if required) range_start_ht have
been defined.
|
|
Reflect renaming: getstr -> getdelim2.
|
|
|
|
xrealloc, and xcalloc return values and of xrealloc's first argument.
|
|
and when --output-delimiter=STRING is specified, output STRING between
ranges of selected bytes.
(RANGE_START_SENTINEL): Define.
(output_delimiter_specified): New global.
(print_kth): Add parameter. Adjust all callers.
(set_fields): Mark each range-start index with RANGE_START_SENTINEL.
(cut_bytes): When requested, output STRING between ranges of
selected bytes.
(main): Make a diagnostic a little clearer.
Based on a patch from Jan Nieuwenhuizen.
|
|
Don't merge abutting ranges like 4- and 2-3. This makes no
difference currently, but is required to support an upcoming change.
|
|
|
|
|
|
|
|
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
|
|
instead of hard-coding --help and --version descriptions.
|
|
Split usage strings so that --help and --version descriptions are alone
in their own string.
Likewise for the one that says:
Mandatory arguments to long options are mandatory for short options too.
|
|
Use fputs, not printf.
|
|
``Mandatory arguments to long options are mandatory for short options too.\n\''
|
|
`and'.
|
|
|
|
|
|
(cut_fields): Check for I/O error as well as end-of-file.
|
|
|
|
|
|
(cut_fields): Adjust caller to use the just-extended one in ../lib.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(cut_fields): Cast to `unsigned char' before comparing.
(main): Cast to `unsigned char' before assigning.
|
|
|