summaryrefslogtreecommitdiff
path: root/src/pr.c
AgeCommit message (Collapse)Author
2005-03-28(long_options): Use NULL, not `0'.Jim Meyering
2005-03-20(init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.Jim Meyering
2005-03-20(init_header): Add missing `%' in format string.Jim Meyering
2005-03-20(parse_column_count): Adjust comment to match the code.Jim Meyering
2005-03-19Include strftime.h, timespec.h.Paul Eggert
(init_header): Obtain and format nanosecond part of time stamp.
2005-03-15Both `pr -0' and e.g., `pr -03' evoke `column count too large'.Jim Meyering
`pr -0' should give a better diagnostic and `pr -03' should be equivalent to `pr -3'. (parse_column_count): Change return type to void. Call error (EXIT_FAILURE, ... for an invalid string. (main): Allocate space for column_count_string using malloc. Accumulate all old-style column-count digits before converting. When the number of columns is specified via both old-style, (e.g., -3), and a long option (--columns=5), ensure that only the last one specified takes effect.
2005-03-10Don't segfault for a long header date string, e.g.,Jim Meyering
echo a|pr -D +%9999999A (init_header): Use x2nrealloc, rather than alloca. Don't bother with fixed-sized initial buffer; always use x*alloc.
2005-03-10(init_header): Use INT_BUFSIZE_BOUND in place of INT_STRLEN_BOUND + 1.Jim Meyering
2005-03-06Factor out column-count processing.Jim Meyering
Include "inttostr.h". (parse_column_count): New function. (main): Use the new function for both old-style, -9, and long, --columns=-9, options.
2005-03-06Remove register keyword.Jim Meyering
2005-01-08`pr --columns=N' was not equivalent to `pr -N' when also usingJim Meyering
either -s or -w. (main): Set `explicit_columns' for --columns=N, not just for -N. This bug has existed since the introduction of the --columns=N option on 1998-08-15.
2005-01-08(main): Check for column count overflow with usages like "pr -2147483648".Jim Meyering
2005-01-07(init_fps): Use xnmalloc, rather than xmalloc.Jim Meyering
2004-11-12(strtoumax): Declare if not declared.Paul Eggert
(skip_to_page, first_page_number, last_page_number, page_number, first_last_page, print_header): Use uintmax_t for page numbers. (first_last_page): Remove unnecessary forward declaration. Do not modify arg (it is now a const pointer). Return a true if successful, false (without print a diagnostic) otherwise. (main): If +XXX does not specify a valid page range, treat it as a file name. This follows the response to Open Group XCU ERN 41 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>, which says the behavior is allowed. (skip_to_page): When starting page number exceeds page count, print both numbers in the diagnostic. (print_header): Detect page number overflow.
2004-09-21Remove unused "case 0".Paul Eggert
2004-08-03Add a FIXME mentioning that there are manyPaul Eggert
unchecked integer overflows in this file. (TRUE, FALSE): Remove. All uses replaced by true and false. (struct COLUMN, read_line, print_page, print_stored, open_file, skip_to_page, init_fps, parallel_files, align_empty_cols, empty_line, FF_only, explicit_columns, extremities, keep_FF, print_a_FF, print_a_header, use_form_feed, have_read_stdin, print_across_flag, storing_columns, balance_columns, truncate_lines, join_lines, untabify_input, failed_opens, numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix, double_space, ignore_failed_opens, use_col_separator, pad_vertically, last_line, main, init_parameters, skip_read, read_line, print_stored): Use bool for booleans. (struct COLUMN, char_to_clump, store_char, print_char): Use char for chars. (clump_buff, print_clump): Use char[], not int[], for an array whose elements are always chars. (first_last_page, main, getoptarg, balance, add_line_number, char_to_uclump): Remove unnecessary casts. (init_parameters): Allocate chars, not ints, for clump_buff. (print_char): Use to_uchar before invoking ISPRINT. (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2004-06-15Include "hard-locale.h".Jim Meyering
(main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since POSIX specifies the behavior only in the POSIX locale.
2004-01-22(usage): Use EXIT_SUCCESS, not 0, for clarity.Jim Meyering
(usage): Don't bother normalizing exit status since the arg is already the correct exit status now. (FATAL_ERROR, main): Exit with status EXIT_FAILURE, not 2, on errors.
2003-12-20Change type of global, buff_allocated, to size_t.Jim Meyering
2003-11-04(store_char): Use x2nrealloc rather than xrealloc.Jim Meyering
2003-10-18Most .c files (AUTHORS): Revert the WRITTEN_BY/AUTHORS changeJim Meyering
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.
2003-09-18(WRITTEN_BY): Rename from AUTHORS.Jim Meyering
Begin each WRITTEN_BY string with `Written by ' and end it with `.'. Mark each WRITTEN_BY string as translatable.
2003-09-18revert previous changeJim Meyering
2003-09-18Update AUTHORS definition to be a comma-separated list of strings and/or updateJim Meyering
the call to parse_long_options so that `AUTHORS, NULL' are the last parameters.
2003-07-23Don't include headers already included by system.h:Jim Meyering
Don't include closeout.h.
2003-07-23Don't include time.h; system.h already does it.Jim Meyering
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-13shorten long lineJim Meyering
2003-05-13(init_fps, init_store_cols): Don't apply cast to argument of free.Jim Meyering
2003-04-11Remove anachronistic casts of xmalloc,Jim Meyering
xrealloc, and xcalloc return values and of xrealloc's first argument.
2002-12-15Remove all uses of `PARAMS'.Jim Meyering
2002-08-09(main): Don't ignore -COLUMN if it's the last option.Jim Meyering
(usage): Clarify help text for the -COLUMN option.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-04-28Avoid new warnings from gcc.Jim Meyering
[struct COLUMN] <name>: Declare member to be const. (init_fps): Declare local variable `firstname' to be const.
2002-02-16Include posixver.h.Jim Meyering
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (short_options): Remove; no longer needed. (COMMON_SHORT_OPTIONS): New macro. (SEP_STRING_OPTION): Remove; no longer needed. All uses changed to back to the corresponding short options. (main): Parse options using POSIX 1003.1-2001 rules if conforming to that standard. Do not warn of obsolete options.
2002-02-02Add more support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "-N" option syntax in expand, head, fold, split, tail, unexpand, uniq, and which prohibits options with optional arguments in od and pr. (usage): Document it. (main): Check for obsolete options. (short_options): New constant. (SEP_STRING_OPTION): New enum value. (long_options): Use it.
2001-12-01Reflect renaming to, and new usage of these macros:Jim Meyering
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTIONJim Meyering
instead of hard-coding --help and --version descriptions.
2001-11-25(usage): Indent --help and --version strings to start in the 7th column.Jim Meyering
2001-11-23Factor out some common strings to make translation easier.Jim Meyering
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.
2001-11-11(struct COLUMN) [print_func]: Declare as a protype.Jim Meyering
(struct COLUMN) [char_func]: Declare as a protype.
2001-11-11(usage): Split --help output into smaller pieces.Jim Meyering
Use fputs, not printf.
2001-11-04(usage): Say thatJim Meyering
``Mandatory arguments to long options are mandatory for short options too.\n\''
2001-08-13(AUTHORS): Mark string for translation, since it contains the English word ↵Jim Meyering
`and'.
2001-03-17Include mbswidth.h.Jim Meyering
(standard_header, header, test_suite): Remove. (date_format, date_text, file_text, header_width_available): New vars. (long_options, main, init_header, usage): Add new -D or --date-format option. (CHARS_FOR_DATE_AND_PAGE, T_BUF_FMT, T_BUF_SIZE, NO_DATE): Remove. (init_header): Allow arbitrary width for date format. Change "Page %5d" to "Page %d", since the code no longer assumes fixed width. Do not assume that localtime succeeds. (init_header, print_header, usage): Do not truncate headers. (init_header, print_header): Defer width calculations until page is printed, since "Page 100000" is wider than "Page 1". Count columns, not bytes, in page headers. Custom headers take up only the center, not the whole header. (print_header): Use printf rather than fprintf(stdout).
2000-11-19(main): Do not assume EOF == -1.Jim Meyering
Handle the case correctly when digits options immediately precede a non-option.
2000-08-05(init_header): Fix buffer-overrun error.Jim Meyering
Allocated buffer was sometimes too small. Reported by Greg McGary (who found this bug using his bounded-pointers-enabled gcc). (init_header): Move declarations of several variables into the inner scope where they are used.
2000-08-04(store_columns): Remove conjunct that would dereferenceJim Meyering
an out-of-bounds pointer. Reported by Greg McGary (who found this bug using his bounded-pointers-enabled gcc).
2000-05-20Arrange to call close_stdout upon exit. Don't close stdout explicitly.Jim Meyering
2000-01-08(PAGES_OPTION, COLUMNS_OPTION): Define these and use them instead ofJim Meyering
`CHAR_MAX + n'.