the same as realpath with no options. The corresponding long option
is --canonicalize.
+ tsort now accepts and ignores -w, to conform to POSIX.1-2024.
+
** Improvements
'factor' is now much faster at identifying large prime numbers,
@code{parse_options} may be placed anywhere in the list as long as it
precedes @code{main}.
-The only options are @option{--help} and @option{--version}. @xref{Common
-options}.
+To conform to POSIX.1-2024, @command{tsort} accepts and ignores the
+option @option{-w}. The only other options are @option{--help} and
+@option{--version}. @xref{Common options}.
@exitstatus
#include <config.h>
+#include <getopt.h>
#include <sys/types.h>
#include "system.h"
atexit (close_stdout);
- parse_gnu_standard_options_only (argc, argv, PROGRAM_NAME, PACKAGE_NAME,
- Version, true, usage, AUTHORS,
- (char const *) nullptr);
+ while (true)
+ {
+ static struct option const long_options[] =
+ {
+ {GETOPT_HELP_OPTION_DECL},
+ {GETOPT_VERSION_OPTION_DECL},
+ {nullptr, 0, nullptr, 0}
+ };
+ int c = getopt_long (argc, argv, "w", long_options, nullptr);
+
+ if (c == -1)
+ break;
+
+ switch (c)
+ {
+ case 'w':
+ break;
+
+ case_GETOPT_HELP_CHAR;
+
+ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
+
+ default:
+ usage (EXIT_FAILURE);
+ }
+ }
if (1 < argc - optind)
{
['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"}],