diff -Naur coreutils-5.2.1/src/localedir.h coreutils-5.2.1ff1/src/localedir.h --- coreutils-5.2.1/src/localedir.h 1970-01-01 01:00:00.000000000 +0100 +++ coreutils-5.2.1ff1/src/localedir.h 2004-06-15 20:09:25.120510000 +0200 @@ -0,0 +1 @@ +#define LOCALEDIR "/usr/local/share/locale" diff -Naur coreutils-5.2.1/src/wc.c coreutils-5.2.1ff1/src/wc.c --- coreutils-5.2.1/src/wc.c 2004-01-21 23:27:02.000000000 +0100 +++ coreutils-5.2.1ff1/src/wc.c 2004-06-15 20:31:55.589207552 +0200 @@ -17,6 +17,10 @@ /* Written by Paul Rubin, address@hidden and David MacKenzie, address@hidden */ + +/* 15/06/2004 : FabF : Adding -t slot for "true lines" aka lines used + */ + #include @@ -82,13 +86,14 @@ /* Cumulative number of lines, words, chars and bytes in all files so far. max_line_length is the maximum over all files processed so far. */ static uintmax_t total_lines; +static uintmax_t total_tlines; static uintmax_t total_words; static uintmax_t total_chars; static uintmax_t total_bytes; static uintmax_t max_line_length; /* Which counts to print. */ -static int print_lines, print_words, print_chars, print_bytes; +static int print_lines, print_tlines, print_words, print_chars, print_bytes; static int print_linelength; /* The print width of each count. */ @@ -117,6 +122,7 @@ {"bytes", no_argument, NULL, 'c'}, {"chars", no_argument, NULL, 'm'}, {"lines", no_argument, NULL, 'l'}, + {"true lines", no_argument, NULL, 't'}, {"words", no_argument, NULL, 'w'}, {"max-line-length", no_argument, NULL, 'L'}, {GETOPT_HELP_OPTION_DECL}, @@ -143,6 +149,7 @@ -c, --bytes print the byte counts\n\ -m, --chars print the character counts\n\ -l, --lines print the newline counts\n\ + -t, --truelines print the newline counts minus free lines\n\ "), stdout); fputs (_("\ -L, --max-line-length print the length of the longest line\n\ @@ -159,6 +166,7 @@ associated with the specified counters. */ static void write_counts (uintmax_t lines, + uintmax_t tlines, uintmax_t words, uintmax_t chars, uintmax_t bytes, @@ -174,6 +182,11 @@ printf (format_int, number_width, umaxtostr (lines, buf)); format_int = format_sp_int; } + if (print_tlines) + { + printf (format_int, number_width, umaxtostr (tlines, buf)); + format_int = format_sp_int; + } if (print_words) { printf (format_int, number_width, umaxtostr (words, buf)); @@ -205,11 +218,11 @@ { char buf[BUFFER_SIZE + 1]; size_t bytes_read; - uintmax_t lines, words, chars, bytes, linelength; + uintmax_t lines, tlines, words, chars, bytes, linelength; int count_bytes, count_chars, count_complicated; char const *file = file_x ? file_x : _("standard input"); - lines = words = chars = bytes = linelength = 0; + lines = tlines = words = chars = bytes = linelength = 0; /* If in the current locale, chars are equivalent to bytes, we prefer counting bytes, because that's easier. */ @@ -225,7 +238,7 @@ count_bytes = print_bytes + print_chars; count_chars = 0; } - count_complicated = print_words + print_linelength; + count_complicated = print_words + print_linelength + print_tlines; /* We need binary input, since `wc' relies on `lseek' and byte counts. */ SET_BINARY (fd); @@ -240,7 +253,7 @@ `(dd ibs=99k skip=1 count=0; ./wc -c) < /etc/group' should make wc report `0' bytes. */ - if (count_bytes && !count_chars && !print_lines && !count_complicated) + if (count_bytes && !count_chars && !print_lines && !print_tlines && !count_complicated) { off_t current_pos, end_pos; @@ -376,6 +389,8 @@ { case '\n': lines++; + if(linepos) + tlines++; /* Fall through. */ case '\r': case '\f': @@ -455,6 +470,8 @@ { case '\n': lines++; + if (linepos) + tlines++; /* Fall through. */ case '\r': case '\f': @@ -498,8 +515,9 @@ if (count_chars < print_chars) chars = bytes; - write_counts (lines, words, chars, bytes, linelength, file_x); + write_counts (lines, tlines, words, chars, bytes, linelength, file_x); total_lines += lines; + total_tlines += tlines; total_words += words; total_chars += chars; total_bytes += bytes; @@ -544,7 +562,7 @@ struct fstatus *fstatus = xmalloc (nfiles * sizeof *fstatus); if (nfiles == 1 - && ((print_lines + print_words + print_chars + && ((print_lines + print_tlines + print_words + print_chars + print_bytes + print_linelength) == 1)) fstatus[0].failed = 1; @@ -611,10 +629,10 @@ atexit (close_stdout); exit_status = 0; - print_lines = print_words = print_chars = print_bytes = print_linelength = 0; - total_lines = total_words = total_chars = total_bytes = max_line_length = 0; + print_tlines = print_lines = print_words = print_chars = print_bytes = print_linelength = 0; + total_lines = total_tlines = total_words = total_chars = total_bytes = max_line_length = 0; - while ((optc = getopt_long (argc, argv, "clLmw", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, "cltLmw", longopts, NULL)) != -1) switch (optc) { case 0: @@ -632,6 +650,10 @@ print_lines = 1; break; + case 't': + print_tlines = 1; + break; + case 'w': print_words = 1; break; @@ -648,7 +670,7 @@ usage (EXIT_FAILURE); } - if (print_lines + print_words + print_chars + print_bytes + print_linelength + if (print_lines + print_words + print_chars + print_bytes + print_linelength + print_tlines == 0) print_lines = print_words = print_bytes = 1; @@ -670,7 +692,7 @@ wc_file (argv[optind + i], &fstatus[i]); if (nfiles > 1) - write_counts (total_lines, total_words, total_chars, total_bytes, + write_counts (total_lines, total_tlines, total_words, total_chars, total_bytes, max_line_length, _("total")); }