summaryrefslogtreecommitdiff
path: root/src/uniq.c
AgeCommit message (Collapse)Author
2006-12-13Remove some arbitrary restrictions on size fields,Paul Eggert
so that commands like "sort -k 18446744073709551616" no longer fail merely because 18446744073709551616 doesn't fit in uintmax_t. The trick is that these fields can all be treated as effectively infinity; their exact values don't matter, since no internal buffer can be that long. * src/join.c (string_to_join_field): Verify that SIZE_MAX <= ULONG_MAX if the code assumes this. Silently truncate too-large values to SIZE_MAX, as the remaining code will do the right thing in this case. * src/sort.c (parse_field_count): Likewise. * src/uniq.c (size_opt, main): Likewise. * tests/join/Test.pm (bigfield): New test. * tests/sort/Test.pm (bigfield): New test. * tests/uniq/Test.pm (121): New test. Signed-off-by: Jim Meyering <jim@meyering.net>
2006-07-09Adjust to today's renaming changes in system.h.Paul Eggert
2006-02-18(usage): Use two spaces (not one) to separate theJim Meyering
--first-only option string from its description, so help2man formats the derived man page properly.
2005-07-05Adjust to the change to DECIMAL_DIGIT_ACCUMULATE: its last arg is nowPaul Eggert
a type, not a value.
2005-07-03Don't include stdio-safer.h; no longer needed.Paul Eggert
(writeline): Remove stream arg; we now always output to stdout. All callers changed. (check_file): Reuse stdout rather than opening a new stream. This saves a file descriptor.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-04-26(main): Don't complain about -NUM.Paul Eggert
2005-04-11Include stdio_safer.h.Paul Eggert
(check_file): Don't assume fopen cannot return stdin or stdout.
2005-03-28(delimit_method_string): Use NULL, not `0'.Jim Meyering
2005-03-25(main): Update use of DECIMAL_DIGIT_ACCUMULATE.Jim Meyering
2005-03-18fix typoJim Meyering
2005-03-17(main): Use DECIMAL_DIGIT_ACCUMULATE macro in place of nearly-equivalent code.Jim Meyering
2005-03-17Before, this command would make uniq skip 11 fields and printJim Meyering
only the first line. $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2) 1 1 1 2 (main): Interpret `uniq -f1 -1' like `uniq -f1', not like `uniq -f11'.
2005-03-06Remove `register' keyword.Jim Meyering
2004-12-02(different): Assume setlocale exists.Paul Eggert
2004-11-19(check_file): Don't check stdout for errors here.Jim Meyering
2004-08-03(hard_LC_COLLATE, ignore_case, different, check_file,Paul Eggert
main): Use bool for booleans. (writeline, check_file): Use uintmax_t for line counts. (check_file): Check for and report line number overflow, when that matters.
2004-06-21(main): Standardize on the diagnostics given when someone givesJim Meyering
too few operands ("missing operand after `xxx'") or too many operands ("extra operand `xxx'"). Include "quote.h" and/or "error.h" if it wasn't already being included.
2004-01-21(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.
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-22(check_file): Report error right away if I/O fails,Jim Meyering
so that the proper errno value is used. (check_file): Check for ferror (stdout) even if ostream == stdout. (check_file): Don't report bogus errno value after ferror discovers an output error. We don't know the proper errno value, since it might have been caused by any of a whole bunch of calls, and it might have been trashed in the meantime. Fixing this problem will require much more extensive changes; in the meantime just say "write error".
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-18(writeline): Use a SPACE, not a TAB between theJim Meyering
count and the corresponding line, as required by POSIX.
2003-06-18Reflect renaming: readline -> readlinebuffer.Jim Meyering
2003-06-17(main): Call initialize_main.Jim Meyering
2003-05-14Fix uniq to conform to POSIX, which requires that "uniq -d -u"Jim Meyering
must output nothing. Problem reported by Josh Hyman. (enum output_mode, mode): Remove, replacing with: (output_unique, output_first_repeated, output_later_repeated): New vars. All uses of "mode" changed to use these variables, which are not mutually exclusive as "mode" was. (writeline): New arg "match", used to control whether to obey output_first_repeated or output_later_repeated. All callers changed. (check_file, main): Adjust to above changes.
2003-05-10(main): Don't segfault when argc < optind.Jim Meyering
2002-08-31Change `exit (0)' to `exit (EXIT_SUCCESS)',Jim Meyering
`exit (1)' to `exit (EXIT_FAILURE)', and `usage (1)' to `usage (EXIT_FAILURE)'.
2002-08-02Include hard-locale.h, xmemcoll.h.Jim Meyering
(hard_LC_COLLATE): New var. (different): Args are now char *, not const char *. Use xmemcoll instead of memcmp to compare lines, so that LC_COLLATE has effect. However, use memcmp if it is an easy locale. (check_file): Do not include newline in comparison, so that xmemcoll has a byte to stomp on temporarily. (main): Set hard_LC_COLLATE.
2002-07-02(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.Jim Meyering
2002-02-16Include posixver.h.Jim Meyering
(usage): Document only the intersection of the old and new behaviors, to encourage portability. (shortopts): Remove; no longer needed. (main): Parse options using POSIX 1003.1-2001 rules if conforming to that standard. Do not warn of obsolete options.
2002-02-02(main): Prepend `warning: ' to the diagnostic, so it'sJim Meyering
consistent with all of the other `... is obsolete...' diagnostics.
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 this. (shortopts): New constant. (main): Check for obsolete options.
2002-01-18(main): Issue a warning for obsolete usage, unless POSIXLY_CORRECT.Jim Meyering
2002-01-16add 2002 to Copyright lineJim Meyering
2002-01-16Add support for POSIX 1003.1-2001, which requires removal forJim Meyering
support of obsolete "+" option syntax in sort, tail, and uniq. (usage, main): Implement this.
2001-12-17(usage): Remove strap `)' in --help output.Jim Meyering
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-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(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-10-04Rename --all-repeated argument `precede' to `prepend'.Jim Meyering
* src/uniq.c (enum delimit_method): s/DM_PRECEDE/DM_PREPEND/ and change all uses. (delimit_method_string): s/precede/prepend/ Patch by Padraig Brady. * src/uniq.c (usage): Correct typo in description of --all-repeated. Patch by Padraig Brady.
2001-08-25(main): Fix a typo in the previous patch: missingJim Meyering
a bounds check for examples like `uniq a b c'.
2001-08-25(main): Fix some more incompatibilities with POSIX.2,Jim Meyering
(e.g. `uniq +3 --' did not work) by invoking getopt_long with leading '-', resembling what was done to 'sort' on 2001-03-20. Recognize an +N option only if it is an integer in range, and (if POSIXLY_CORRECT) only if a file name argument has not been seen; otherwise silently treat it as a file name. If the user specifies too many operands, output the first one in the error message, as a diagnostic aid.
2001-08-25(main): Don't report an error when given the valid options `+3 -d'.Jim Meyering