Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Mar 2008 09:00:05 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 137990 for review
Message-ID:  <200803180900.m2I905AQ094813@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=137990

Change 137990 by gcooper@gcooper-starr on 2008/03/18 08:59:42

	Add in more stubs for arg parsers -- yes I'm still alive and yes I'm finally free to some extent. Here goes to "Agile FreeBSD Coding"! Scrum!

Affected files ...

.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/add/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/add/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/check/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/check/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/clean/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/clean/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/create/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/create/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/delete/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/delete/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/info/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/info/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/show/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/show/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/sign/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/sign/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/update/arg_parser.c#2 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/update/arg_parser.h#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/version/arg_parser.c#3 edit
.. //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/version/arg_parser.h#3 edit

Differences ...

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/add/arg_parser.c#3 (text+ko) ====

@@ -1,60 +1,67 @@
-#include "ap/add/arg_parser.h"
+#include "add/arg_parser.h"
 
+/*
+ * Parse all flags strictly relevant to adding packages. 
+ */
 int
-pkg_action_add_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_add_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
-	while ((ch = getopt(argc, argv, options)) != -1) {
-		switch(ch) {
-		case 'C':
-			strlcpy(add.chroot, optarg, PATH_MAX);
-			break;
-		case 'f':
-			add.flags |= force_flag;
+	char opt_char;
+
+	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_ADD_OPTS)) != -1)
+	{
+
+		switch(opt_char) {
+		case 'F':
+			*(settings+s_off)->remote_fetch_mode = 1;
 			break;
 		case 'I':
-			add.flags |= no_run_script_flag;
+			add.flags |= no_install_script_flag;
 			break;
 		case 'K':
 			/* Save the package file in . or ${PKGDIR} */
 			add.flags |= keep_file_flag;
 			break;
-		case 'M':
-			errx(1, "Unsupported argument");
-			break;
-		case 'n':
-			add.flags |= no_run_flag;
-			break;
 		case 'P':
-			add.base_prefix = optarg;
-			add.prefix = optarg;
+// @todo: Replace __prefix_level with the appropriate data member in **settings for the appropriate struct pkg_action_settings object.
+//			sscanf(optarg, "%d", &__prefix_level);
+			warnx("Feature, represented by -%c not available yet",
+			opt_char);
 			break;
-		case 'p':
-			add.base_prefix = optarg;
-			add.prefix = NULL;
-			break;
 		case 'R':
 			add.flags |= no_record_install_flag;
 			break;
-		case 'r':
-			remote = 1;
-			break;
-		case 'S':
-			errx(1, "Unsupported argument");
-			break;
 		case 't':
-			errx(1, "The -t argument is unneeded as the staging area is unused");
-			break;
-		case 'v':
-			add.flags |= verbosity_flag;
-			break;
-		case 'h':
-		case '?':
-		default:
-			usage();
-			break;
+			errx(1, "The -%c argument is unused.", opt_char);
+		/** Return integer **/
+//		default:
+//			return -1;
 		}
+
 	}
 
 }
+
+void
+print_add_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman add -FIKR -P [prefix] -t [template string]"
+		"\t-F\n"
+		"\t\tEnable Remote fetch mode (formerly -r).\n"
+		"\t-I\n"
+		"\t\tDon't run install scripts.\n"
+		"\t-K\n"
+		"\t\tKeep all [recursively] downloaded packages\n"
+		"\t-P [prefix]\n"
+		"\t\tUse prefix as the installation prefix.\n"
+		"\t-R\n"
+		"\t\tDo not record package install (use with caution!)\n"
+		"\t-t [template string]\n"
+		"\t\tUse string provided as a basis for calls to mkdtemp(3) / mkstemp(3).\n"
+	);
+}

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/add/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_ADD_AP_H
 
-int	pkg_action_add_parse_args(pkg_action_settings *, int, char **);
-void	pkg_action_add_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_add_args(const int, struct pkg_action_settings**, int, char **);
+void	print_add_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/check/arg_parser.c#3 (text+ko) ====

@@ -1,8 +1,52 @@
-#include "ap/check/arg_parser.h"
+#include "check/arg_parser.h"
 
+/*
+ * Parse the arguments for pkg_check(1).
+ */
 int
