From ce4429042076cd76acc70d729e889fa1ad57b467 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 3 Jan 2024 12:36:56 +0200 Subject: [server-cli] Improved help message and added :h and :? --- server-cli.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server-cli.c b/server-cli.c index 82c9501..58e5ea4 100644 --- a/server-cli.c +++ b/server-cli.c @@ -17,7 +17,7 @@ void handleCLI(sds **vhosts, int vhostsc) { char name[MAX_LEN_COMMAND+1]; int argsAssigned = sscanf(line, COMMAND_FORMAT, name); - while (name[0] != 'q' && name[0] != 'e' && !streq(name, "quit") && !streq(name, "exit")) { + while (!streq(name, "q") && !streq(name, "e") && !streq(name, "quit") && !streq(name, "exit")) { if (argsAssigned < 1) { printf("Bad command syntax!\n"); } @@ -29,8 +29,8 @@ void handleCLI(sds **vhosts, int vhostsc) { vhosts[i][vh_error]); } } - else if (streq(name, "help")) { - printf("help\tPrints this message\nvhosts\tPrints all registered virtual hosts\n"); + else if (streq(name, "help") || streq(name, "h") || streq(name, "?")) { + printf("help,h,?\tPrints this message\nvhosts\t\tPrints all registered virtual hosts\nquit,exit,q,e\tExits the program\n"); } else { printf("Unknown command %s!\n", name); -- cgit v1.2.3