Commit 5b46eee0 authored by Ulf Möller's avatar Ulf Möller
Browse files

strsep implementation to allow the file to compile on non-BSD systems

Submitted by: "Brian Havard" <brianh@kheldar.apana.org.au>
parent e5e6a94f
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -85,8 +85,39 @@ static int convert(unsigned char *s)
    return s-d;
    }

static char *sstrsep(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)])
        {
        (*string)++;
        }

    if (**string)
        {
        **string = 0;
        (*string)++;
        }

    return token;
    }

static unsigned char *ustrsep(char **p,const char *sep)
    { return (unsigned char *)strsep((char **)p,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,
@@ -297,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,":");