1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

tsort: add do-nothing -w option

This is for conformance to POSIX.1-2024
* src/tsort.c: Include getopt.h.
(main): Accept and ignore -w.  Do not bother altering
the usage message, as the option is useless.
* tests/misc/tsort.pl (cycle-3): New test.
This commit is contained in:
Paul Eggert
2025-08-14 09:17:51 -07:00
parent 2543c0052c
commit 39eec70f7b
4 changed files with 36 additions and 5 deletions

View File

@@ -31,6 +31,10 @@ my @Tests =
['cycle-2', {IN => {f => "t x\nt s\ns t\n"}}, {OUT => "s\nt\nx\n"},
{EXIT => 1},
{ERR => "tsort: f: input contains a loop:\ntsort: s\ntsort: t\n"} ],
['cycle-3', '-w', {IN => {f => "a a\na b\na c\nc a\nb a"}},
{OUT => "a\nc\nb\n"}, {EXIT => 1},
{ERR => "tsort: f: input contains a loop:\ntsort: a\ntsort: b\n"
. "tsort: f: input contains a loop:\ntsort: a\ntsort: c\n"} ],
['posix-1', {IN => "a b c c d e\ng g\nf g e f\nh h\n"},
{OUT => "a\nc\nd\nh\nb\ne\nf\ng\n"}],