From fa7a1e19e2b4fcec1f67ebd75f6f12ae65eef8c8 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 17 Oct 1993 03:57:04 +0000 Subject: merge with 1.8.1g --- src/dirname.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/dirname.c') diff --git a/src/dirname.c b/src/dirname.c index b6b46d738..0aebb9793 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -54,10 +54,26 @@ static struct option const long_options[] = }; static void -usage () +usage (status) + int status; { - fprintf (stderr, "Usage: %s [{--help,--version}] path\n", program_name); - exit (1); + fprintf (status == 0 ? stdout : stderr, "\ +Usage: %s [OPTION]... PATH\n\ +", + program_name); + + if (status != 0) + fprintf (stderr, "\nTry `%s --help' for more information.\n", + program_name); + else + + printf ("\ +\n\ + --help display this help and exit\n\ + --version output version information and exit\n\ +"); + + exit (status); } void @@ -79,7 +95,7 @@ main (argc, argv) break; default: - usage (); + usage (1); } } @@ -90,10 +106,10 @@ main (argc, argv) } if (show_help) - usage (); + usage (0); if (argc - optind != 1) - usage (); + usage (1); path = argv[optind]; strip_trailing_slashes (path); -- cgit v1.2.3-54-g00ecf