zrus.c
changeset 14 a961bb8806b9
parent 12 c755c945a96a
child 15 17a66ceb774a
equal deleted inserted replaced
13:f71e89074c62 14:a961bb8806b9
    94             ++i;
    94             ++i;
    95         }
    95         }
    96     }
    96     }
    97     dest[o] = 0;
    97     dest[o] = 0;
    98 }
    98 }
       
    99 
       
   100 int skip_newline(const char *str, int *index)
       
   101 {
       
   102     while(str[*index] != 0 && str[*index] != '\n')
       
   103     {
       
   104         ++*index;
       
   105     }
       
   106 
       
   107     if (str[*index] == '\n')
       
   108         return *index;
       
   109 
       
   110     return -1;
       
   111 }
       
   112 
       
   113 int until_noword(const char *str, int *index)
       
   114 {
       
   115     while(str[*index] != 0 &&
       
   116             str[*index] != ' ' &&
       
   117             str[*index] != '\n' &&
       
   118             str[*index] != '\r' &&
       
   119             str[*index] != ',')
       
   120     {
       
   121         ++*index;
       
   122     }
       
   123 
       
   124     if (str[*index] != 0)
       
   125         return *index;
       
   126 
       
   127     return -1;
       
   128 }
       
   129 
       
   130 int is_ASCII(unsigned char c)
       
   131 {
       
   132     if (c < 128)
       
   133         return 1;
       
   134     return 0;
       
   135 }
       
   136 
       
   137 int until_newword(const unsigned char *str, int *index)
       
   138 {
       
   139     while(str[*index] != 0 && is_ASCII(str[*index]))
       
   140     {
       
   141         ++*index;
       
   142     }
       
   143 
       
   144     if (str[*index] != 0);
       
   145         return *index;
       
   146 
       
   147     return -1;
       
   148 }