Skip to content

Instantly share code, notes, and snippets.

@lexszero
Created January 12, 2015 05:47
Show Gist options
  • Save lexszero/ad062d7d9b7693006380 to your computer and use it in GitHub Desktop.
Save lexszero/ad062d7d9b7693006380 to your computer and use it in GitHub Desktop.
/* well, let's see who you are... */
int cmd_allowed(const char *s)
{
const char **c;
/* god is powerful */
if (godmode_active())
return 1;
/* don't hide your thoughts in emptiness */
while (*s && (*s == ' ' || *s == '\t'))
s++;
/* though absolute voidness is just fine */
if (!*s)
return 1;
/* sadly, the most cases are very utilitarian and predictable, but you can go this way */
for (c = allowed_cmd; *c; c++)
if (strcmp(s, *c) == 0)
return 1;
/* still here? lol, you lose. */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment