Introduction
Introduction Statistics Contact Development Disclaimer Help
tadd arg.h - granular - granular dynamics simulation
git clone git://src.adamsgaard.dk/granular
Log
Files
Refs
README
LICENSE
---
commit e9d0900081d592028d4f522e50d22ddd51209c73
parent 5c5dd722931a8ce81829b023ffa16a92f0872de1
Author: Anders Damsgaard <[email protected]>
Date: Thu, 18 Mar 2021 00:15:21 +0100
add arg.h
Diffstat:
A arg.h | 38 +++++++++++++++++++++++++++++…
1 file changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/arg.h b/arg.h
t@@ -0,0 +1,38 @@
+/* by 20h */
+#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;\
+ if(argv[0][1] == '-' && argv[0][2] == '\0') {\
+ argv++;\
+ argc--;\
+ break;\
+ }\
+ int i_;\
+ 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
+
You are viewing proxied material from mx1.adamsgaard.dk. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.