From 4b3e5a6bd64335ad207167fa8fd39a098c50c1db Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 6 Jul 2019 15:33:46 -0700 Subject: Handle argv = { NULL } in ARGBEGIN --- arg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arg.h b/arg.h index 6a3f112..9756516 100644 --- a/arg.h +++ b/arg.h @@ -1,6 +1,7 @@ #define ARGBEGIN \ for (;;) { \ - ++argv, --argc; \ + if (argc > 0) \ + ++argv, --argc; \ if (argc == 0 || (*argv)[0] != '-') \ break; \ if ((*argv)[1] == '-' && !(*argv)[2]) { \ -- cgit v1.2.3