summaryrefslogtreecommitdiff
path: root/src/install.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/install.c
parent0a6061f1f9178df1bfddaff7b25dbf5393833096 (diff)
downloadcoreutils-ee871dbed84a671bad1217b23ad3802ab023e26c.tar.xz
Add --help and --version options.
Diffstat (limited to 'src/install.c')
-rw-r--r--src/install.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/install.c b/src/install.c
index 4fccb8447..dd8b58cc7 100644
--- a/src/install.c
+++ b/src/install.c
@@ -59,9 +59,11 @@
#include <pwd.h>
#include <grp.h>
#include "system.h"
+#include "version.h"
#include "modechange.h"
#if !defined (isascii) || defined (STDC_HEADERS)
+#undef isascii
#define isascii(c) 1
#endif
@@ -130,6 +132,12 @@ static int strip_files;
/* If nonzero, install a directory instead of a regular file. */
static int dir_arg;
+/* 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 long_options[] =
{
{"strip", no_argument, NULL, 's'},
@@ -137,6 +145,8 @@ static struct option const long_options[] =
{"group", required_argument, NULL, 'g'},
{"mode", required_argument, NULL, 'm'},
{"owner", required_argument, NULL, 'o'},
+ {"help", no_argument, &flag_help, 1},
+ {"version", no_argument, &flag_version, 1},
{NULL, 0, NULL, 0}
};
@@ -190,6 +200,12 @@ main (argc, argv)
|| (optind == argc - 1 && !dir_arg))
usage ();
+ if (flag_version)
+ fprintf (stderr, "%s\n", version_string);
+
+ if (flag_help)
+ usage ();
+
if (symbolic_mode)
{
struct mode_change *change = mode_compile (symbolic_mode, 0);