1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 08:52:28 +02:00

eeshow/misc/util.h (strbegins): !strncmp(s, prefix, strlen(prefix))

This commit is contained in:
Werner Almesberger 2016-08-22 21:24:42 -03:00
parent 465a36fde5
commit fe6d3a9e85

View File

@ -14,8 +14,9 @@
#ifndef MISC_UTIL_H
#define MISC_UTIL_H
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -63,4 +64,10 @@
#define unsupported(s) \
fprintf(stderr, __FILE__ ":%d: unsupported: " s "\n", __LINE__)
static inline bool strbegins(const char *s, const char *prefix)
{
return !strncmp(s, prefix, strlen(prefix));
}
#endif /* !MISC_UTIL_H */