summaryrefslogtreecommitdiff
path: root/src/tsort.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-04-24 13:50:27 +0000
committerJim Meyering <jim@meyering.net>2003-04-24 13:50:27 +0000
commit034fcf16e384e5e94cdfa05398f9ad44ab399f6d (patch)
tree82b0a22520fdd8ac9fe9d5e5f27f691807c6551e /src/tsort.c
parenta3c951764e119735c499d515d2b36ece5c749353 (diff)
downloadcoreutils-034fcf16e384e5e94cdfa05398f9ad44ab399f6d.tar.xz
(tsort): Remove unnecessary test of have_read_stdin.
(main): Minor syntactic clean-up.
Diffstat (limited to 'src/tsort.c')
-rw-r--r--src/tsort.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/tsort.c b/src/tsort.c
index d7573de82..52f0550e3 100644
--- a/src/tsort.c
+++ b/src/tsort.c
@@ -534,8 +534,7 @@ tsort (const char *file)
if (n_strings > 0)
{
/* The input contains a loop. */
- error (0, 0, _("%s: input contains a loop:"),
- (have_read_stdin ? "-" : file));
+ error (0, 0, _("%s: input contains a loop:"), file);
exit_status = 1;
/* Print the loop and remove a relation to break it. */
@@ -574,16 +573,13 @@ main (int argc, char **argv)
have_read_stdin = 0;
- if (optind + 1 < argc)
+ if (1 < argc - optind)
{
error (0, 0, _("only one argument may be specified"));
usage (EXIT_FAILURE);
}
- if (optind < argc)
- tsort (argv[optind]);
- else
- tsort ("-");
+ tsort (optind == argc ? "-" : argv[optind]);
if (have_read_stdin && fclose (stdin) == EOF)
error (EXIT_FAILURE, errno, _("standard input"));