fix missing stripostfix, and add stricmp (although one should use strcasecmp).
This commit is contained in:
25
packages/PLStream/pl-utils.c
Normal file
25
packages/PLStream/pl-utils.c
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#include "pl-incl.h"
|
||||
#include "pl-ctype.h"
|
||||
|
||||
#ifndef HAVE_STRICMP
|
||||
int
|
||||
stricmp(const char *s1, const char *s2)
|
||||
{ while(*s1 && makeLower(*s1) == makeLower(*s2))
|
||||
s1++, s2++;
|
||||
|
||||
return makeLower(*s1) - makeLower(*s2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
stripostfix(char *s, char *e)
|
||||
{ int ls = strlen(s);
|
||||
int le = strlen(e);
|
||||
|
||||
if ( ls >= le )
|
||||
return stricmp(&s[ls-le], e) == 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user