aboutsummaryrefslogtreecommitdiff
path: root/src/globals.h
blob: fea375d51efe466f2a64ae0ecf36b466b040e888 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#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;

enum {
	HDR_NEVER,
	HDR_MULTI,
	HDR_ALWAYS,
};

typedef struct {
	bool     c : 1;
	unsigned H : 2;
	bool     i : 1;
	bool     l : 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;
#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 */