don't modify argv, use a counter

on some platforms (OpenBSD) this changes the exposed argv in tools
using the kvm_* interface, such as ps and pgrep.
This commit is contained in:
Hiltjo Posthuma 2017-11-18 12:35:33 +01:00
parent 0fedff44e3
commit 31b2445000

9
arg.h
View File

@ -21,12 +21,13 @@ extern char *argv0;
argc--;\ argc--;\
break;\ break;\
}\ }\
for (brk_ = 0, argv[0]++, argv_ = argv;\ int i_;\
argv[0][0] && !brk_;\ for (i_ = 1, brk_ = 0, argv_ = argv;\
argv[0]++) {\ argv[0][i_] && !brk_;\
i_++) {\
if (argv_ != argv)\ if (argv_ != argv)\
break;\ break;\
argc_ = argv[0][0];\ argc_ = argv[0][i_];\
switch (argc_) switch (argc_)
#define ARGEND }\ #define ARGEND }\