From d315c1eaa71cbed3a868c011b684b61a92870447 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 9 Apr 2016 10:33:05 +1000 Subject: [PATCH] Attempt to fix line endings in stdio doors --- Makefile | 2 +- doors.c | 5 +++++ jamlib/Makefile.linux | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d0ae990..db2f0b4 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o $(CC) -c -o $@ $< $(CFLAGS) magicka: $(OBJ) - $(CC) -o magicka -o $@ $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 $(JAMLIB) $(ZMODEM) -lutil + $(CC) -o magicka -o $@ $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 $(JAMLIB) $(ZMODEM) -lutil .PHONY: clean diff --git a/doors.c b/doors.c index f57db7a..12a5539 100644 --- a/doors.c +++ b/doors.c @@ -200,6 +200,11 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { disconnect(socket); return; } + if (c == '\r') { + c == '\n'; + } else if (c == '\n' || c == '\0') { + continue; + } write(master, &c, 1); } else if (FD_ISSET(master, &fdset)) { len = read(master, &c, 1); diff --git a/jamlib/Makefile.linux b/jamlib/Makefile.linux index 4ff03b5..36be285 100644 --- a/jamlib/Makefile.linux +++ b/jamlib/Makefile.linux @@ -1,4 +1,4 @@ -CC = gcc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall +CC = cc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall AR = ar -ru RM = rm -f