Fix inspector handling when inspector is disabled.
[surf.git] / arg.h
1 /*
2  * Copy me if you can.
3  * by 20h
4  */
5
6 #ifndef __ARG_H__
7 #define __ARG_H__
8
9 extern char *argv0;
10
11 #define USED(x) ((void)(x))
12
13 #define ARGBEGIN        for (argv0 = *argv, argv++, argc--;\
14                                         argv[0] && argv[0][1]\
15                                         && argv[0][0] == '-';\
16                                         argc--, argv++) {\
17                                 char _argc;\
18                                 char **_argv;\
19                                 if (argv[0][1] == '-' && argv[0][2] == '\0') {\
20                                         argv++;\
21                                         argc--;\
22                                         break;\
23                                 }\
24                                 for (argv[0]++, _argv = argv; argv[0][0];\
25                                                 argv[0]++) {\
26                                         if (_argv != argv)\
27                                                 break;\
28                                         _argc = argv[0][0];\
29                                         switch (_argc)
30
31 #define ARGEND                  }\
32                                 USED(_argc);\
33                         }\
34                         USED(argv);\
35                         USED(argc);
36
37 #define EARGF(x)        ((argv[1] == NULL)? ((x), abort(), (char *)0) :\
38                         (argc--, argv++, argv[0]))
39
40 #endif
41