From 9a2047ba483ae2319d063ec4bd72a70e706bd7c1 Mon Sep 17 00:00:00 2001 From: flz Date: Fri, 30 May 2008 14:26:09 +0000 Subject: - Add long options to pkg_install. - Remove check for '-?' as it's not listed in authorized options. - Bump PKG_INSTALL_VERSION to 20080530. --- usr.sbin/pkg_install/delete/main.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'usr.sbin/pkg_install/delete/main.c') diff --git a/usr.sbin/pkg_install/delete/main.c b/usr.sbin/pkg_install/delete/main.c index 6bf0762..6075f72 100644 --- a/usr.sbin/pkg_install/delete/main.c +++ b/usr.sbin/pkg_install/delete/main.c @@ -24,12 +24,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include + #include "lib.h" #include "delete.h" -static char Options[] = "adDfGhinp:rvxX"; - char *Prefix = NULL; Boolean CleanDirs = FALSE; Boolean Interactive = FALSE; @@ -39,6 +39,25 @@ match_t MatchType = MATCH_GLOB; static void usage(void); +static char opts[] = "adDfGhinp:rvxX"; +static struct option longopts[] = { + { "all", no_argument, NULL, 'a' }, + { "clean-dirs", no_argument, NULL, 'd' }, + { "dry-run", no_argument, NULL, 'n' }, + { "extended", no_argument, NULL, 'X' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "interactive",no_argument, NULL, 'i' }, + { "prefix", required_argument, NULL, 'p' }, + { "recursive", no_argument, NULL, 'r' }, + { "regex", no_argument, NULL, 'x' }, + { "no-glob", no_argument, NULL, 'G' }, + { "no-script", no_argument, NULL, 'D' }, + { "no-scripts", no_argument, NULL, 'D' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 }, +}; + int main(int argc, char **argv) { @@ -49,7 +68,7 @@ main(int argc, char **argv) struct stat stat_s; pkgs = start = argv; - while ((ch = getopt(argc, argv, Options)) != -1) + while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) switch(ch) { case 'v': Verbose++; @@ -101,7 +120,6 @@ main(int argc, char **argv) break; case 'h': - case '?': default: usage(); break; -- cgit v1.1