aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c16
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: */