added help command
This commit is contained in:
parent
1fc78a2a30
commit
e023207261
@ -42,6 +42,7 @@ extern "C" {
|
||||
//COMMANDS
|
||||
#define WHY2_CHAT_COMMAND_PREFIX "!" //the little thingy you write before the command names to make the program recognise them boy. You know? Like in minecraft you use /kill... Also, are you dumb?
|
||||
#define WHY2_CHAT_COMMAND_EXIT "exit" //QUIT THE PROGRAM CMD
|
||||
#define WHY2_CHAT_COMMAND_HELP "help" //PRINT ALL COMMANDS
|
||||
|
||||
//SHORTCUTS CAUSE I'M LAZY BITCH
|
||||
#define WHY2_CHAT_CODE_SSQC WHY2_CHAT_CODE_SERVER_SIDE_QUIT_COMMUNICATION
|
||||
|
@ -116,6 +116,17 @@ int main(void)
|
||||
|
||||
why2_send_socket(exit_cmd, NULL, listen_socket);
|
||||
why2_deallocate(exit_cmd);
|
||||
} else if (strcmp(line, WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_HELP "\n") == 0)
|
||||
{
|
||||
printf
|
||||
(
|
||||
"\nCommands:\n---------\n%s\n\n>>> ",
|
||||
|
||||
WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_EXIT "\tExits the program.\n"
|
||||
WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_HELP "\tPrints out all the commands. :)"
|
||||
);
|
||||
|
||||
fflush(stdout);
|
||||
} else
|
||||
{
|
||||
why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT
|
||||
|
@ -830,7 +830,7 @@ void *why2_listen_server(void *socket)
|
||||
fflush(stdout);
|
||||
} else if (strcmp(message, WHY2_CHAT_CODE_INVALID_COMMAND) == 0) //INVALID CMD
|
||||
{
|
||||
printf("\nInvalid command!\n\n");
|
||||
printf("\nInvalid command! Use \"" WHY2_CHAT_COMMAND_PREFIX WHY2_CHAT_COMMAND_HELP "\" for list of commands.\n\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
} else if (!continuing)
|
||||
|
Loading…
x
Reference in New Issue
Block a user