From 4cd5eeaf7dd938affab3457b46a786a82d13d099 Mon Sep 17 00:00:00 2001 From: Theron Date: Wed, 5 May 2021 22:12:01 -0500 Subject: posix regex syntax --- src/attach.c | 3 +-- src/whatfiles.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/attach.c b/src/attach.c index 5c9c647..1846288 100644 --- a/src/attach.c +++ b/src/attach.c @@ -36,13 +36,12 @@ char read_status(pid_t pid) FILE *h_status = fopen(path, "rb"); if (!h_status) return 0; read_file(str, 4096, h_status); - DEBUG("PROC FILE\n%s", str->data); int err; regmatch_t pmatch[2]; err = regexec(®ex, str->data, 2, pmatch, 0); if (err) { - DEBUG("failed to find regex match in /proc/%d/status file: 0x%x\n", pid, err); + DEBUG("failed to find regex match in /proc/%d/status file\n", pid); } else { c = *(str->data + pmatch[1].rm_so); } diff --git a/src/whatfiles.c b/src/whatfiles.c index 0004308..ac87ed7 100644 --- a/src/whatfiles.c +++ b/src/whatfiles.c @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) HashMap hashmap = &hm; init_hashmap(hashmap); - if (regcomp(®ex, "State:\\W+([A-Za-z])", REG_EXTENDED) != 0) { + if (regcomp(®ex, "State:[[:space:]]*([A-Za-z])", REG_EXTENDED) != 0) { SYS_ERR("regex compilation error"); } -- cgit v1.2.3