1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

renamed ParseCommand() to TokenizeString()

added rootmenu reader rewrite start
This commit is contained in:
kojima
2000-06-21 22:25:10 +00:00
parent c49ad9cac8
commit 4905ab1986
5 changed files with 476 additions and 15 deletions

View File

@@ -625,29 +625,27 @@ next_token(char *word, char **next)
}
/* separate a string in tokens, taking " and ' into account */
void
ParseCommand(char *command, char ***argv, int *argc)
TokenizeString(char *command, char ***argv, int *argc)
{
WMBag *bag = WMCreateBag(4);
char *token, *line;
int count, j;
int count;
count = 0;
line = command;
do {
token = next_token(line, &line);
if (token) {
WMPutInBag(bag, token);
if (count == 0)
*argv = wmalloc(sizeof(char**));
else
*argv = wrealloc(*argv, (count+1)*sizeof(char**));
(*argv)[count++] = token;
}
} while (token!=NULL && line!=NULL);
count = WMGetBagItemCount(bag);
*argv = wmalloc(sizeof(char*)*count);
for (j = 0; j < count; j++) {
(*argv)[j] = WMGetFromBag(bag, j);
}
*argc = count;
WMFreeBag(bag);
}