Import fixed arg.h from farbfeld

This fixes the handling of a { NULL } argv[] without returning argc =
-1.
This commit is contained in:
Laslo Hunhold 2017-08-02 13:54:10 +02:00
parent 075e314bdd
commit 84d77d096b

2
arg.h
View file

@ -22,7 +22,7 @@
extern char *argv0; extern char *argv0;
/* int main(int argc, char *argv[]) */ /* 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++) { \ *argv && (*argv)[0] == '-' && (*argv)[1]; argc--, argv++) { \
int argparsed; \ int argparsed; \
if ((*argv)[1] == '-' && (*argv)[2] == '\0') { \ if ((*argv)[1] == '-' && (*argv)[2] == '\0') { \