arg.h (518B)
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 ARGBEGIN for(argv0 = *argv, argv++, argc--;\ 12 argc && argv[0][0] == '-'\ 13 && argv[0][1];\ 14 argc--, argv++) {\ 15 char *_arg;\ 16 if(argv[0][1] == '-' && argv[0][2] == '\0') {\ 17 argv++;\ 18 argc--;\ 19 break;\ 20 }\ 21 for(_arg = argv[0] + 1; *_arg;) {\ 22 switch (*_arg++) 23 24 #define ARGEND }\ 25 } 26 27 #define EARGF(x) (argc ? (argc--, argv++, argv[0]) : \ 28 ((x), abort(), (char *)0)) 29 #endif 30