From bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 15 Mar 2014 01:49:50 +0100 Subject: Lean and mean initial commit Not much functionality yet --- matchstring.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 matchstring.c (limited to 'matchstring.c') diff --git a/matchstring.c b/matchstring.c new file mode 100644 index 0000000..61bbec8 --- /dev/null +++ b/matchstring.c @@ -0,0 +1,21 @@ +#include "byte.h" +#include "bstr.h" +#include "asn1.h" + +/* behave like strcmp */ +int matchstring(struct string* s,const char* c) { + unsigned int l,l1,i; + if (!c) return -1; + l1=l=bstrlen(c); + if (s->ll; + c=bstrfirst(c); + i=byte_diff(s->s,l1,c); + if (i) return i; + /* same length? */ + if (l==s->l) return 0; + /* one is a prefix of the other */ + if (l1s[l1]); +} + -- cgit v1.2.3-55-g7522