blob: cfdb5419126456264d79283b914761590c5ddeb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef ARG_H
#define ARG_H
#define USED(x) ((void)(x))
extern char *argv0;
#define ARGBEGIN for(argv0 = *argv, argv++, argc--;\
argv[0] && argv[0][0] == '-'\
&& argv[0][1];\
argc--, argv++) {\
char _argc;\
char **_argv;\
int i_;\
if(argv[0][1] == '-' && argv[0][2] == '\0') {\
argv++;\
argc--;\
break;\
}\
for(i_ = 1, _argv = argv; argv[0][i_];\
i_++) {\
if(_argv != argv)\
break;\
_argc = argv[0][i_];\
switch(_argc)
#define ARGEND }\
USED(_argc);\
}\
USED(argv);\
USED(argc);
#define EARGF(x) ((argv[1] == NULL)? ((x), abort(), (char *)0) :\
(argc--, argv++, argv[0]))
#endif
|