summaryrefslogtreecommitdiff
path: root/utils/misc.c
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-06-24 17:09:19 +0200
committerDaniil Baturin <daniil@baturin.org>2018-06-24 17:09:19 +0200
commit345dd8b4c3eb14e1161f26076a7b368ae89dd56d (patch)
treef5392ea019b350e340a87cdfd4731a00414e4760 /utils/misc.c
parent1489376748358222a1ba582cde019f494b6dcba3 (diff)
downloadvyatta-cfg-345dd8b4c3eb14e1161f26076a7b368ae89dd56d.tar.gz
vyatta-cfg-345dd8b4c3eb14e1161f26076a7b368ae89dd56d.zip
T710: move the executables from vyatta-util to vyatta-cfg
Do not use a shared library, since nothing else depends, or should depend on it.
Diffstat (limited to 'utils/misc.c')
-rw-r--r--utils/misc.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/misc.c b/utils/misc.c
new file mode 100644
index 0000000..d88f743
--- /dev/null
+++ b/utils/misc.c
@@ -0,0 +1,21 @@
+#include <regex.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+re_match(const char *string, char *pattern)
+{
+ int status;
+ regex_t re;
+ if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB) != 0) {
+ return 0;
+ }
+ status = regexec(&re, string, (size_t) 0, NULL, 0);
+ regfree(&re);
+ if (status != 0) {
+ return 0;
+ }
+ return 1;
+}