]> code.citadel.org Git - citadel.git/blobdiff - webcit/tools.c
* Brought over yet another new version of the MIME parser from Citadel
[citadel.git] / webcit / tools.c
index 8bcccaed682a696b5d1703abd6ebec47cc741bdf..6b58ab9ffcaf438e48896751d0415319a98683c2 100644 (file)
@@ -262,4 +262,30 @@ char *memreadline(char *start, char *buf, int maxlen)
 
 
 
+/*
+ * pattern2()  -  searches for patn within search string, returns pos
+ */
+int pattern2(char *search, char *patn)
+{
+        int a;
+        for (a=0; a<strlen(search); ++a) {
+                if (!strncasecmp(&search[a],patn,strlen(patn))) return(a);
+                }
+        return(-1);
+        }
+
+
+/*
+ * Strip leading and trailing spaces from a string
+ */
+void striplt(char *buf)
+{
+        while ((strlen(buf) > 0) && (isspace(buf[0])))
+                strcpy(buf, &buf[1]);
+        while (isspace(buf[strlen(buf) - 1]))
+                buf[strlen(buf) - 1] = 0;
+}
+
+
+