diff options
author | Jim Meyering <jim@meyering.net> | 1993-09-08 18:23:12 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-09-08 18:23:12 +0000 |
commit | ae0074289cd7d70cf8fb1d96f2625b2b9bb62b29 (patch) | |
tree | d5eab2eede21baf91b94efaf06e0df67cca78887 /src/nice.c | |
parent | 219bbb0758350d94610e967f31b5f9fdb0728354 (diff) | |
download | coreutils-ae0074289cd7d70cf8fb1d96f2625b2b9bb62b29.tar.xz |
merge with 1.8.1 + partial --version and --help
Diffstat (limited to 'src/nice.c')
-rw-r--r-- | src/nice.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/nice.c b/src/nice.c index 6386e519a..51218d8e7 100644 --- a/src/nice.c +++ b/src/nice.c @@ -15,7 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* David MacKenzie <djm@ai.mit.edu> */ +/* David MacKenzie <djm@gnu.ai.mit.edu> */ #include <stdio.h> #include <getopt.h> @@ -24,6 +24,8 @@ #include <sys/time.h> #include <sys/resource.h> #endif + +#include "version.h" #include "system.h" void error (); @@ -34,9 +36,17 @@ static void usage (); /* The name this program was run with. */ char *program_name; +/* If non-zero, display usage information and exit. */ +static int show_help; + +/* If non-zero, print the version on standard error. */ +static int show_version; + static struct option const longopts[] = { {"adjustment", required_argument, NULL, 'n'}, + {"help", no_argument, &show_help, 1}, + {"version", no_argument, &show_version, 1}, {NULL, 0, NULL, 0} }; @@ -60,6 +70,9 @@ main (argc, argv) { case '?': usage (); + + case 0: + break; case 'n': if (!isinteger (optarg)) @@ -78,6 +91,15 @@ main (argc, argv) } } + if (show_version) + { + printf ("%s\n", version_string); + exit (0); + } + + if (show_help) + usage (); + if (minusflag) adjustment = -adjustment; if (!adjustment_given) |