-pkg_action_check_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_check_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
+{
+
+	char opt_char;
+
+	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_CHECK_OPTS)) != -1)
+	{
+		switch (opt_char) {
+/*
+		case 'k':
+			break;
+		case 't':
+			break;
+		case 'u':
+			break;
+*/
+		default:
+			return -1;
+		}
+	}
+
+}
+
+/*
+ * Print out usage message
+ */
+void
+print_check_args()
 {
-	/** Same ole song **/
+
+	/** XXX: Update with appropriate descriptions **/
+	fprintf(stderr,
+		"Usage: pkgman check -k [keyfile] -t [cypher type] -u [uid]\n"
+		"\t-k [keyfile]\n"
+		"\t\t\n" /** Like here **/
+		"\t-t [cypher type]\n"
+		"\t\tCheck package signature with cypher type provided.\n"
+		"\t\tThis can be 'pgp', 'sha1', or 'x509'.\n"
+		"\t-u [uid]\n"
+		"\t\tUse userid as argument when passed into pgp(1). Doesn't apply for sha1(1) or x590(1).\n"
+	);
+
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/check/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_CHECK_AP_H
 
-int	pkg_action_check_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_check_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_check_args(const int, struct pkg_action_settings**, int, char **);
+void	print_check_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/clean/arg_parser.c#3 (text+ko) ====

@@ -1,9 +1,25 @@
-#include "ap/clean/arg_parser.h"
+#include "clean/arg_parser.h"
 
 int
-parse_clean_args(pkg_settings **settings, int settings_offset, char *opt_string,
-	int opt_cnt)
+parse_clean_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
+	char opt_char;
+
+	/** Same ole song **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_CLEAN_OPTS)) != -1)
+	{
+		/*
+		 *
+		 */
+	}
+
+}
 
+void
+print_clean_args()
+{
+	fprintf(stderr, "pkgman clean [global options]");
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/clean/arg_parser.h#3 (text+ko) ====

@@ -2,8 +2,13 @@
 
 #define __PKG_ACT_CLEAN_AP_H
 
-int	pkg_action_clean_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_clean_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
 
+int	parse_clean_args(const int, struct pkg_action_settings**, int, char **);
+void	print_clean_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/create/arg_parser.c#3 (text+ko) ====

@@ -1,4 +1,4 @@
-#include "ap/create/arg_parser.h"
+#include "create/arg_parser.h"
 
 /*
  * Parse arguments specific to pkg_create(1).
@@ -8,135 +8,144 @@
  * @return  1 on failure (argument supported; invalid input).
  */
 int
-parse_create_args(pkg_settings **settings, int settings_offset, char *opt_string,
-	int opt_cnt)
+parse_create_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
 	char opt_char;
 
-	if (0 != scan_search_opts(*settings, opt_char)) {
+	if (0 != scan_search_opts(*(settings+settings_offset), optarg_in,
+		optind_in))
+	{
 		
 	}
 
-	if (0 != scan_ui_opts(*settings, opt_string)) {
+	if (0 != scan_ui_opts(*(settings+settings_offset), optarg_in,
+		optind_in))
+	{
 
 	}
 
-	switch(opt_char) {
-	case 'E':
-	    MatchType = MATCH_EREGEX;
-	    break;
-	case 'G':
-	    MatchType = MATCH_REGEX;
-	    break;
-	case 'x':
-	    MatchType = MATCH_EXACT;
-	    break;
+	/** Same ole song **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_CREATE_OPTS)) != -1)
+	{
 
-	case 'N':
-	    AutoAnswer = NO;
-	    break;
+		switch(opt_char) {
 
-	case 'Y':
-	    AutoAnswer = YES;
-	    break;
+		case 'E':
+		    MatchType = MATCH_EREGEX;
+		    break;
+		case 'G':
+		    MatchType = MATCH_REGEX;
+		    break;
+		case 'x':
+		    MatchType = MATCH_EXACT;
+		    break;
 
-	case 'r':
-	    Recursive = TRUE;
-	    break;
+		case 's':
+		    SrcDir = optarg;
+		    break;
 
-	case 's':
-	    SrcDir = optarg;
-	    break;
+		case 'S':
+		    BaseDir = optarg;
+		    break;
 
-	case 'S':
-	    BaseDir = optarg;
-	    break;
+		case 'f':
+		    Contents = optarg;
+		    break;
 
-	case 'f':
-	    Contents = optarg;
-	    break;
+		case 'C':
+		    Conflicts = optarg;
+		    break;
 
-	case 'C':
-	    Conflicts = optarg;
-	    break;
+		case 'c':
+		    Comment = optarg;
+		    break;
 
-	case 'c':
-	    Comment = optarg;
-	    break;
+		case 'd':
+		    Desc = optarg;
+		    break;
 
-	case 'd':
-	    Desc = optarg;
-	    break;
+		case 'i':
+		    Install = optarg;
+		    break;
 
-	case 'i':
-	    Install = optarg;
-	    break;
+		case 'I':
+		    PostInstall = optarg;
+		    break;
 
-	case 'I':
-	    PostInstall = optarg;
-	    break;
+		case 'k':
+		    DeInstall = optarg;
+		    break;
 
-	case 'k':
-	    DeInstall = optarg;
-	    break;
+		case 'K':
+		    PostDeInstall = optarg;
+		    break;
 
-	case 'K':
-	    PostDeInstall = optarg;
-	    break;
+		case 'R':
+		    Require = optarg;
+		    break;
 
-	case 'R':
-	    Require = optarg;
-	    break;
+		case 't':
+// This needs to match the template item..
+//		    strlcpy(PlayPen, optarg, sizeof(PlayPen));
+		    break;
 
-	case 't':
-	    strlcpy(PlayPen, optarg, sizeof(PlayPen));
-	    break;
+		case 'X':
+		    ExcludeFrom = optarg;
+		    break;
 
-	case 'X':
-	    ExcludeFrom = optarg;
-	    break;
+		case 'h':
+		    Dereference = TRUE;
+		    break;
 
-	case 'h':
-	    Dereference = TRUE;
-	    break;
+		case 'D':
+		    Display = optarg;
+		    break;
 
-	case 'D':
-	    Display = optarg;
-	    break;
+		case 'm':
+		    Mtree = optarg;
+		    break;
 
-	case 'm':
-	    Mtree = optarg;
-	    break;
+		case 'P':
+		    Pkgdeps = optarg;
+		    break;
 
-	case 'P':
-	    Pkgdeps = optarg;
-	    break;
+		case 'j':
+		    Zipper = BZIP2;
+		    break;
 
-	case 'j':
-	    Zipper = BZIP2;
-	    break;
+		case 'z':
+		    Zipper = GZIP;
+		    break;
 
-	case 'z':
-	    Zipper = GZIP;
-	    break;
+		case 'b':
+		    InstalledPkg = optarg;
+		    while ((tmp = strrchr(optarg, (int)'/')) != NULL) {
+			*tmp++ = '\0';
+			/*
+			 * If character after the '/' is alphanumeric, then we've
+			 * found the package name.  Otherwise we've come across
+			 * a trailing '/' and need to continue our quest.
+			 */
+			if (isalpha(*tmp)) {
+			    InstalledPkg = tmp;
+			    break;
+			}
+		    }
+		    break;
 
-	case 'b':
-	    InstalledPkg = optarg;
-	    while ((tmp = strrchr(optarg, (int)'/')) != NULL) {
-		*tmp++ = '\0';
-		/*
-		 * If character after the '/' is alphanumeric, then we've
-		 * found the package name.  Otherwise we've come across
-		 * a trailing '/' and need to continue our quest.
-		 */
-		if (isalpha(*tmp)) {
-		    InstalledPkg = tmp;
-		    break;
 		}
-	    }
-	    break;
 
 	}
 
 }
+
+void
+print_create_args()
+{
+	fprintf(stderr,
+		"pkgman create "
+	);
+}

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/create/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_CREATE_AP_H
 
-int	pkg_action_create_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_create_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_create_args(const int, struct pkg_action_settings**, int, char **);
+void	print_create_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/delete/arg_parser.c#3 (text+ko) ====

@@ -1,50 +1,44 @@
-#include "ap/delete/arg_parser.h"
+#include "delete/arg_parser.h"
 
 int
-pkg_action_delete_parse_args(pkg_settings **settings, int settings_offset,
-	char *opt_string, int opt_cnt)
+parse_delete_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
+	char opt_char;
+
 	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_DELETE_OPTS)) != -1)
 	{
 
-		case 'a':
-			delete.match_type = PKG_DB_MATCH_ALL;
-			break;
 		case 'd':
 			delete.flags |= remove_empty_dirs_flag;
 			break;
 		case 'D':
 			delete.flags |= no_run_script_flag;
 			break;
-		case 'f':
-			delete.flags |= force_flag;
-			break;
-		case 'G':
-			delete.match_type = PKG_DB_MATCH_EXACT;
-			break;
 		case 'i':
 			delete.flags |= interactive_flag;
 			break;
-		case 'n':
-			delete.flags |= no_run_flag;
+		default:
+			return -1;
 			break;
-		case 'p':
-			delete.prefix = optarg;
-			errx(1, "Unsupported argument");
-			break;
-		case 'r':
-			delete.flags |= recursive_flag;
-			break;
-		case 'v':
-			delete.flags |= verbosity_flag;
-			break;
-		case 'x':
-			delete.match_type = PKG_DB_MATCH_REGEX;
-			break;
-		case 'X':
-			delete.match_type = PKG_DB_MATCH_EREGEX;
+	}
+
+}
 
-	}
+void
+print_delete_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman delete -dDi [package meta string]\n"
+		"\t-d\n"
+		"\tPrune empty directories.\n"
+		"\t-D\n"
+		"\tDon't execute deinstall scripts.\n"
+		"\t-i\n"
+		"\tBe interactive (ask before deleting).\n"
+	);
 
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/delete/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_DELETE_AP_H
 
-int	pkg_action_delete_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_delete_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_delete_args(const int, struct pkg_action_settings**, int, char **);
+void	print_delete_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/info/arg_parser.c#3 (text+ko) ====

@@ -1,16 +1,18 @@
 #include "ap/info/arg_parser.h"
 
 int
-pkg_action_info_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_info_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
-	/** getopt blah goes here.. **/	
+	char opt_char;
+
+	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_INFO_OPTS)) != -1)
 	{
 
-		case 'a':
-			info.match_type = MATCH_ALL;
-			break;
+		switch(opt_char) {
 		case 'b':
 			info.use_blocksize = 1;
 			break;
@@ -24,7 +26,7 @@
 			info.flags |= SHOW_DISPLAY;
 			break;
 		case 'e':
-			info.check_package = optarg;
+			info.check_package = strdup(optarg);
 			break;
 		case 'E':
 			info.flags |= SHOW_PKGNAME;
@@ -35,13 +37,10 @@
 		case 'g':
 			info.flags |= SHOW_CKSUM;
 			break;
-		case 'G':
-			info.match_type = MATCH_EXACT;
-			break;
 		case 'i':
 			info.flags |= SHOW_INSTALL;
 			break;
-		case 'I':
+		case 'N':
 			info.flags |= SHOW_INDEX;
 			break;
 		case 'j':
@@ -51,7 +50,7 @@
 			info.flags |= SHOW_DEINSTALL;
 			break;
 		case 'l':
-			info.separator = optarg;
+			info.separator = strdup(optarg);
 			break;
 		case 'L':
 			info.flags |= SHOW_FILES;
@@ -63,20 +62,11 @@
 			info.flags |= SHOW_ORIGIN;
 			break;
 		case 'O':
-			info.origin = optarg;
-			break;
-		case 'p':
-			info.flags |= SHOW_PREFIX;
+			info.origin = strdup(optarg);
 			break;
 		case 'P':
 			info.flags |= SHOW_PTREV;
 			break;
-		case 'q':
-			info.quiet = 1;
-			break;
-		case 'Q':
-			info.quiet = 2;
-			break;
 		case 'r':
 			info.flags |= SHOW_DEPEND;
 			break;
@@ -86,9 +76,6 @@
 		case 's':
 			info.flags |= SHOW_SIZE;
 			break;
-		case 't':
-			errx(1, "Unsupported argument");
-			break;
 		case 'V':
 			info.flags |= SHOW_FMTREV;
 			break;
@@ -102,12 +89,17 @@
 			/* Insert found argument at head of list */
 			SLIST_INSERT_HEAD();
 			break;
-		case 'x':
-			info.match_type = MATCH_REGEX;
-			break;
-		case 'X':
-			info.match_type = MATCH_EREGEX;
+
+		}
 
 	}
 
 }
+
+void
+print_info_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman info"
+	);
+}

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/info/arg_parser.h#3 (text+ko) ====

@@ -2,8 +2,13 @@
 
 #define __PKG_ACT_INFO_AP_H
 
-int	pkg_action_info_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_info_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
 
+int	parse_info_args(const int, struct pkg_action_settings**, int, char **);
+void	print_info_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/show/arg_parser.c#3 (text+ko) ====

