summaryrefslogtreecommitdiff
path: root/src/mknod.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-04-02 04:26:26 +0000
committerJim Meyering <jim@meyering.net>1993-04-02 04:26:26 +0000
commitee871dbed84a671bad1217b23ad3802ab023e26c (patch)
treee35f1c605334d3d40c2ea1cd67fada6cd41d9d62 /src/mknod.c
parent0a6061f1f9178df1bfddaff7b25dbf5393833096 (diff)
downloadcoreutils-ee871dbed84a671bad1217b23ad3802ab023e26c.tar.xz
Add --help and --version options.
Diffstat (limited to 'src/mknod.c')
-rw-r--r--src/mknod.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mknod.c b/src/mknod.c
index 66029ad0f..7e65ac01f 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include "system.h"
#include "modechange.h"
+#include "version.h"
void error ();
@@ -40,9 +41,17 @@ static void usage ();
/* The name this program was run with. */
char *program_name;
+/* If non-zero, display usage information and exit. */
+static int flag_help;
+
+/* If non-zero, print the version on standard error. */
+static int flag_version;
+
static struct option const longopts[] =
{
{"mode", required_argument, NULL, 'm'},
+ {"help", no_argument, &flag_help, 1},
+ {"version", no_argument, &flag_version, 1},
{NULL, 0, NULL, 0}
};
@@ -71,6 +80,12 @@ main (argc, argv)
}
}
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
newmode = 0666 & ~umask (0);
if (symbolic_mode)
{