[hackers] [scc] Move arg.h to inc/ || Quentin Rameau
commit 283bf2e17c0ffb78933cc52c502803609dfadda7
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Wed May 25 16:35:02 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Wed May 25 16:35:02 2016 +0200
Move arg.h to inc/
diff --git a/arg.h b/arg.h
deleted file mode 100644
index 0b23c53..0000000
--- a/arg.h
+++ /dev/null
_AT_@ -1,65 +0,0 @@
-/*
- * Copy me if you can.
- * by 20h
- */
-
-#ifndef ARG_H__
-#define ARG_H__
-
-extern char *argv0;
-
-/* use main(int argc, char *argv[]) */
-#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
- argv[0] && argv[0][0] == '-'\
- && argv[0][1];\
- argc--, argv++) {\
- char argc_;\
- char **argv_;\
- int brk_;\
- if (argv[0][1] == '-' && argv[0][2] == '\0') {\
- argv++;\
- argc--;\
- break;\
- }\
- for (brk_ = 0, argv[0]++, argv_ = argv;\
- argv[0][0] && !brk_;\
- argv[0]++) {\
- if (argv_ != argv)\
- break;\
- argc_ = argv[0][0];\
- switch (argc_)
-
-/* Handles obsolete -NUM syntax */
-#define ARGNUM case '0':\
- case '1':\
- case '2':\
- case '3':\
- case '4':\
- case '5':\
- case '6':\
- case '7':\
- case '8':\
- case '9'
-
-#define ARGEND }\
- }
-
-#define ARGC() argc_
-
-#define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX))
-
-#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
- ((x), abort(), (char *)0) :\
- (brk_ = 1, (argv[0][1] != '\0')?\
- (&argv[0][1]) :\
- (argc--, argv++, argv[0])))
-
-#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
- (char *)0 :\
- (brk_ = 1, (argv[0][1] != '\0')?\
- (&argv[0][1]) :\
- (argc--, argv++, argv[0])))
-
-#define LNGARG() &argv[0][0]
-
-#endif
diff --git a/cc1/main.c b/cc1/main.c
index 116d77f..82c78ec 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -5,7 +5,7 @@
#include <string.h>
#include <errno.h>
-#include "../arg.h"
+#include "../inc/arg.h"
#include "../inc/cc.h"
#include "arch.h"
#include "cc1.h"
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index ca7f97d..3c9073a 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -11,7 +11,7 @@
#include <stdlib.h>
#include <string.h>
-#include "../../arg.h"
+#include "../../inc/arg.h"
#include "../../inc/cc.h"
char *argv0;
diff --git a/inc/arg.h b/inc/arg.h
new file mode 100644
index 0000000..0b23c53
--- /dev/null
+++ b/inc/arg.h
_AT_@ -0,0 +1,65 @@
+/*
+ * Copy me if you can.
+ * by 20h
+ */
+
+#ifndef ARG_H__
+#define ARG_H__
+
+extern char *argv0;
+
+/* use main(int argc, char *argv[]) */
+#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
+ argv[0] && argv[0][0] == '-'\
+ && argv[0][1];\
+ argc--, argv++) {\
+ char argc_;\
+ char **argv_;\
+ int brk_;\
+ if (argv[0][1] == '-' && argv[0][2] == '\0') {\
+ argv++;\
+ argc--;\
+ break;\
+ }\
+ for (brk_ = 0, argv[0]++, argv_ = argv;\
+ argv[0][0] && !brk_;\
+ argv[0]++) {\
+ if (argv_ != argv)\
+ break;\
+ argc_ = argv[0][0];\
+ switch (argc_)
+
+/* Handles obsolete -NUM syntax */
+#define ARGNUM case '0':\
+ case '1':\
+ case '2':\
+ case '3':\
+ case '4':\
+ case '5':\
+ case '6':\
+ case '7':\
+ case '8':\
+ case '9'
+
+#define ARGEND }\
+ }
+
+#define ARGC() argc_
+
+#define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX))
+
+#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
+ ((x), abort(), (char *)0) :\
+ (brk_ = 1, (argv[0][1] != '\0')?\
+ (&argv[0][1]) :\
+ (argc--, argv++, argv[0])))
+
+#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
+ (char *)0 :\
+ (brk_ = 1, (argv[0][1] != '\0')?\
+ (&argv[0][1]) :\
+ (argc--, argv++, argv[0])))
+
+#define LNGARG() &argv[0][0]
+
+#endif
Received on Wed May 25 2016 - 16:41:44 CEST
This archive was generated by hypermail 2.3.0
: Wed May 25 2016 - 16:48:14 CEST