From 14c763637485061f88789392942343ddd419b9e6 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 26 Feb 2012 02:37:44 +0000 Subject: [PATCH] - Do not allow scripts to be named "None". SVN r3391 (trunk) --- error.c | 1 + error.h | 3 ++- misc.h | 4 ++++ parse.c | 4 ++++ strlist.c | 4 ---- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/error.c b/error.c index 7178403..f42510c 100644 --- a/error.c +++ b/error.c @@ -177,6 +177,7 @@ static struct { ERR_UNCLOSED_WITH_ARGS, "Most special scripts must not have arguments." }, { ERR_NOT_A_CHAR_ARRAY, "%s has %d dimensions. Use %d subscripts to get a char array." }, { ERR_CANT_FIND_INCLUDE, "Couldn't find include file \"%s\"." }, + { ERR_SCRIPT_NAMED_NONE, "Scripts may not be named \"None\"." }, { ERR_NONE, NULL } }; diff --git a/error.h b/error.h index abd800a..6e32127 100644 --- a/error.h +++ b/error.h @@ -144,7 +144,8 @@ typedef enum ERR_DISCONNECT_NEEDS_1_ARG, ERR_UNCLOSED_WITH_ARGS, ERR_NOT_A_CHAR_ARRAY, - ERR_CANT_FIND_INCLUDE + ERR_CANT_FIND_INCLUDE, + ERR_SCRIPT_NAMED_NONE, } error_t; // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- diff --git a/misc.h b/misc.h index 29c1e82..2c54035 100644 --- a/misc.h +++ b/misc.h @@ -15,6 +15,10 @@ // MACROS ------------------------------------------------------------------ +#ifdef _WIN32 +#define strcasecmp stricmp +#endif + // TYPES ------------------------------------------------------------------- typedef enum diff --git a/parse.c b/parse.c index ca0bfac..761efc2 100644 --- a/parse.c +++ b/parse.c @@ -560,6 +560,10 @@ static void OuterScript(void) } else if(tk_Token == TK_STRING) { // Named scripts start counting at -1 and go down from there. + if(strcasecmp("None", tk_String) == 0) + { + ERR_Error(ERR_SCRIPT_NAMED_NONE, YES, NULL); + } scriptNumber = -1 - STR_FindInListInsensitive(STRLIST_NAMEDSCRIPTS, tk_String); TK_NextToken(); } diff --git a/strlist.c b/strlist.c index 48188cb..6a86cb8 100644 --- a/strlist.c +++ b/strlist.c @@ -17,10 +17,6 @@ // MACROS ------------------------------------------------------------------ -#ifdef _WIN32 -#define strcasecmp stricmp -#endif - // TYPES ------------------------------------------------------------------- typedef struct