aboutsummaryrefslogtreecommitdiff
path: root/src/regex-match.c
diff options
context:
space:
mode:
authorLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 05:23:31 +0000
committerLibravatar Martin Michalec <martin@michalec.dev>2026-11-08 05:24:55 +0000
commit3f36aca66e1ac6c872300059e8db691a473614d4 (patch)
tree48c65f463c487d281c7c4091c7ba01dd4a2ff8f1 /src/regex-match.c
downloadlab-02-master.tar.gz
publishHEADmaster
Diffstat (limited to 'src/regex-match.c')
-rw-r--r--src/regex-match.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/regex-match.c b/src/regex-match.c
new file mode 100644
index 0000000..d59bee7
--- /dev/null
+++ b/src/regex-match.c
@@ -0,0 +1,21 @@
1// regex-match.c --- match string against a pattern using regex
2// Usage: regex-match string
3#include <stdlib.h>
4#include <stdio.h>
5#include "regex.h"
6
7int
8main (int argc, char *argv[])
9{
10 const char *progname = *argv++;
11
12 if (argc != 2) {
13 fprintf (stderr, "Usage: %s string\n", progname);
14 return EXIT_FAILURE;
15 }
16
17 const char *string = *argv++;
18
19 return regex_match (string);
20}
21// regex-match.c ends here