aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c11
-rw-r--r--lib/lib.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 6559030c..681d4d23 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -1033,3 +1033,14 @@ char *next_printf(char *s, char **start)
return 0;
}
+
+// Posix inexplicably hasn't got this, so find str in line.
+char *strnstr(char *line, char *str)
+{
+ long len = strlen(str);
+ char *s;
+
+ for (s = line; *s; s++) if (!strncasecmp(s, str, len)) break;
+
+ return *s ? s : 0;
+}
diff --git a/lib/lib.h b/lib/lib.h
index 2714ad3d..dac3b67f 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -199,6 +199,7 @@ int qstrcmp(const void *a, const void *b);
void create_uuid(char *uuid);
char *show_uuid(char *uuid);
char *next_printf(char *s, char **start);
+char *strnstr(char *line, char *str);
#define HR_SPACE 1 // Space between number and units
#define HR_B 2 // Use "B" for single byte units