- char * f_name = "copy_tokenized_string()";
- char * dsc_ptr = strtok(line, delim);
- * ch_ptr = try_malloc(strlen(dsc_ptr) + 1, f_name);
- memcpy(* ch_ptr, dsc_ptr, strlen(dsc_ptr) + 1);
+ char * str_cmd = "COMMAND";
+ static uint8_t cmd_flags = READY_CMD;
+ static struct Command * cmd = NULL;
+ if (!token0 || !strcmp(token0, str_cmd))
+ {
+ parse_and_reduce_to_readyflag(&cmd_flags, READY_CMD);
+ if (cmd)
+ {
+ array_append(world.commandDB.n, sizeof(struct Command),
+ (void *) cmd, (void **) &world.commandDB.cmds);
+ world.commandDB.n++;
+ free(cmd);
+ cmd = NULL;
+ }
+ }
+ if (token0)
+ {
+ parsetest_too_many_values();
+ if (!strcmp(token0, str_cmd))
+ {
+ cmd = (struct Command *) parse_init_entry(&cmd_flags,
+ sizeof(struct Command));
+ cmd->dsc_short = strdup(token1);
+ parse_id_uniq(!(!get_command(cmd->dsc_short)));
+ }
+ else if (!( parse_flagval(token0, token1, "DESCRIPTION", &cmd_flags,
+ DESC_SET, 's', (char *) &cmd->dsc_long)
+ || parse_flagval(token0, token1,"SERVER_COMMAND", &cmd_flags,
+ SERVERCMD_SET, 's',(char *)&cmd->server_msg)
+ || parse_flagval(token0, token1,"SERVER_ARGUMENT",&cmd_flags,
+ SERVERARG_SET, 'c', (char *) &cmd->arg)))
+ {
+ parse_unknown_arg();
+ }
+ }