strsep implementation to allow the file to compile on non-BSD systems
[openssl.git] / crypto / evp / evp_test.c
index 87be6953789e99d4343ee1e303ee5a7f43f397b7..df02ea6047861a72031074a933923d067b97b9aa 100644 (file)
@@ -85,7 +85,7 @@ static int convert(unsigned char *s)
     return s-d;
     }
 
-static unsigned char *ustrsep(char **string ,const char *delim)
+static char *sstrsep(char **string, const char *delim)
     {
     char isdelim[256];
     char *token = *string;
@@ -97,28 +97,28 @@ static unsigned char *ustrsep(char **string ,const char *delim)
     isdelim[0] = 1;
 
     while (*delim)
-       {
+        {
         isdelim[(unsigned char)(*delim)] = 1;
         delim++;
-       }
+        }
 
     while (!isdelim[(unsigned char)(**string)])
-       {
-       while (!isdelim[(unsigned char)(**string)])
-           {
-           (*string)++;
-           }
+        {
+        (*string)++;
+        }
 
-        if (**string)
-           {
-            **string = 0;
-           (*string)++;
-           }
+    if (**string)
+        {
+        **string = 0;
+        (*string)++;
+        }
 
-       return token;
-       }
+    return token;
     }
 
+static unsigned char *ustrsep(char **p,const char *sep)
+    { return (unsigned char *)sstrsep((char **)p,sep); }
+
 static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
                  const unsigned char *iv,int in,
                  const unsigned char *plaintext,int pn,
@@ -328,7 +328,7 @@ int main(int argc,char **argv)
        if(line[0] == '#' || line[0] == '\n')
            continue;
        p=line;
-       cipher=strsep(&p,":");  
+       cipher=sstrsep(&p,":"); 
        key=ustrsep(&p,":");
        iv=ustrsep(&p,":");
        plaintext=ustrsep(&p,":");