From 04cfa47057aebbf154d577016cfd506f3cba0540 Mon Sep 17 00:00:00 2001 From: Dane MacFadden Date: Thu, 14 Aug 2025 13:08:02 -0600 Subject: [PATCH] added notcurses, beginning to convert --- Makefile | 4 ++-- main.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 460025d..2d2f4c5 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ CC = gcc CFLAGS = -g -CPPFLAGS = -Wall -Wextra -pedantic -std=gnu90 +CPPFLAGS = -Wall -Wextra -pedantic -std=gnu99 chatty: main.o liblist.a - $(CC) $(CFLAGS) -L. -o chatty main.o -llist -lpthread -lncurses + $(CC) $(CFLAGS) -L. -o chatty main.o -llist -lpthread -lncurses -lnotcurses main.o: main.c $(CC) $(CFLAGS) $(CPPFLAGS) -I. -c -o main.o main.c diff --git a/main.c b/main.c index 9f959c4..1183478 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,8 @@ * A simple chat program by Dane MacFadden */ +#define _XOPEN_SOURCE 700 +#include #include #include #include @@ -17,6 +19,7 @@ #include #include #include +#include #define MAXBUFSIZE 29 #define BACKLOG 10 @@ -29,7 +32,7 @@ pthread_cond_t sendcv, receivecv; char closed[] = "Connection closed."; /* networking stuff */ -int sockfd, confd, client; +int sockfd, confd; char *remote_machine, *local_port, *remote_port; char s[INET6_ADDRSTRLEN]; @@ -223,7 +226,6 @@ int main(int argc, char* argv[]) { /* Decide who is "host" and who is "client" */ if (atoi(local_port) < atoi(remote_port)) { - client = 0; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; @@ -281,7 +283,6 @@ int main(int argc, char* argv[]) { printf("Getting chatty with %s\n", s); } else { - client = 1; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM;