diff options
author | James Booth <boothj5@gmail.com> | 2012-04-28 19:08:33 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-04-28 19:08:33 +0100 |
commit | c511d7c99f792823fd2727d3a5a1f1fd722b8a33 (patch) | |
tree | 57469c7339ed6232634b8a50bd598d4869c6d1a7 /command.c | |
parent | 2b51d416317e69bdb9f34ec9035fe3af51627a0c (diff) | |
download | profani-tty-c511d7c99f792823fd2727d3a5a1f1fd722b8a33.tar.gz |
Revert "Created command_t struct for command handling"
This reverts commit 0c0a242972456e19a609b70cbbfc774cbfc1a91f.
Diffstat (limited to 'command.c')
-rw-r--r-- | command.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/command.c b/command.c index de36e732..17c2dcb0 100644 --- a/command.c +++ b/command.c @@ -34,7 +34,6 @@ static gboolean _handle_command(const char * const command, const char * const inp); -static struct command_t _parse_command(char *str); static gboolean _cmd_quit(void); static gboolean _cmd_help(void); static gboolean _cmd_who(void); @@ -46,11 +45,6 @@ static gboolean _cmd_set_beep(const char * const inp); static gboolean _cmd_set_flash(const char * const inp); static gboolean _cmd_default(const char * const inp); -struct command_t { - char *command; - char **params; -}; - gboolean process_input(char *inp) { gboolean result = FALSE; @@ -63,8 +57,10 @@ gboolean process_input(char *inp) if (strlen(inp) == 0) { result = TRUE; } else if (inp[0] == '/') { - struct command_t cmd = _parse_command(inp); - result = _handle_command(cmd.command, inp); + char inp_cpy[strlen(inp) + 1]; + strcpy(inp_cpy, inp); + char *command = strtok(inp_cpy, " "); + result = _handle_command(command, inp); } else { result = _cmd_default(inp); } @@ -76,16 +72,6 @@ gboolean process_input(char *inp) return result; } -static struct command_t _parse_command(char *str) -{ - struct command_t cmd; - char **split = g_strsplit(str, " ", 0); - - cmd.command = split[0]; - cmd.params = NULL; - return cmd; -} - static gboolean _handle_command(const char * const command, const char * const inp) { gboolean result = FALSE; |