In Crafty:
int OptionMatch(char *command, char *input){
/* ************************************************************ * * * check for the obvious exact match first. * * * ************************************************************ */
if (!strcmp(command, input))
return (1);
/* ************************************************************ * *
* now use strstr() to see if "input" is in "command." *
* the first requirement is that input matches command *
* starting at the very left-most character; * * * ************************************************************ */
if (strstr(command, input) == command)
return (1);
return (0);
}
It seems better to use "if " than "if-else" if it returns in the statement...
星期二, 十二月 20, 2005
订阅:
博文评论 (Atom)
没有评论:
发表评论