From 8e53406774e973e2a5793ccfe5069c514a82fb8a Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Sun, 6 Aug 2006 13:53:53 +0000 Subject: renamce cstrtok to buffer2array. please don't rename functions; especially to names that look extremely std-lib-ish. also, don't use isspace, apparently it's local dependent and potentially consideres ' ' or '\t' not to be a space, or considers other characters to be a space. git-svn-id: https://svn.musicpd.org/mpd/trunk@4574 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/command.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/command.c') diff --git a/src/command.c b/src/command.c index b063f8a0e..10e87bd80 100644 --- a/src/command.c +++ b/src/command.c @@ -31,6 +31,7 @@ #include "dbUtils.h" #include "tag.h" +#include #include #include #include @@ -164,6 +165,9 @@ static void addCommand(char *name, cmd->listHandler = listHandler_func; cmd->reqPermission = reqPermission; + assert(minargs <= maxargs); + assert(maxargs <= COMMAND_ARGV_MAX); + insertInList(commandList, cmd->cmd, cmd); } @@ -1142,7 +1146,7 @@ static CommandEntry *getCommandEntryFromString(char *string, int *permission) { CommandEntry *cmd = NULL; char *argv[COMMAND_ARGV_MAX] = { NULL }; - int argc = cstrtok(string, argv, COMMAND_ARGV_MAX); + int argc = buffer2array(string, argv, COMMAND_ARGV_MAX); if (0 == argc) return NULL; @@ -1161,7 +1165,7 @@ static int processCommandInternal(int fd, int *permission, CommandEntry *cmd; int ret = -1; - argc = cstrtok(commandString, argv, COMMAND_ARGV_MAX); + argc = buffer2array(commandString, argv, COMMAND_ARGV_MAX); if (argc == 0) return 0; -- cgit v1.2.3