@@ -1,14 +1,32 @@
-#include "ap/show/arg_parser.h"
+#include "show/arg_parser.h"
 
 /*
  * The steps req'd should be similar for pkg_show, as for pkg_version, as far
  * as searching for the pkgs is concerned..
+ *
+ * The purpose of this action is merely to show information regarding the
+ * package of reference.
  */
 int
-pkg_action_show_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_show_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
-	return -1;
+	char opt_char;
+
+	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_SHOW_OPTS)) != -1)
+	{
+		return -1;
+	}
+
+}
 
+void
+print_show_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman show"
+	);
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/show/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_SHOW_AP_H
 
-int	pkg_action_show_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_show_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_show_args(const int, struct pkg_action_settings**, int, char **);
+void	print_show_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/sign/arg_parser.c#3 (text+ko) ====

@@ -1,12 +1,21 @@
-#include "ap/sign/arg_parser.h"
+#include "sign/arg_parser.h"
 
 int
-pkg_action_sign_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_sign_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
 
+	char opt_char;
+
+	/** Parse args **/
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_SIGN_OPTS)) != -1)
 	{
 
+		switch(opt_char) {
+		case 'k':
+		    	userkey = optarg;
+			break;
 		case 't':
 			if (strcmp(optarg, "pgp") == 0) 
 				type = TAG_PGP;
@@ -20,23 +29,16 @@
 		case 'u':
 			userid = strdup(optarg);
 			break;
+		}
 
-		case 'k':
-		    	userkey = optarg;
-			break;
+	}
 
-		case 'q':
-		    	quiet = 1;
-			break;
+}
 
-#ifndef CHECKER_ONLY
-		case 's':
-			mode = SIGN;
-			break;
-#endif
-		case 'c':
-			mode = CHECK;
-
-	}
-
+void
+print_sign_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman sign"
+	);
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/sign/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_SIGN_AP_H
 
-int	pkg_action_sign_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_sign_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+
+int	parse_sign_args(const int, struct pkg_action_settings**, int, char **);
+void	print_sign_usage();
 
 #endif

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/update/arg_parser.c#2 (text+ko) ====

@@ -1,12 +1,51 @@
-#include "ap/update/arg_parser.h"
+#include "update/arg_parser.h"
 
 /*
- * Finish off implementation. Should be pkg_version junk, followed up by
- * with pkg_delete and pkg_add commands.
+ * Finish off implementation.
+ *
+ * Should be version junk, followed up by with delete and
+ * add commands; this should only be required when adding
+ * alone doesn't muster up for the task.
+ *
+ * Part of the purpose of this is to dispose of the ugly
+ * PKG_REGISTER_FORCE hack currently used by pkg_add(1), as well
+ * as ease package maintenance by giving users the option of
+ * streamlining the monotonous inclusive tasks of adding and
+ * deleting packages.
+ *
  */
 int
-pkg_action_update_parse_args(pkg_action_settings *settings, int optind,
-	char **optarg)
+parse_update_args(const int s_off, struct pkg_action_settings **settings,
+	int optind_in, char **optarg_in)
 {
+
 	return -1;
+
+	char opt_char;
+
+	/*
+	 * Parse args -- instead of duplicating the arg parsing,
+	 * let the add and delete arg parsers do the majority of
+	 * the work, piggyback off of them, and add in additional
+	 * functionality, as seen fit..
+	 */
+	while ((opt_char = getopt(optind_in, optarg_in,
+		PKG_UPDATE_OPTS)) != -1)
+	{
+
+		switch(opt_char) {
+
+		}
+
+	}
+
+}
+
+void
+print_update_args()
+{
+	fprintf(stderr,
+		"Usage: pkgman update"
+	);
+
 }

==== //depot/projects/soc2007/revised_fbsd_pkgtools/pkg_revised/v2/pkgman/ap/update/arg_parser.h#3 (text+ko) ====

@@ -2,7 +2,13 @@
 
 #define __PKG_ACT_UPDATE_AP_H
 
-int	pkg_action_update_parse_args(pkg_action_settings*, int, char **);
-void	pkg_action_update_print_usage();
+#include "ap/lib/includes.h"
+
+#define PKG_ADD_OPTS "FIKP:Rt:"
+
+struct pkg_action_settings;
+

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200803180900.m2I905AQ094813>