summaryrefslogtreecommitdiffstats
path: root/src/whatfiles.c
diff options
context:
space:
mode:
authorTheron Spiegl <tspiegl@gmail.com>2020-09-30 21:25:39 -0500
committerTheron Spiegl <tspiegl@gmail.com>2020-09-30 21:25:39 -0500
commit0cbb3a1da6038fb85810be7f334c9987c323eece (patch)
tree6822a5df491b761125bb1d4f4875ad7ad3c78a69 /src/whatfiles.c
parentee98a26f4e9df88cabeb11cfdbaf6f06b3aace30 (diff)
don't compile regex in loopv1.0
Diffstat (limited to 'src/whatfiles.c')
-rw-r--r--src/whatfiles.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/whatfiles.c b/src/whatfiles.c
index fb9f291..0004308 100644
--- a/src/whatfiles.c
+++ b/src/whatfiles.c
@@ -1,4 +1,5 @@
#include <dirent.h>
+#include <regex.h>
#include <signal.h>
#include <stddef.h>
#include <string.h>
@@ -14,6 +15,7 @@
FILE *Handle = (FILE*)NULL;
int Debug = 0;
+regex_t regex;
LastSyscall_t LastSyscall;
DebugStats_t DebugStats;
@@ -92,6 +94,10 @@ int main(int argc, char* argv[])
HashMap hashmap = &hm;
init_hashmap(hashmap);
+ if (regcomp(&regex, "State:\\W+([A-Za-z])", REG_EXTENDED) != 0) {
+ SYS_ERR("regex compilation error");
+ }
+
int start_of_user_command = discover_flags(argc, argv);
char *user_filename = parse_flags(start_of_user_command, argv, &pid, &stdout_override, &attach);
if (start_of_user_command == argc && !attach) {
@@ -210,6 +216,7 @@ int main(int argc, char* argv[])
}
}
+ regfree(&regex);
err = destroy(hashmap);
HASH_ERR_CHECK(err, "tried to free null pointers in hashmap.\n")
fclose(Handle);