diff options
author | Christoph Lohmann <20h@r-36.net> | 2012-10-31 21:13:50 +0100 |
---|---|---|
committer | Christoph Lohmann <20h@r-36.net> | 2012-10-31 21:13:50 +0100 |
commit | 4ce3808684c5ea5d14eab0c3e24119784d2ae255 (patch) | |
tree | 798f6f8bbeb49552bba1618883c6168803c7a1d1 /arg.h | |
parent | 0b885f18e3aebee047e952620f8541491fe77b8a (diff) | |
download | surf-4ce3808684c5ea5d14eab0c3e24119784d2ae255.tar.gz surf-4ce3808684c5ea5d14eab0c3e24119784d2ae255.tar.bz2 surf-4ce3808684c5ea5d14eab0c3e24119784d2ae255.zip |
Add options for scriptfile, cookiefile and stylefile. And changing the default
behaviour of buildpath to be more like in open().
Diffstat (limited to 'arg.h')
-rw-r--r-- | arg.h | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef __ARG_H__ +#define __ARG_H__ + +extern char *argv0; + +#define USED(x) ((void)(x)) + +#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ + argv[0] && argv[0][1]\ + && argv[0][0] == '-';\ + argc--, argv++) {\ + char _argc;\ + char **_argv;\ + if (argv[0][1] == '-' && argv[0][2] == '\0') {\ + argv++;\ + argc--;\ + break;\ + }\ + for (argv[0]++, _argv = argv; argv[0][0];\ + argv[0]++) {\ + if (_argv != argv)\ + break;\ + _argc = argv[0][0];\ + 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 + |