diff options
author | Ben Burwell <bburwell1@gmail.com> | 2013-04-30 10:52:41 -0400 |
---|---|---|
committer | Ben Burwell <bburwell1@gmail.com> | 2013-04-30 10:52:41 -0400 |
commit | 0322fefa7f5f465909ccd95c85a088d9cf83812e (patch) | |
tree | 862ac466912289d8adb4bcf58331ce7861848400 /localchat.c | |
parent | ca9e46c937e75df43d2f80f0d957fabb07892c29 (diff) |
Changes
Diffstat (limited to 'localchat.c')
-rw-r--r-- | localchat.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/localchat.c b/localchat.c index 60c41d2..8c1c57a 100644 --- a/localchat.c +++ b/localchat.c @@ -20,26 +20,37 @@ #include <netdb.h> // define constants -#define DEBUG 0 -#define MAX_NUM_PEERS 100 -#define CMD_PORT 6060 -#define CHAT_PORT 6061 -#define BROADCAST_IP "192.168.130.255" +#define DEBUG 0 +#define MAX_NUM_PEERS 100 +#define CMD_PORT 6060 +#define CHAT_PORT 6061 +#define BROADCAST_IP "192.168.130.255" +#define GLOBAL_MSG_LENGTH 1024 // structs #include "peer.h" // global variables -struct peer peers[MAX_NUM_PEERS]; -int num_peers_in_table = 0; -pthread_mutex_t peer_table_lock; - -char my_ip[64]; -char in_chat[4] = "N"; -const char * username; - -char command[256]; -int client_s; +struct peer peers[MAX_NUM_PEERS]; +int num_peers_in_table = 0; +pthread_mutex_t peer_table_lock; + +char my_ip[64]; +char in_chat[4] = "N"; +const char * username; + +char command[256]; +char prompt[16] = ">"; + +int client_s; +char in_buf[GLOBAL_MSG_LENGTH]; +char out_buf[GLOBAL_MSG_LENGTH]; +int retcode; +int i; +char * token; +struct sockaddr_in client_addr; + +int respond_to_chat_request = 0; // include functions #include "clean_table.h" @@ -93,7 +104,7 @@ int main(int argc, char const *argv[]) { // enter the user input loop while (1) { - printf("> "); + printf("%s ", prompt); fgets(command, 256, stdin); process_user_command(); } |