aboutsummaryrefslogtreecommitdiff
path: root/src/regex-match.c
diff options
context:
space:
mode:
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