Jim Meyering
a19486436f
tweak comment
2003-07-22 21:56:23 +00:00
Jim Meyering
9239223865
(set_fields): Use xcalloc in place of xmalloc+memset.
2003-07-22 21:53:39 +00:00
Jim Meyering
4457508c7a
don't include stdboo.h. it's already included via system.h
2003-07-22 14:18:58 +00:00
Jim Meyering
6dc75c643b
(main) [lint]: Initialize spec_list_string to avoid warning.
2003-07-22 14:15:31 +00:00
Jim Meyering
3fe298f13f
(set_fields): Mark all selected indices before trying to
...
determine range endpoints.
2003-07-22 13:00:45 +00:00
Jim Meyering
bf2cf0b7ba
Begin to address this comment: What if someone wants to
...
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.
2003-07-22 11:56:24 +00:00
Jim Meyering
91c698cb2f
Include "getdelim2.h", not "getstr.h".
...
Reflect renaming: getstr -> getdelim2.
2003-06-18 07:59:14 +00:00
Jim Meyering
6bcd4b08ba
(main): Call initialize_main.
2003-06-17 18:13:23 +00:00
Jim Meyering
6c93bdeeaa
Remove anachronistic casts of xmalloc,
...
xrealloc, and xcalloc return values and of xrealloc's first argument.
2003-04-11 10:51:56 +00:00
Jim Meyering
322ee6e302
When selecting ranges of byte offsets (as opposed to ranges of fields)
...
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.
2003-01-09 20:16:58 +00:00
Jim Meyering
e66ab953ef
(set_fields): Make code agree with comment:
...
Don't merge abutting ranges like 4- and 2-3. This makes no
difference currently, but is required to support an upcoming change.
2003-01-09 19:30:22 +00:00
Jim Meyering
7d1c764098
(set_fields): Fix typo in comment.
2003-01-07 17:12:11 +00:00
Jim Meyering
0b7a5a2391
(cut_fields): Add a temporary size_t variable, n_bytes, to avoid warnings.
2002-10-12 09:40:02 +00:00
Jim Meyering
5a731510b2
(usage): Use the PACKAGE_BUGREPORT e-mail address, rather than hard-coding it.
2002-07-02 09:06:33 +00:00
Jim Meyering
3a0a028c8c
Reflect renaming to, and new usage of these macros:
...
HELP_OPTION_DESCRIPTION and VERSION_OPTION_DESCRIPTION.
2001-12-01 17:41:25 +00:00
Jim Meyering
afa12bc912
(usage): Use new macros, EMIT_HELP_DESCRIPTION and EMIT_VERSION_DESCRIPTION
...
instead of hard-coding --help and --version descriptions.
2001-12-01 17:21:56 +00:00
Jim Meyering
909dc8c01d
Factor out some common strings to make translation easier.
...
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-23 19:58:23 +00:00
Jim Meyering
69b3ea263d
(usage): Split --help output into smaller pieces.
...
Use fputs, not printf.
2001-11-11 20:04:57 +00:00
Jim Meyering
ff4121e50e
(usage): Say that
...
``Mandatory arguments to long options are mandatory for short options too.\n\''
2001-11-04 09:43:16 +00:00
Jim Meyering
41a201e991
(AUTHORS): Mark string for translation, since it contains the English word `and'.
2001-08-13 10:33:28 +00:00
Jim Meyering
95ed06eb09
(usage): Note that when using -f, lines with no delimiters are also printed.
2000-09-07 07:08:17 +00:00
Jim Meyering
19ee58e090
Remove obsolete comment block.
2000-09-07 07:01:11 +00:00
Jim Meyering
8b6882e5e9
(cut_fields): Invoke xalloc_die instead of printing our own message.
...
(cut_fields): Check for I/O error as well as end-of-file.
2000-08-08 07:09:31 +00:00
Jim Meyering
56d6e5a38a
(cut_fields): Use virtual memory exhausted', not Memory exhausted'.
2000-07-31 06:48:43 +00:00
Jim Meyering
1237bc6c72
Change type of global, field_1_bufsize, from int to size_t.
2000-07-01 15:41:01 +00:00
Jim Meyering
6b01706633
(getstr): Remove private (and out of date) version of this function.
...
(cut_fields): Adjust caller to use the just-extended one in ../lib.
2000-06-21 09:20:40 +00:00
Jim Meyering
24f2bd8c9f
Arrange to call close_stdout upon exit. Don't close stdout explicitly.
2000-05-20 22:06:38 +00:00
Jim Meyering
dc6a5317bc
Correct copying notice to use GPL, per author's request.
2000-01-21 15:07:53 +00:00
Jim Meyering
299882b8a4
(OUTPUT_DELIMITER_OPTION): Define this and use it instead of `CHAR_MAX + n'.
2000-01-08 18:02:09 +00:00
Jim Meyering
d1b4719534
Remove xstrdup declaration.
1999-09-02 21:31:19 +00:00
Jim Meyering
d815c152df
Standardize --help and --version processing.
1999-04-04 15:44:26 +00:00
Jim Meyering
c21cecaea8
Use AUTHORS in place of string in parse_long_options call.
1999-04-03 05:26:48 +00:00
Jim Meyering
1d47220ab2
Insert AUTHORS definition.
1999-04-03 05:22:05 +00:00
Jim Meyering
cf691ec714
Use PROGRAM_NAME in place of string in parse_long_options call.
1999-04-03 05:20:06 +00:00
Jim Meyering
7c2d5de6c7
define PROGRAM_NAME
1999-04-03 05:01:48 +00:00
Jim Meyering
3a01605b6b
(getstr): Change type of `delim' parameter from char to int.
...
(cut_fields): Cast to `unsigned char' before comparing.
(main): Cast to `unsigned char' before assigning.
1999-03-07 05:09:23 +00:00
Jim Meyering
76b9399091
(FATAL_ERROR): s/s/Message
1999-03-07 04:50:48 +00:00
Jim Meyering
88cbad9817
Include long-options.h
...
[long_options]: Remove the "help" and "version" entries.
Remove declarations of show_help and show_version.
(main): Use parse_long_options, including author name(s).
Remove the show_version and show_help blocks.
1999-03-04 05:36:10 +00:00
Jim Meyering
9fec9172be
Don't prototype usage as static.
1999-01-14 18:25:16 +00:00
Jim Meyering
6880f434c0
update bug-reporting address
1998-09-19 17:24:05 +00:00
Jim Meyering
49b81671fd
(longopts): Don't assume ASCII.
1998-08-30 03:07:52 +00:00
Jim Meyering
5c9345dbd1
(cut_fields): Honor new --output-delimiter option.
...
(main): Fix handling of --delimiter='' (-d ''). Until now, it has
never worked as advertised. I guess no one tried it.
1998-07-26 04:05:07 +00:00
Jim Meyering
257c5c4737
revert back to using lower case _unlocked wrapper names
1998-06-29 15:57:45 +00:00
Jim Meyering
dd9470cb58
Change all uses of unlocked-wrapped functions to their upper case wrapper names.
1998-06-29 02:11:07 +00:00
Jim Meyering
933b990ab9
add a FIXME for output delimiter
1998-06-28 21:32:51 +00:00
Jim Meyering
0d38a270a4
Do not define _GNU_SOURCE and/or NDEBUG
1998-04-26 20:38:28 +00:00
Jim Meyering
d4257e63c7
Use STREQ rather than strcmp
1998-04-12 09:27:45 +00:00
Jim Meyering
7dcae67d92
(ADD_RANGE_PAIR): Cast first arg of xrealloc to char*.
...
(getstr): Cast xmalloc return value to char*.
(xmalloc): Remove decl.
(xrealloc): Remove decl.
1997-10-25 04:37:57 +00:00
Jim Meyering
3f3f566627
update bug-reporting address
1997-10-07 23:55:52 +00:00
Jim Meyering
2f1768f676
(cut_fields): Detect when the input is empty and handle
...
that special case. Before `cut -f1 </dev/null' would improperly
output a single newline. Reported by Phil Richards.
1997-06-14 17:31:40 +00:00