added notcurses, beginning to convert

This commit is contained in:
2025-08-14 13:08:02 -06:00
parent 823e5b5455
commit 04cfa47057
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -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
+4 -3
View File
@@ -2,6 +2,8 @@
* A simple chat program by Dane MacFadden
*/
#define _XOPEN_SOURCE 700
#include <wchar.h>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
@@ -17,6 +19,7 @@
#include <signal.h>
#include <list.h>
#include <ncurses.h>
#include <notcurses/notcurses.h>
#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;