diff options
author | KOBAYASHI Takashi <a1415tk@aiit.ac.jp> | 2016-05-01 13:47:25 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-05-14 12:41:43 +0100 |
commit | 43df058b91e94c096b642291737daea1d2868cdb (patch) | |
tree | 6834af8ebfe36a8f4b0ad5b5ae8ff6e4cfeaa281 /src | |
parent | 99dd47ec86b508410df64bef2b7bf4922215cf5b (diff) | |
download | coreutils-43df058b91e94c096b642291737daea1d2868cdb.tar.xz |
nl: reset numbering for each section
* NEWS: Mention the bug fix.
* src/nl.c (proc_body, proc_footer): Reset numbering here too.
* doc/coreutils.texi (nl invocation): Adjust for behavior change.
* tests/misc/nl.sh: Add a test case.
Diffstat (limited to 'src')
-rw-r--r-- | src/nl.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -185,7 +185,7 @@ Write each FILE to standard output, with line numbers added.\n\ fputs (_("\ -b, --body-numbering=STYLE use STYLE for numbering body lines\n\ - -d, --section-delimiter=CC use CC for separating logical pages\n\ + -d, --section-delimiter=CC use CC for logical page delimiters\n\ -f, --footer-numbering=STYLE use STYLE for numbering footer lines\n\ "), stdout); fputs (_("\ @@ -193,20 +193,20 @@ Write each FILE to standard output, with line numbers added.\n\ -i, --line-increment=NUMBER line number increment at each line\n\ -l, --join-blank-lines=NUMBER group of NUMBER empty lines counted as one\n\ -n, --number-format=FORMAT insert line numbers according to FORMAT\n\ - -p, --no-renumber do not reset line numbers at logical pages\n\ + -p, --no-renumber do not reset line numbers for each section\n\ -s, --number-separator=STRING add STRING after (possible) line number\n\ "), stdout); fputs (_("\ - -v, --starting-line-number=NUMBER first line number on each logical page\n\ + -v, --starting-line-number=NUMBER first line number for each section\n\ -w, --number-width=NUMBER use NUMBER columns for line numbers\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\ \n\ -By default, selects -v1 -i1 -l1 -sTAB -w6 -nrn -hn -bt -fn. CC are\n\ -two delimiter characters for separating logical pages, a missing\n\ -second character implies :. Type \\\\ for \\. STYLE is one of:\n\ +By default, selects -v1 -i1 -l1 -sTAB -w6 -nrn -hn -bt -fn.\n\ +CC are two delimiter characters used to construct logical page delimiters,\n\ +a missing second character implies :. Type \\\\ for \\. STYLE is one of:\n\ "), stdout); fputs (_("\ \n\ @@ -298,6 +298,8 @@ proc_body (void) { current_type = body_type; current_regex = &body_regex; + if (reset_numbers) + line_no = starting_line_number; putchar ('\n'); } @@ -308,6 +310,8 @@ proc_footer (void) { current_type = footer_type; current_regex = &footer_regex; + if (reset_numbers) + line_no = starting_line_number; putchar ('\n'); } |