X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Ftelnetd_src%2Fmain.c;h=7fac367ba90d6cd942d0e7d0b089df163c6f898d;hb=e7a76b0d8a0cc6aa77966509780973a6f8216ef7;hp=6ef832f371222c039f70c488fe9537c9ae343311;hpb=7ad37b21a762c1ec19aef917b64bfb77b8318060;p=tpg%2Facess2.git diff --git a/Usermode/Applications/telnetd_src/main.c b/Usermode/Applications/telnetd_src/main.c index 6ef832f3..7fac367b 100644 --- a/Usermode/Applications/telnetd_src/main.c +++ b/Usermode/Applications/telnetd_src/main.c @@ -10,6 +10,7 @@ #include #include #include +#include // === TYPES === enum eTelnetMode @@ -27,6 +28,8 @@ typedef struct sClient enum eTelnetMode Mode; int Socket; int pty; + int stdin; + int stdout; } tClient; // === PROTOTYPES === @@ -118,7 +121,7 @@ void EventLoop(void) void Server_NewClient(int FD) { - tClient *clt; + tClient *clt = NULL; // TODO: Is this done in the IPStack? if( giNumClients == giConfig_MaxClients ) @@ -136,19 +139,15 @@ void Server_NewClient(int FD) break; } } + assert(clt); // Accept the connection clt->Socket = _SysOpenChild(FD, "", OPENFLAG_READ|OPENFLAG_WRITE); giNumClients ++; // Create stdin/stdout - // - Current PTY code is strange with mknod - clt->pty = _SysOpen("/Devices/pts/telnetd0", OPENFLAG_CREATE|OPENFLAG_READ|OPENFLAG_WRITE); - if( clt->pty < 0 ) { - perror("Unable to open server PTY"); - _SysClose(clt->Socket); - clt->Socket = 0; - return ; - } + // TODO: Use PTYs + clt->stdin = _SysOpen("/Devices/fifo/anon", OPENFLAG_READ|OPENFLAG_WRITE); + clt->stdout = _SysOpen("/Devices/fifo/anon", OPENFLAG_READ|OPENFLAG_WRITE); // TODO: Arguments and envp {