Merge pull request #49 from tbamud/isname-bugfix
Revert "Multiple keyword support (#46)"
This commit is contained in:
@@ -81,8 +81,7 @@ int is_name(const char *str, const char *namelist)
|
|||||||
|
|
||||||
/* allow abbreviations */
|
/* allow abbreviations */
|
||||||
#define WHITESPACE " \t"
|
#define WHITESPACE " \t"
|
||||||
#define KEYWORDJOIN "_"
|
int isname(const char *str, const char *namelist)
|
||||||
int isname_tok(const char *str, const char *namelist)
|
|
||||||
{
|
{
|
||||||
char *newlist;
|
char *newlist;
|
||||||
char *curtok;
|
char *curtok;
|
||||||
@@ -106,34 +105,6 @@ int isname_tok(const char *str, const char *namelist)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int isname (const char *str, const char *namelist)
|
|
||||||
{
|
|
||||||
char *strlist;
|
|
||||||
char *substr;
|
|
||||||
|
|
||||||
if (!str || !*str || !namelist || !*namelist)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!strcmp (str, namelist)) /* the easy way */
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
strlist = strdup(str);
|
|
||||||
for (substr = strtok(strlist, KEYWORDJOIN); substr; substr = strtok (NULL, KEYWORDJOIN))
|
|
||||||
{
|
|
||||||
if (!substr) continue;
|
|
||||||
if (!isname_tok(substr, namelist))
|
|
||||||
{
|
|
||||||
free(strlist);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* If we didn't fail, assume we succeded because every token was matched */
|
|
||||||
free(strlist);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
|
static void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
|
||||||
{
|
{
|
||||||
switch (loc) {
|
switch (loc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user