diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-04 01:58:31 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-04 01:58:31 +0000 |
commit | f958e0a4c5bb7241b2ec443a402d10c29abfc08f (patch) | |
tree | aeaaf910ae09cffaa0289223503f12dcdfcb8245 /src/command.c | |
parent | d22e5ec5228ccb3f6fd843cebc4662953f42451d (diff) | |
download | mpd-f958e0a4c5bb7241b2ec443a402d10c29abfc08f.tar.gz mpd-f958e0a4c5bb7241b2ec443a402d10c29abfc08f.tar.xz mpd-f958e0a4c5bb7241b2ec443a402d10c29abfc08f.zip |
work on ACK error codes
git-svn-id: https://svn.musicpd.org/mpd/trunk@1324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c index 121c9358e..b83daa8eb 100644 --- a/src/command.c +++ b/src/command.c @@ -106,6 +106,9 @@ struct _CommandEntry { CommandListHandlerFunction listHandler; }; +char * current_command = NULL; +int command_listNum = 0; + CommandEntry * getCommandEntryFromString(char * string, int * permission); List * commandList; @@ -679,8 +682,11 @@ int checkArgcAndPermission(CommandEntry * cmd, FILE *fp, CommandEntry * getCommandEntryAndCheckArgcAndPermission(FILE * fp, unsigned int * permission, int argArrayLength, char ** argArray) { + static char unknown[] = ""; CommandEntry * cmd; + current_command = unknown; + if(argArrayLength == 0) return NULL; if(!findInList(commandList, argArray[0],(void *)&cmd)) { @@ -688,6 +694,8 @@ CommandEntry * getCommandEntryAndCheckArgcAndPermission(FILE * fp, return NULL; } + current_command = cmd->cmd; + if(checkArgcAndPermission(cmd, fp, *permission, argArrayLength, argArray) < 0) { @@ -739,6 +747,8 @@ int processCommandInternal(FILE * fp, unsigned int * permission, freeArgArray(argArray,argArrayLength); + current_command = NULL; + return ret; } @@ -749,6 +759,8 @@ int proccessListOfCommands(FILE * fp, int * permission, int * expired, ListNode * tempNode; int ret = 0; + command_listNum = 0; + while(node!=NULL) { DEBUG("proccesListOfCommands: process command \"%s\"\n", node->data); @@ -759,7 +771,10 @@ int proccessListOfCommands(FILE * fp, int * permission, int * expired, deleteNodeFromList(list,node); node = tempNode; if(ret!=0 || (*expired)!=0) node = NULL; + command_listNum++; } + + command_listNum = 0; return ret; } @@ -767,4 +782,3 @@ int proccessListOfCommands(FILE * fp, int * permission, int * expired, int processCommand(FILE * fp, unsigned int * permission, char * commandString) { return processCommandInternal(fp,permission,commandString,NULL); } -/* vim:set shiftwidth=4 tabstop=8 expandtab: */ |