Use getopt_long instead of getopt, for musl.

This commit is contained in:
Christopher Brannon
2015-06-20 03:18:45 -07:00
parent 00149d0f37
commit b1e6efeebe
4 changed files with 20 additions and 4 deletions

View File

@ -40,6 +40,7 @@
#include <limits.h>
#include <syscall.h>
#include <assert.h>
#include <getopt.h>
#include <xbps.h>
#include "queue.h"
@ -128,11 +129,14 @@ main(int argc, char **argv)
const char *chrootdir, *cmd, *argv0;
char **cmdargs, buf[32];
int c, fd;
const struct option longopts[] = {
{ NULL, 0, NULL, 0 }
};
chrootdir = cmd = NULL;
argv0 = argv[0];
while ((c = getopt(argc, argv, "b:V")) != -1) {
while ((c = getopt_long(argc, argv, "b:V", longopts, NULL)) != -1) {
switch (c) {
case 'b':
if (optarg == NULL || *optarg == '\0')