]> granicus.if.org Git - openssl/commitdiff
strsep implementation to allow the file to compile on non-BSD systems
authorUlf Möller <ulf@openssl.org>
Sat, 1 Sep 2001 05:05:32 +0000 (05:05 +0000)
committerUlf Möller <ulf@openssl.org>
Sat, 1 Sep 2001 05:05:32 +0000 (05:05 +0000)
Submitted by: "Brian Havard" <brianh@kheldar.apana.org.au>

crypto/evp/evp_test.c

index 1fdc9976190edcdf3aa7e9deca97d52adea626b5..87be6953789e99d4343ee1e303ee5a7f43f397b7 100644 (file)
@@ -85,8 +85,39 @@ static int convert(unsigned char *s)
     return s-d;
     }
 
-static unsigned char *ustrsep(char **p,const char *sep)
-    { return (unsigned char *)strsep((char **)p,sep); }
+static unsigned char *ustrsep(char **string ,const char *delim)
+    {
+    char isdelim[256];
+    char *token = *string;
+
+    if (**string == 0)
+        return NULL;
+
+    memset(isdelim, 0, 256);
+    isdelim[0] = 1;
+
+    while (*delim)
+       {
+        isdelim[(unsigned char)(*delim)] = 1;
+        delim++;
+       }
+
+    while (!isdelim[(unsigned char)(**string)])
+       {
+       while (!isdelim[(unsigned char)(**string)])
+           {
+           (*string)++;
+           }
+
+        if (**string)
+           {
+            **string = 0;
+           (*string)++;
+           }
+
+       return token;
+       }
+    }
 
 static void test1(const EVP_CIPHER *c,const unsigned char *key,int kn,
                  const unsigned char *iv,int in,