[hackers] [tabbed] Adding the missing arg.h for ARG* macros. || Christoph Lohmann
changeset: 158:5354ba0081c5
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Fri Apr 06 20:46:01 2012 +0200
files: arg.h
description:
Adding the missing arg.h for ARG* macros.
diff -r e99f4a61013a -r 5354ba0081c5 arg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/arg.h Fri Apr 06 20:46:01 2012 +0200
_AT_@ -0,0 +1,40 @@
+/*
+ * See LICENSE file for copyright and license details.
+ */
+
+#ifndef __CMD_H__
+#define __CMD_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
+
Received on Fri Apr 06 2012 - 20:46:05 CEST
This archive was generated by hypermail 2.3.0
: Fri Apr 06 2012 - 20:48:08 CEST