aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2006-08-06 13:53:53 +0000
committerWarren Dukes <warren.dukes@gmail.com>2006-08-06 13:53:53 +0000
commit8e53406774e973e2a5793ccfe5069c514a82fb8a (patch)
treeea3b90b06bf7a66fbfb035262d079185b09d480c /src/command.c
parent31de97a42b384ffd2ce7051248cefc075e935522 (diff)
downloadmpd-8e53406774e973e2a5793ccfe5069c514a82fb8a.tar.gz
mpd-8e53406774e973e2a5793ccfe5069c514a82fb8a.tar.xz
mpd-8e53406774e973e2a5793ccfe5069c514a82fb8a.zip
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
Diffstat (limited to '')
-rw-r--r--src/command.c8
1 files changed, 6 insertions, 2 deletions
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 <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@@ -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;