]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
nl: deprecate --page-increment in favor of --line-increment
authorGiuseppe Scrivano <gscrivano@gnu.org>
Tue, 18 Aug 2009 10:22:37 +0000 (12:22 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 18 Aug 2009 16:40:41 +0000 (18:40 +0200)
* NEWS: Mention the change.
* doc/coreutils.texi: Document the new --line-increment option.
* src/nl.c (struct option): Add --line-increment,
(usage): Describe it,
(main): Use it.

NEWS
doc/coreutils.texi
src/nl.c

diff --git a/NEWS b/NEWS
index 85cc82bd75ce56e228a63b61fb31e0ed5e129751..5c4356e6ba5628df30829a1a79d31d70831a9aa0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,11 @@ GNU coreutils NEWS                                    -*- outline -*-
   were renamed from 'HARDLINK' and 'hl' which were available since
   coreutils-7.1 when this feature was introduced.
 
+** Deprecated options
+
+  nl --page-increment: deprecated in favor of --line-increment, the new option
+  maintains the previous semantics and the same short option, -i.
+
 ** New features
 
   chroot now accepts the options --userspec and --groups.
index bb1d87a870839d82d7929bc3e5f4566b9b0693f7..8e1b73d6371edf92ab7d3f1fec2f0a71cdb3392a 100644 (file)
@@ -1688,9 +1688,9 @@ Analogous to @option{--body-numbering}.
 Analogous to @option{--body-numbering}.
 
 @item -i @var{number}
-@itemx --page-increment=@var{number}
+@itemx --line-increment=@var{number}
 @opindex -i
-@opindex --page-increment
+@opindex --line-increment
 Increment line numbers by @var{number} (default 1).
 
 @item -l @var{number}
index 2deb314a45d4aae57687aec7ce3ecb88cf317a01..d63773a98c8c1d2252594587f3174269749ea241 100644 (file)
--- a/src/nl.c
+++ b/src/nl.c
@@ -144,13 +144,20 @@ static intmax_t line_no;
 /* True if we have ever read standard input.  */
 static bool have_read_stdin;
 
+enum
+{
+  PAGE_INCREMENT_OPTION_DEPRECATED = CHAR_MAX + 1
+};
+
 static struct option const longopts[] =
 {
   {"header-numbering", required_argument, NULL, 'h'},
   {"body-numbering", required_argument, NULL, 'b'},
   {"footer-numbering", required_argument, NULL, 'f'},
   {"starting-line-number", required_argument, NULL, 'v'},
-  {"page-increment", required_argument, NULL, 'i'},
+  {"line-increment", required_argument, NULL, 'i'},
+  /* FIXME: page-increment is deprecated, remove in dec-2011.  */
+  {"page-increment", required_argument, NULL, PAGE_INCREMENT_OPTION_DEPRECATED},
   {"no-renumber", no_argument, NULL, 'p'},
   {"join-blank-lines", required_argument, NULL, 'l'},
   {"number-separator", required_argument, NULL, 's'},
@@ -191,7 +198,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
 "), stdout);
       fputs (_("\
   -h, --header-numbering=STYLE    use STYLE for numbering header lines\n\
-  -i, --page-increment=NUMBER     line number increment at each line\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\
@@ -504,6 +511,10 @@ main (int argc, char **argv)
              ok = false;
            }
          break;
+  case PAGE_INCREMENT_OPTION_DEPRECATED:
+    error (0, 0, _("WARNING: --page-increment is deprecated; "
+                   "use --line-increment instead"));
+    /* fall through */
        case 'i':
          if (! (xstrtoimax (optarg, NULL, 10, &page_incr, "") == LONGINT_OK
                 && 0 < page_incr))