aboutsummaryrefslogtreecommitdiff
path: root/src/globals.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-11-01 00:49:32 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-11-01 00:49:32 +0100
commit500892b2ae64676d1855d8a357cd39e8a9e7f6c2 (patch)
tree2ab4ea40675d15a66d4a0c4295818f9f83e8c1b1 /src/globals.h
parent26a95b35414d0d4b729f3fd5da010debb70b412b (diff)
Add support for $GRAB_TABSIZE
Diffstat (limited to 'src/globals.h')
-rw-r--r--src/globals.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/globals.h b/src/globals.h
new file mode 100644
index 0000000..9475bc3
--- /dev/null
+++ b/src/globals.h
@@ -0,0 +1,51 @@
+#ifndef GRAB_GLOBALS_H
+#define GRAB_GLOBALS_H
+
+#include <stdatomic.h>
+
+#include <pcre2.h>
+
+#include "exitcodes.h"
+
+typedef struct {
+ char c;
+ pcre2_code *re;
+#if DEBUG
+ bool free_me;
+#endif
+} op_t;
+
+typedef struct {
+ bool b : 1;
+ bool c : 1;
+ bool i : 1;
+ bool l : 1;
+ bool p : 1;
+ bool s : 1;
+ bool U : 1;
+ bool z : 1;
+
+#if !GIT_GRAB
+ bool do_header : 1;
+#endif
+} flags_t;
+
+#if MAIN_C
+ #define maybe_extern
+#else
+ #define maybe_extern extern
+#endif
+
+maybe_extern flags_t flags;
+maybe_extern int grab_tabsize;
+maybe_extern op_t *ops;
+maybe_extern typeof(pcre2_match) *pcre2_match_fn;
+#if MAIN_C
+ atomic_int rv = EXIT_NOMATCH;
+ const char *lquot = "`", *rquot = "'";
+#else
+ extern atomic_int rv;
+ extern const char *lquot, *rquot;
+#endif
+
+#endif /* !GRAB_GLOBALS_H */ \ No newline at end of file