commit 84d77d096b79b201e43e87efe7ad4f9dadc3dfa6
parent 075e314bdd4f7756f7563b7b8ba645de712bf5ac
Author: Laslo Hunhold <dev@frign.de>
Date: Wed, 2 Aug 2017 13:54:10 +0200
Import fixed arg.h from farbfeld
This fixes the handling of a { NULL } argv[] without returning argc =
-1.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arg.h b/arg.h
@@ -22,7 +22,7 @@
extern char *argv0;
/* int main(int argc, char *argv[]) */
-#define ARGBEGIN for (argv0 = *argv, argc--, argv++; \
+#define ARGBEGIN for (argv0 = *argv, *argv ? (argc--, argv++) : ((void *)0); \
*argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \
int argparsed; \
if ((*argv)[1] == '-' && (*argv)[2] == '\0') { \