Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Long options
Matthew Seaman committed 11 years ago
commit 18587ed038ee3a6e9d2573c7ac7a49dc3d93e7cd
parent 4c0f4f8
1 file changed +25 -18
modified src/updating.c
@@ -37,6 +37,7 @@
#define _WITH_GETLINE
#include <err.h>
#include <errno.h>
+
#include <getopt.h>
#include <pkg.h>
#include <stdio.h>
#include <string.h>
@@ -61,29 +62,35 @@ usage_updating(void)
int
exec_updating(int argc, char **argv)
{
-
	char *date = NULL;
-
	char *dateline = NULL;
-
	char *updatingfile = NULL;
-
	struct installed_ports *port;
+
	char			*date = NULL;
+
	char			*dateline = NULL;
+
	char			*updatingfile = NULL;
+
	struct installed_ports	*port;
	SLIST_HEAD(,installed_ports) origins;
-
	int ch;
-
	char *line = NULL;
-
	size_t linecap = 0;
-
	ssize_t linelen;
-
	char *tmp;
-
	int head = 0;
-
	int found = 0;
-
	struct pkgdb *db = NULL;
-
	struct pkg *pkg = NULL;
-
	struct pkgdb_it *it = NULL;
-
	const char *origin;
-
	FILE *fd;
-
	int retcode = EXIT_SUCCESS;
+
	int			 ch;
+
	char			*line = NULL;
+
	size_t			 linecap = 0;
+
	ssize_t			 linelen;
+
	char			*tmp;
+
	int			 head = 0;
+
	int			 found = 0;
+
	struct pkgdb		*db = NULL;
+
	struct pkg		*pkg = NULL;
+
	struct pkgdb_it		*it = NULL;
+
	const char		*origin;
+
	FILE			*fd;
+
	int			 retcode = EXIT_SUCCESS;
#ifdef HAVE_CAPSICUM
	cap_rights_t rights;
#endif

-
	while ((ch = getopt(argc, argv, "d:f:")) != -1) {
+
	struct option longopts[] = {
+
		{ "date",	required_argument,	NULL,	'd' },
+
		{ "file",	required_argument,	NULL,	'f' },
+
		{ NULL,		0,			NULL,	0   },
+
	};
+

+
	while ((ch = getopt_long(argc, argv, "d:f:", longopts, NULL)) != -1) {
		switch (ch) {
		case 'd':
			date = optarg;