summaryrefslogtreecommitdiff
path: root/src/nice.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-09-08 18:23:12 +0000
committerJim Meyering <jim@meyering.net>1993-09-08 18:23:12 +0000
commitae0074289cd7d70cf8fb1d96f2625b2b9bb62b29 (patch)
treed5eab2eede21baf91b94efaf06e0df67cca78887 /src/nice.c
parent219bbb0758350d94610e967f31b5f9fdb0728354 (diff)
downloadcoreutils-ae0074289cd7d70cf8fb1d96f2625b2b9bb62b29.tar.xz
merge with 1.8.1 + partial --version and --help
Diffstat (limited to 'src/nice.c')
-rw-r--r--src/nice.c24
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)