summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install/add/main.c
diff options
context:
space:
mode:
authorflz <flz@FreeBSD.org>2008-05-30 14:26:09 +0000
committerflz <flz@FreeBSD.org>2008-05-30 14:26:09 +0000
commit9a2047ba483ae2319d063ec4bd72a70e706bd7c1 (patch)
tree879a8bde309ee78659bbc86a35be8b5b8cb6071b /usr.sbin/pkg_install/add/main.c
parentabbda8507b5aecb2e8c4a237e56eb32f4b2d1308 (diff)
downloadFreeBSD-src-9a2047ba483ae2319d063ec4bd72a70e706bd7c1.zip
FreeBSD-src-9a2047ba483ae2319d063ec4bd72a70e706bd7c1.tar.gz
- Add long options to pkg_install.
- Remove check for '-?' as it's not listed in authorized options. - Bump PKG_INSTALL_VERSION to 20080530.
Diffstat (limited to 'usr.sbin/pkg_install/add/main.c')
-rw-r--r--usr.sbin/pkg_install/add/main.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 7a94f19..1556897 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -21,14 +21,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <err.h>
#include <sys/param.h>
#include <sys/utsname.h>
+#include <err.h>
+#include <getopt.h>
+
#include "lib.h"
#include "add.h"
-static char Options[] = "hviIRfFnrp:P:SMt:C:K";
-
char *Prefix = NULL;
Boolean PrefixRecursive = FALSE;
char *Chroot = NULL;
@@ -95,6 +95,25 @@ int getosreldate(void);
static void usage(void);
+static char opts[] = "hviIRfFnrp:P:SMt:C:K";
+static struct option longopts[] = {
+ { "chroot", required_argument, NULL, 'C' },
+ { "dry-run", no_argument, NULL, 'n' },
+ { "force", no_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "keep", no_argument, NULL, 'K' },
+ { "master", no_argument, NULL, 'M' },
+ { "no-deps", no_argument, NULL, 'i' },
+ { "no-record", no_argument, NULL, 'R' },
+ { "no-script", no_argument, NULL, 'I' },
+ { "prefix", required_argument, NULL, 'p' },
+ { "remote", no_argument, NULL, 'r' },
+ { "template", required_argument, NULL, 't' },
+ { "slave", no_argument, NULL, 'S' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
+};
+
int
main(int argc, char **argv)
{
@@ -110,7 +129,7 @@ main(int argc, char **argv)
PkgAddCmd = argv[0];
start = argv;
- while ((ch = getopt(argc, argv, Options)) != -1) {
+ while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch(ch) {
case 'v':
Verbose++;
@@ -170,12 +189,12 @@ main(int argc, char **argv)
case 'C':
Chroot = optarg;
break;
+
case 'i':
IgnoreDeps = TRUE;
break;
case 'h':
- case '?':
default:
usage();
break;
OpenPOWER on IntegriCloud