* src/nl.c (main): Allow -i to accept down to INTMAX_MIN.
* tests/misc/nl.sh: Add test cases.
* NEWS: Mention the new feature.
ls --classify now supports the "always", "auto", or "never" flags,
to support only outputting classifier characters if connected to a tty.
+ nl --line-increment can now take a negative number to decrement the count.
+
** Improvements
stat and tail now know about the "vboxsf" file system type.
@opindex -i
@opindex --line-increment
Increment line numbers by @var{number} (default 1).
+@var{number} can be negative to decrement.
@item -l @var{number}
@itemx --join-blank-lines=@var{number}
@opindex -v
@opindex --starting-line-number
Set the initial line number on each logical page to @var{number} (default 1).
+The starting @var{number} can be negative.
@item -w @var{number}
@itemx --number-width=@var{number}
0);
break;
case 'i':
- page_incr = xdectoimax (optarg, 1, INTMAX_MAX, "",
+ page_incr = xdectoimax (optarg, INTMAX_MIN, INTMAX_MAX, "",
_("invalid line number increment"), 0);
break;
case 'p':
compare exp out || fail=1
returns_ 1 nl -p -v$INTMAX_MAX in.txt > out || fail=1
+# Test negative iteration
+returns_ 1 nl -i$INTMAX_UFLOW /dev/null || fail=1
+printf '%s\n' a b > in.txt || framework_failure_
+nl -v$INTMAX_MAX -i$INTMAX_MIN in.txt > out || fail=1
+cat <<EOF > exp
+$INTMAX_MAX a
+ -1 b
+EOF
+compare exp out || fail=1
+printf '%s\n' a b c > in.txt || framework_failure_
+returns_ 1 nl -v$INTMAX_MAX -i$INTMAX_MIN in.txt > out || fail=1
+
Exit $fail