diff options
author | Martin Mares <mj@ucw.cz> | 2000-02-27 22:00:19 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2000-02-27 22:00:19 +0000 |
commit | e69e4ed9349ee28262fe74f70e7e52c181d5d098 (patch) | |
tree | 33dcb70e608d36460ff7ac0484cc438c7f9a7289 /client/client.c | |
parent | de30342f97490e3a3626c4a5fbf3352d1d0aa9c8 (diff) |
Support expansion of command abbreviations.
Client considered finished (modulo bugs).
Diffstat (limited to 'client/client.c')
-rw-r--r-- | client/client.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/client/client.c b/client/client.c index 9c6b4ae9..1e0496ed 100644 --- a/client/client.c +++ b/client/client.c @@ -79,6 +79,8 @@ extern Function *rl_last_func; static void got_line(char *cmd_buffer) { + char *cmd; + if (!cmd_buffer) { cleanup(); @@ -86,12 +88,22 @@ got_line(char *cmd_buffer) } if (cmd_buffer[0]) { - add_history(cmd_buffer); - /* FIXME: Builtin commands: exit, ... */ - server_send(cmd_buffer); - input_hidden = -1; - io_loop(0); - input_hidden = 0; + cmd = cmd_expand(cmd_buffer); + if (cmd) + { + add_history(cmd); + puts(cmd); + if (!strcmp(cmd, "exit") || !strcmp(cmd, "quit")) + { + cleanup(); + exit(0); + } + server_send(cmd); + input_hidden = -1; + io_loop(0); + input_hidden = 0; + free(cmd); + } } free(cmd_buffer); } |