added WHY2-prefix at the beginning of chat-flags macros
This commit is contained in:
parent
b8b7b7cdff
commit
cd5d290a13
@ -20,10 +20,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#define WHY2_CHAT_COMMON_H
|
||||
|
||||
//DEFINES
|
||||
#define SA struct sockaddr
|
||||
#define SERVER_PORT 1204
|
||||
#define MAX_CONNECTIONS 1000
|
||||
#define WHY2_SA struct sockaddr
|
||||
#define WHY2_SERVER_PORT 1204
|
||||
#define WHY2_MAX_CONNECTIONS 1000
|
||||
|
||||
#define CLEAR_AND_GO_UP "\33[2K\r\033[A"
|
||||
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A"
|
||||
|
||||
#endif
|
@ -40,7 +40,7 @@ int main(void)
|
||||
//DEFINE SERVER ADDRESS
|
||||
struct sockaddr_in server_addr;
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(SERVER_PORT);
|
||||
server_addr.sin_port = htons(WHY2_SERVER_PORT);
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
//GET IP
|
||||
@ -56,7 +56,7 @@ int main(void)
|
||||
}
|
||||
printf("\n\n\n");
|
||||
|
||||
int connectStatus = connect(listen_socket, (SA *) &server_addr, sizeof(server_addr)); //CONNECT
|
||||
int connectStatus = connect(listen_socket, (WHY2_SA *) &server_addr, sizeof(server_addr)); //CONNECT
|
||||
|
||||
if (connectStatus < 0) why2_die("Connecting failed.");
|
||||
|
||||
@ -65,7 +65,7 @@ int main(void)
|
||||
for (;;)
|
||||
{
|
||||
getline(&line, &line_length, stdin);
|
||||
printf(CLEAR_AND_GO_UP);
|
||||
printf(WHY2_CLEAR_AND_GO_UP);
|
||||
|
||||
why2_send_socket(line, listen_socket);
|
||||
|
||||
|
@ -42,14 +42,14 @@ int main(void)
|
||||
//DEFINE SERVER ADDRESS
|
||||
struct sockaddr_in server_addr;
|
||||
server_addr.sin_family = AF_INET;
|
||||
server_addr.sin_port = htons(SERVER_PORT);
|
||||
server_addr.sin_port = htons(WHY2_SERVER_PORT);
|
||||
server_addr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
//BIND SOCKET
|
||||
if (bind(listen_socket, (SA *) &server_addr, sizeof(server_addr)) < 0) why2_die("Failed binding socket.");
|
||||
if (bind(listen_socket, (WHY2_SA *) &server_addr, sizeof(server_addr)) < 0) why2_die("Failed binding socket.");
|
||||
|
||||
//LISTEN
|
||||
if (listen(listen_socket, MAX_CONNECTIONS) < 0) why2_die("Binding failed.");
|
||||
if (listen(listen_socket, WHY2_MAX_CONNECTIONS) < 0) why2_die("Binding failed.");
|
||||
|
||||
printf("Server enabled.\n\n");
|
||||
|
||||
|
@ -236,7 +236,7 @@ void *why2_accept_thread(void *socket)
|
||||
//LOOP ACCEPT
|
||||
for (;;)
|
||||
{
|
||||
accepted = accept(*((int*) socket), (SA *) NULL, NULL); //ACCEPT NEW SOCKET //TODO: CLOSE (not only this one)
|
||||
accepted = accept(*((int*) socket), (WHY2_SA *) NULL, NULL); //ACCEPT NEW SOCKET //TODO: CLOSE (not only this one)
|
||||
|
||||
if (accepted == -1) continue;
|
||||
|
||||
@ -279,7 +279,7 @@ void *why2_listen_server(void *socket)
|
||||
for (;;)
|
||||
{
|
||||
read = why2_read_socket(*((int*) socket)); //TODO: Fix other user message formatting
|
||||
printf(CLEAR_AND_GO_UP);
|
||||
printf(WHY2_CLEAR_AND_GO_UP);
|
||||
printf("%s\n>>> ", read);
|
||||
fflush(stdout);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user