diff common/strhelp.c @ 142:52993db093f4

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 24 Mar 2014 16:06:50 +0100
parents 5fa4791d6d0e
children b026e6d2a161
line wrap: on
line diff
--- a/common/strhelp.c	Mon Mar 24 16:03:05 2014 +0100
+++ b/common/strhelp.c	Mon Mar 24 16:06:50 2014 +0100
@@ -1,3 +1,4 @@
+#include <ctype.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -109,7 +110,7 @@
   size_t l1 = strlen(s1);
   size_t l2 = strlen(s2);
   if ((l1 == l2) &&
-      (strncmp(s1, s2, l1) == 0))
+      (strcmp(s1, s2) == 0))
     return true;
   else
     return false;
@@ -123,3 +124,17 @@
   else
     return false;
 }
+
+void
+str_trim (char **s)
+{
+  size_t i;
+  if (*s != NULL)
+    {
+      while (isspace(**s))
+        (*s)++;
+      i = strlen(*s);
+      while (isspace((*s)[--i]))
+        (*s)[i] = '\0';
+    }
+}

http://wald.intevation.org/projects/trustbridge/