From 15a2ac65adf650b2545f5a07a509da165d60d4a0 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 26 Mar 2016 14:35:08 +1000 Subject: [PATCH] More fiddling with stdio redirection --- bbs.c | 2 +- doors.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/bbs.c b/bbs.c index 1b9d714..fd08686 100644 --- a/bbs.c +++ b/bbs.c @@ -670,7 +670,7 @@ void runbbs(int socket, char *config_path) { if (strcasecmp(user->loginname, buffer) == 0) { fclose(nodefile); - s_putstring(socket, "You are already logged in.\r\n"); + s_putstring(socket, "\r\nYou are already logged in.\r\n"); disconnect(socket); } fclose(nodefile); diff --git a/doors.c b/doors.c index 1af534c..03c4609 100644 --- a/doors.c +++ b/doors.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #if defined(linux) @@ -119,9 +120,7 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { int slave; fd_set fdset; int t; - int pipefd[2]; - - + struct winsize ws; if (write_door32sys(socket, user) != 0) { return; @@ -136,7 +135,10 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { arguments[2] = strdup(buffer); arguments[3] = NULL; - if (openpty(&master, &slave, NULL, NULL, NULL) == 0) { + ws.ws_row = 24; + ws.ws_col = 80; + + if (openpty(&master, &slave, NULL, NULL, &ws) == 0) { pid = fork(); if (pid < 0) { return; @@ -154,8 +156,6 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { execvp(cmd, arguments); } else { - pipe(pipefd); - while(1) { FD_ZERO(&fdset); FD_SET(master, &fdset); @@ -170,7 +170,6 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) { if (FD_ISSET(socket, &fdset)) { len = read(socket, &c, 1); if (len == 0) { - // socket closed close(master); disconnect(socket); return;