zrus.c
changeset 14 a961bb8806b9
parent 12 c755c945a96a
child 15 17a66ceb774a
--- a/zrus.c	Tue Aug 28 08:40:49 2007 +0200
+++ b/zrus.c	Wed Aug 29 00:19:14 2007 +0200
@@ -96,3 +96,53 @@
     }
     dest[o] = 0;
 }
+
+int skip_newline(const char *str, int *index)
+{
+    while(str[*index] != 0 && str[*index] != '\n')
+    {
+        ++*index;
+    }
+
+    if (str[*index] == '\n')
+        return *index;
+
+    return -1;
+}
+
+int until_noword(const char *str, int *index)
+{
+    while(str[*index] != 0 &&
+            str[*index] != ' ' &&
+            str[*index] != '\n' &&
+            str[*index] != '\r' &&
+            str[*index] != ',')
+    {
+        ++*index;
+    }
+
+    if (str[*index] != 0)
+        return *index;
+
+    return -1;
+}
+
+int is_ASCII(unsigned char c)
+{
+    if (c < 128)
+        return 1;
+    return 0;
+}
+
+int until_newword(const unsigned char *str, int *index)
+{
+    while(str[*index] != 0 && is_ASCII(str[*index]))
+    {
+        ++*index;
+    }
+
+    if (str[*index] != 0);
+        return *index;
+
+    return -1;
+}