Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Long options
Matthew Seaman committed 11 years ago
commit bb38f9e925ad88f8e324d2e56b361492f8bc89f6
parent 7993e68
1 file changed +18 -10
modified src/repo.c
@@ -24,6 +24,7 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#include <getopt.h>
#include <sysexits.h>
#include <stdio.h>
#include <string.h>
@@ -86,23 +87,30 @@ password_cb(char *buf, int size, int rwflag, void *key)
int
exec_repo(int argc, char **argv)
{
-
	int ret;
-
	int pos = 0;
-
	int ch;
-
	bool filelist = false;
-
	char *output_dir = NULL;
-

-
	while ((ch = getopt(argc, argv, "lo:q")) != -1) {
+
	int	 ret;
+
	int	 pos = 0;
+
	int	 ch;
+
	bool	 filelist = false;
+
	char	*output_dir = NULL;
+

+
	struct option longopts[] = {
+
		{ "list-files", no_argument,		NULL,	'l' },
+
		{ "output-dir", required_argument,	NULL,	'o' },
+
		{ "quiet",	no_argument,		NULL,	'q' },
+
		{ NULL,		0,			NULL,	0   },
+
	};
+

+
	while ((ch = getopt_long(argc, argv, "lo:q", longopts, NULL)) != -1) {
		switch (ch) {
-
		case 'q':
-
			quiet = true;
-
			break;
		case 'l':
			filelist = true;
			break;
		case 'o':
			output_dir = optarg;
			break;
+
		case 'q':
+
			quiet = true;
+
			break;
		default:
			usage_repo();
			return (EX_USAGE);