Minor changes
This commit is contained in:
parent
ea9b2a28dd
commit
5c06da2b6d
1 changed files with 4 additions and 4 deletions
|
@ -373,7 +373,7 @@ int cmd_set_group(int sender_id, char* name) {
|
|||
}
|
||||
|
||||
/* Function for CMD_SET_NAME */
|
||||
int cmd_set_name(int sender_id, char* name){
|
||||
int cmd_set_name(int sender_id, char* name) {
|
||||
char buf[BUF_LEN];
|
||||
|
||||
if ((clients[sender_id].id == -1) || (clients[sender_id].id != sender_id)) {
|
||||
|
@ -384,7 +384,7 @@ int cmd_set_name(int sender_id, char* name){
|
|||
fprintf(stderr, "WARNING: Received invalid name \"%s\"\n", name);
|
||||
return -1;
|
||||
}
|
||||
if (get_client_id_from_name(name) < MAX_CLIENTS){
|
||||
if (get_client_id_from_name(name) < MAX_CLIENTS) {
|
||||
fprintf(stderr, "WARNING: Name \"%s\" is already used\n", name);
|
||||
sprintf(buf, "Name \"%s\" is already used !\n", name);
|
||||
cmd_send_message(SERVER_ID, sender_id, buf);
|
||||
|
@ -401,7 +401,7 @@ int cmd_set_name(int sender_id, char* name){
|
|||
}
|
||||
|
||||
/* Function for CMD_GET_NAME */
|
||||
int cmd_get_name(int sender_id){
|
||||
int cmd_get_name(int sender_id) {
|
||||
char buf[BUF_LEN];
|
||||
|
||||
if ((clients[sender_id].id == -1) || (clients[sender_id].id != sender_id)) {
|
||||
|
@ -605,7 +605,7 @@ void *Dispatcher(void *arg) {
|
|||
printf("cmd_send_message (from %d)\n", sender_id);
|
||||
|
||||
/* Extract receiver_id */
|
||||
if ((token = strtok_r(rest, " ", &rest)) == NULL ) {
|
||||
if ((token = strtok_r(rest, " ", &rest)) == NULL) {
|
||||
fprintf(stderr, "ERROR: strtok_r didn't return a token\n");
|
||||
error_message = "WARNING: Syntax error: missing arguments\n";
|
||||
cmd_send_message(SERVER_ID, sender_id, error_message);
|
||||
|
|
Loading…
Reference in a new issue