[hackers] [quark] Import fixed arg.h from farbfeld || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Wed, 2 Aug 2017 13:54:34 +0200 (CEST)

commit 84d77d096b79b201e43e87efe7ad4f9dadc3dfa6
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Wed Aug 2 13:54:10 2017 +0200
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Wed Aug 2 13:54:10 2017 +0200

    Import fixed arg.h from farbfeld
    
    This fixes the handling of a { NULL } argv[] without returning argc =
    -1.

diff --git a/arg.h b/arg.h
index 003f8ec..cf30d65 100644
--- a/arg.h
+++ b/arg.h
_AT_@ -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') { \
Received on Wed Aug 02 2017 - 13:54:34 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 02 2017 - 14:02:03 CEST