summaryrefslogtreecommitdiff
path: root/src/sum.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
committerJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
commitb869639f4661488eba0bb2d08020c6e71bb72627 (patch)
treee325845ec7ca06b4d59fcc07e87020897c7c4d9b /src/sum.c
parentd1df8c198d8878b77d1d1583bc7b3c491534616a (diff)
downloadcoreutils-b869639f4661488eba0bb2d08020c6e71bb72627.tar.xz
merge with 1.8d+
Diffstat (limited to 'src/sum.c')
-rw-r--r--src/sum.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/sum.c b/src/sum.c
index 3cf17662c..67527e142 100644
--- a/src/sum.c
+++ b/src/sum.c
@@ -65,11 +65,29 @@ static struct option const longopts[] =
};
static void
-usage ()
+usage (status)
+ int status;
{
- fprintf (stderr, "\
-Usage: %s [-rs] [--help] [--version] [--sysv] [file...]\n", program_name);
- exit (1);
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
+Usage: %s [OPTION]... [FILE]...\n\
+",
+ program_name);
+ printf ("\
+\n\
+ -r defeat -s, use BSD sum algorithm, use 1K blocks\n\
+ -s, --sysv use System V sum algorithm, use 512 bytes blocks\n\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
+\n\
+With no FILE, or when FILE is -, read standard input.\n\
+");
+ }
+ exit (status);
}
void
@@ -101,7 +119,7 @@ main (argc, argv)
break;
default:
- usage ();
+ usage (1);
}
}
@@ -112,7 +130,7 @@ main (argc, argv)
}
if (show_help)
- usage ();
+ usage (0);
files_given = argc - optind;
if (files_given == 0)