commit 3f9e501f6b8bd747ac8127ca56e34db0409e03d1 Author: dsp <d...@2f30.org> Date: Mon Nov 11 19:53:01 2013 +0000
Add ARGNUM and ARGNUMF(base) This is useful to support the obsolete syntax -NUM for tools like head, tail and fold. diff --git a/arg.h b/arg.h index 2009b70..b8f48c0 100644 --- a/arg.h +++ b/arg.h @@ -29,11 +29,25 @@ extern char *argv0; _argc = argv[0][0];\ switch (_argc) +/* Handles obsolete -NUM syntax */ +#define ARGNUM case '0':\ + case '1':\ + case '2':\ + case '3':\ + case '4':\ + case '5':\ + case '6':\ + case '7':\ + case '8':\ + case '9' + #define ARGEND }\ } #define ARGC() _argc +#define ARGNUMF(base) (brk = 1, estrtol(argv[0], (base))) + #define EARGF(x) ((argv[0][1] == '