Index: trunk/minix/commands/telnetd/Makefile
===================================================================
--- trunk/minix/commands/telnetd/Makefile	(revision 9)
+++ 	(revision )
@@ -1,32 +1,0 @@
-# Makefile for telnetd
-#
-# 01/30/96 Initial Release	Michael Temari, <temari@ix.netcom.com>
-#
-
-CFLAGS=	-O -D_MINIX -D_POSIX_SOURCE
-LDFLAGS=-i
-BINDIR=	/usr/bin
-PROG=	in.telnetd
-CC = exec cc
-
-OBJS=	main.o telnet.o term.o pty.o wtmp.o
-
-all:	$(PROG)
-
-$(PROG):	$(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJS)
-	install -S 8kw $@
-
-clean:
-	rm -f $(PROG) $(OBJS)
-
-install:	$(BINDIR)/$(PROG)
-
-$(BINDIR)/$(PROG):	$(PROG)
-	install -cs -o bin $? $@
-
-main.o:		main.c		telnetd.h
-telnet.o:	telnet.c	telnetd.h	telnet.h
-term.o:		term.c		telnetd.h	telnet.h
-pty.o:		pty.c		telnetd.h
-wtmp.o:				telnetd.h
Index: trunk/minix/commands/telnetd/build
===================================================================
--- trunk/minix/commands/telnetd/build	(revision 9)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-make clean
-make && make install
Index: trunk/minix/commands/telnetd/main.c
===================================================================
--- trunk/minix/commands/telnetd/main.c	(revision 9)
+++ 	(revision )
@@ -1,158 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		This file contains an implementation of the "server"
- *		for the TELNET protocol.  This protocol can be used to
- *		remote-login on other systems, just like a normal TTY
- *		session.
- *
- * Usage:	telnetd [-dv]
- *
- * Version:	@(#)telnetd.c	1.00	07/26/92
- *
- * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- *		Michael Temari, <temari@temari.ae.ge.com>
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <stdio.h>
-#include <ttyent.h>
-#include <utmp.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/socket.h>
-#include <net/gen/netdb.h>
-#include <net/gen/inet.h>
-#include "telnetd.h"
-
-static char *Version = "@(#) telnetd 1.00 (07/26/92)";
-
-int opt_d = 0;				/* debugging output flag	*/
-
-_PROTOTYPE(void usage, (void));
-_PROTOTYPE(int main, (int argc, char *argv[]));
-_PROTOTYPE(void wtmp, (int type, int linenr, char *line, pid_t pid,
-								char *host));
-
-void usage()
-{
-   fprintf(stderr, "Usage: telnetd [-dv]\n");
-
-   exit(-1);
-}
-
-int main(argc, argv)
-int argc;
-char *argv[];
-{
-char buff[128];
-register int c;
-int pty_fd;
-int tty_fd;
-pid_t pid;
-int lineno;
-char *tty_name;
-struct ttyent *ttyp;
-nwio_tcpconf_t tcpconf;
-struct hostent *hostent;
-char *hostname;
-
-   opterr = 0;
-   while ((c = getopt(argc, argv, "dv")) != EOF) switch(c) {
-	case 'd':
-	case 'v':
-		opt_d = 1;
-		break;
-	default:
-		usage();
-   }
-
-   /* No more arguments allowed. */
-   if (optind != argc) usage();
-
-   /* Obtain the name of the remote host. */
-   if (ioctl(0, NWIOGTCPCONF, &tcpconf) < 0) {
-	sprintf(buff, "Unable to obtain your IP address\r\n");
-	(void) write(1, buff, strlen(buff));
-	return(-1);
-   }
-   if ((hostent = gethostbyaddr((char *) &tcpconf.nwtc_remaddr,
-			sizeof(tcpconf.nwtc_remaddr), AF_INET)) != NULL) {
-	hostname = hostent->h_name;
-   } else {
-	hostname = inet_ntoa(tcpconf.nwtc_remaddr);
-   }
-
-   /* Try allocating a PTY. */
-   if (get_pty(&pty_fd, &tty_name) < 0) {
-	sprintf(buff, "I am sorry, but there is no free PTY left!\r\n");
-	(void) write(1, buff, strlen(buff));
-	return(-1);
-   }
-
-   /* Find the tty in the tty table. */
-   lineno = 0;
-   for (;;) {
-	if ((ttyp = getttyent()) == NULL) {
-		sprintf(buff, "Can't find %s in the tty table\r\n");
-		(void) write(1, buff, strlen(buff));
-	}
-	if (strcmp(ttyp->ty_name, tty_name+5) == 0) break;
-	lineno++;
-   }
-   endttyent();
-
-   /* Initialize the connection to an 8 bit clean channel. */
-   term_init();
-
-   /* Fork off a child process and have it execute a getty(8). */
-   if ((pid = fork()) == 0) {
-	/* Set up a new session. */
-	setsid();
-	if ((tty_fd = open(tty_name, O_RDWR)) < 0) {
-		sprintf(buff, "Can't open %s\r\n", tty_name);
-		(void) write(1, buff, strlen(buff));
-		return(-1);
-	}
-
-	close(pty_fd);
-	dup2(tty_fd, 0);
-	dup2(tty_fd, 1);
-	dup2(tty_fd, 2);
-	close(tty_fd);
-	(void) execl("/usr/sbin/getty", "getty", (char *)NULL);
-	(void) execl("/usr/bin/getty", "getty", (char *)NULL);
-	(void) execl("/usr/bin/login", "login", (char *)NULL);
-	(void) write(1, "EXEC failed!\r\n", 14);
-   } else if (pid < 0) {
-	sprintf(buff, "I am sorry, but the fork(2) call failed!\r\n");
-	(void) write(1, buff, strlen(buff));
-	(void) close(pty_fd);
-	return(-1);
-   }
-
-   wtmp(LOGIN_PROCESS, lineno, tty_name+5, pid, hostname);
-
-   term_inout(pty_fd);
-
-   (void) close(pty_fd);
-
-   wtmp(DEAD_PROCESS, lineno, tty_name+5, pid, hostname);
-
-   chown(tty_name, 0, 0);
-   chmod(tty_name, 0666);
-
-   return(0);
-}
Index: trunk/minix/commands/telnetd/pty.c
===================================================================
--- trunk/minix/commands/telnetd/pty.c	(revision 9)
+++ 	(revision )
@@ -1,78 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		Handle the allocation of a PTY.
- *
- * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- */
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include "telnetd.h"
-
-
-#define DEV_DIR		"/dev"
-
-/*
- * Allocate a PTY, by trying to open one repeatedly,
- * until all PTY channels are done.  If at that point
- * no PTY is found, go into panic mode :-(
- */
-int get_pty(pty_fdp, tty_namep)
-int *pty_fdp;
-char **tty_namep;
-{
-  char buff[128], temp[128];
-  register int i, j;
-  int pty_fd;
-  static char tty_name[128];
-
-  for(i = 'p'; i < 'w'; i++) {
-	j = 0;
-	do {
-		sprintf(buff, "%s/pty%c%c",
-			DEV_DIR, i, (j < 10) ? j + '0' : j + 'a' - 10);
-
-		if (opt_d == 1) {
-			(void) write(2, "Testing: ", 9);
-			(void) write(2, buff, strlen(buff));
-			(void) write(2, "...: ", 5);
-		}
-
-		pty_fd = open(buff, O_RDWR);
-		if (opt_d == 1) {
-			if (pty_fd < 0) sprintf(temp, "error %d\r\n", errno);
-			  else sprintf(temp, "OK\r\n");
-			(void) write(2, temp, strlen(temp));
-		}
-
-		if (pty_fd >= 0) break;
-
-		j++;
-		if (j == 16) break;
-	} while(1);
-
-	/* Did we find one? */
-	if (j < 16) break;
-  }
-  if (pty_fd < 0) return(-1);
-
-  if (opt_d == 1) {
-	sprintf(temp, "File %s, desc %d\n", buff, pty_fd);
-	(void) write(1, temp, strlen(temp));
-  }
-
-  sprintf(tty_name, "%s/tty%c%c", DEV_DIR,
-  					i, (j < 10) ? j + '0' : j + 'a' - 10);
-
-  *pty_fdp = pty_fd;
-  *tty_namep = tty_name;
-  return(0);
-}
Index: trunk/minix/commands/telnetd/telnet.c
===================================================================
--- trunk/minix/commands/telnetd/telnet.c	(revision 9)
+++ 	(revision )
@@ -1,337 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		This module handles telnet option processing.
- *
- * Author:	Michael Temari, <temari@temari.ae.ge.com>  01/13/93
- *
- */
-#include <sys/types.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-#include <termios.h>
-#include "telnetd.h"
-#include "telnet.h"
-#include <stdio.h>
-#include <sys/ioctl.h>
-
-
-#define	IN_DATA	0
-#define	IN_CR	1
-#define	IN_IAC	2
-#define	IN_IAC2	3
-#define IN_SB	4
-
-_PROTOTYPE(static void dowill, (int c));
-_PROTOTYPE(static void dowont, (int c));
-_PROTOTYPE(static void dodo, (int c));
-_PROTOTYPE(static void dodont, (int c));
-_PROTOTYPE(static void respond, (int ack, int option));
-_PROTOTYPE(static void respond_really, (int ack, int option));
-
-#define	LASTTELOPT	TELOPT_SGA
-
-static int r_winch = 0;
-
-static int TelROpts[LASTTELOPT+1];
-static int TelLOpts[LASTTELOPT+1];
-
-static int telfdout;
-
-void tel_init()
-{
-int i;
-
-   for(i = 0; i <= LASTTELOPT; i++) {
-	TelROpts[i] = 0;
-	TelLOpts[i] = 0;
-   }
-}
-
-void telopt(fdout, what, option)
-int fdout;
-int what;
-int option;
-{
-char buf[3];
-int len;
-
-   buf[0] = IAC;
-   buf[1] = what;
-   buf[2] = option;
-   len = 0;
-
-   switch(what) {
-	case DO:
-		if(option <= LASTTELOPT) {
-			TelROpts[option] = 1;
-			len = 3;
-		} else if(option == TELOPT_WINCH && !r_winch) { r_winch = 1; len = 3; } 
-		break;
-	case DONT:
-		if(option <= LASTTELOPT) {
-			TelROpts[option] = 1;
-			len = 3;
-		}
-		break;
-	case WILL:
-		if(option <= LASTTELOPT) {
-			TelLOpts[option] = 1;
-			len = 3;
-		}
-		break;
-	case WONT:
-		if(option <= LASTTELOPT) {
-			TelLOpts[option] = 1;
-			len = 3;
-		}
-		break;
-   }
-   if(len > 0)
-	(void) write(fdout, buf, len);
-}
-
-int set_winsize(int fd, unsigned int cols, unsigned int rows)
-{
-	struct winsize w;
-	memset(&w, 0, sizeof(w));
-	w.ws_col = cols;
-	w.ws_row = rows;
-	ioctl(fd, TIOCSWINSZ, (char *) &w);
-}
-
-int tel_in(fdout, telout, buffer, len)
-int fdout;
-int telout;
-char *buffer;
-int len;
-{
-static int InState = IN_DATA;
-static int ThisOpt = 0;
-char *p;
-char *p2;
-int size;
-int c;
-
-   telfdout = telout;
-   p = p2 = buffer;
-   size = 0;
-
-   while(len > 0) {
-   	c = (unsigned char)*p++; len--;
-	switch(InState) {
-   		case IN_CR:
-   			InState = IN_DATA;
-   			if(c == 0 || c == '\n')
-   				break;
-   			/* fall through */
-   		case IN_DATA:
-   			if(c == IAC) {
-   				InState = IN_IAC;
-   				break;
-   			}
-   			*p2++ = c; size++;
-   			if(c == '\r') InState = IN_CR;
-   			break;
-   		case IN_IAC:
-   			switch(c) {
-   				case IAC:
-	   				*p2++ = c; size++;
-   					InState = IN_DATA;
-   					break;
-   				case WILL:
-   				case WONT:
-   				case DO:
-   				case DONT:
-   					InState = IN_IAC2;
-   					ThisOpt = c;
-   					break;
-   				case SB:
-   				 	InState = IN_SB; 
-   					break;
-   				case EOR:
-   				case SE:
-   				case NOP:
-   				case BREAK:
-   				case IP:
-   				case AO:
-   				case AYT:
-   				case EC:
-   				case EL:
-   				case GA:
-   					break;
-   				default:
-   					break;
-   			}
-   			break;
-   		case IN_IAC2:
-   			if(size > 0) {
-   				write(fdout, buffer, size);
-   				p2 = buffer;
-   				size = 0;
-   			}
-   			InState = IN_DATA;
-   			switch(ThisOpt) {
-   				case WILL:	dowill(c);	break;
-   				case WONT:	dowont(c);	break;
-   				case DO:	dodo(c);	break;
-   				case DONT:	dodont(c);	break;
-   			}
-   			break;
-   		case IN_SB:
- 		{
-			static int winchpos = -1;
-   			/* Subnegotiation. */
-   			if(winchpos >= 0) {
-				static unsigned int winchbuf[5], iacs = 0;
-   				winchbuf[winchpos] = c;
-   				/* IAC is escaped - unescape it. */
-   				if(c == IAC) iacs++; else { iacs = 0; winchpos++; }
-   				if(iacs == 2) { winchpos++; iacs = 0; }
-   				if(winchpos >= 4) {
-   					/* End of WINCH data. */
-   					set_winsize(fdout,
-   					(winchbuf[0] << 8) | winchbuf[1],
-   					(winchbuf[2] << 8) | winchbuf[3]);
-   					winchpos = -1;
-   				}
-   			} else {
-				static int lastiac = 0;
-	   			switch(c) {
-   					case TELOPT_WINCH:
-   						/* Start listening. */
-   						winchpos = 0;
-   						break;
-   					case SE:
-   						if(lastiac) InState = IN_DATA;
-   						break;
-   					default:
-   						break;
-   				}
-   				if(c == IAC) lastiac = 1;
-   				else lastiac = 0;
-
-
-   			}
-   			break;
-   		}
-   	}
-   }
-
-   if(size > 0)
-   	write(fdout, buffer, size);
-}
-
-int tel_out(fdout, buf, size)
-int fdout;
-char *buf;
-int size;
-{
-char *p;
-int got_iac, len;
-
-   p = buf;
-   while(size > 0) {
-	buf = p;
-	got_iac = 0;
-	if((p = (char *)memchr(buf, IAC, size)) != (char *)NULL) {
-		got_iac = 1;
-		p++;
-	} else
-		p = buf + size;
-	len = p - buf;
-	if(len > 0)
-		(void) write(fdout, buf, len);
-	if(got_iac)
-		(void) write(fdout, p - 1, 1);
-	size = size - len;
-   }
-}
-
-static void dowill(c)
-int c;
-{
-int ack;
-
-   switch(c) {
-	case TELOPT_BINARY:
-	case TELOPT_ECHO:
-	case TELOPT_SGA:
-		if(TelROpts[c] == 1)
-			return;
-		TelROpts[c] = 1;
-		ack = DO;
-		break;
-	case TELOPT_WINCH:
-		if(r_winch) return;
-		r_winch = 1;
-		ack = DO;
- 		respond_really(ack, c); 
-		return;
-	default:
-		ack = DONT;
-   }
-
-   respond(ack, c);
-}
-
-static void dowont(c)
-int c;
-{
-   if(c <= LASTTELOPT) {
-	if(TelROpts[c] == 0)
-		return;
-	TelROpts[c] = 0;
-   }
-   respond(DONT, c);
-}
-
-static void dodo(c)
-int c;
-{
-int ack;
-
-   switch(c) {
-	default:
-		ack = WONT;
-   }
-   respond(ack, c);
-}
-
-static void dodont(c)
-int c;
-{
-   if(c <= LASTTELOPT) {
-	if(TelLOpts[c] == 0)
-		return;
-	TelLOpts[c] = 0;
-   }
-   respond(WONT, c);
-}
-
-static void respond(ack, option)
-int ack, option;
-{
-unsigned char c[3];
-
-   c[0] = IAC;
-   c[1] = ack;
-   c[2] = option;
-/*   write(telfdout, c, 3); */
-}
-
-static void respond_really(ack, option)
-int ack, option;
-{
-unsigned char c[3];
-
-   c[0] = IAC;
-   c[1] = ack;
-   c[2] = option;
-   write(telfdout, c, 3); 
-}
Index: trunk/minix/commands/telnetd/telnet.h
===================================================================
--- trunk/minix/commands/telnetd/telnet.h	(revision 9)
+++ 	(revision )
@@ -1,71 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- * 		Definitions for the TELNET protocol (see RFC XXX).
- *
- * Version:	@(#)arpa/telnet.h	1.00		07/02/92
- *
- * Authors:	Original taken from BSD 4.3/TAHOE.
- *		Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- */
-#ifndef _ARPA_TELNET_H
-#define _ARPA_TELNET_H
-
-#define	IAC		255	/* interpret as command:		*/
-#define	DONT		254	/* you are not to use option		*/
-#define	DO		253	/* please, you use option		*/
-#define	WONT		252	/* I won't use option			*/
-#define	WILL		251	/* I will use option			*/
-#define	SB		250	/* interpret as subnegotiation		*/
-#define	GA		249	/* you may reverse the line		*/
-#define	EL		248	/* erase the current line		*/
-#define	EC		247	/* erase the current character		*/
-#define	AYT		246	/* are you there			*/
-#define	AO		245	/* abort output--but let prog finish	*/
-#define	IP		244	/* interrupt process--permanently	*/
-#define	BREAK		243	/* break				*/
-#define	DM		242	/* data mark--for connect. cleaning	*/
-#define	NOP		241	/* nop					*/
-#define	SE		240	/* end sub negotiation			*/
-#define EOR     	239     /* end of record (transparent mode)	*/
-
-#define SYNCH		242	/* for telfunc calls			*/
-
-/* Telnet options. */
-#define TELOPT_BINARY	0	/* 8-bit data path			*/
-#define TELOPT_ECHO	1	/* echo					*/
-#define	TELOPT_RCP	2	/* prepare to reconnect			*/
-#define	TELOPT_SGA	3	/* suppress go ahead			*/
-#define	TELOPT_NAMS	4	/* approximate message size		*/
-#define	TELOPT_STATUS	5	/* give status				*/
-#define	TELOPT_TM	6	/* timing mark				*/
-#define	TELOPT_RCTE	7	/* remote controlled transmission and echo */
-#define TELOPT_NAOL 	8	/* negotiate about output line width	*/
-#define TELOPT_NAOP 	9	/* negotiate about output page size	*/
-#define TELOPT_NAOCRD	10	/* negotiate about CR disposition	*/
-#define TELOPT_NAOHTS	11	/* negotiate about horizontal tabstops	*/
-#define TELOPT_NAOHTD	12	/* negotiate about horizontal tab disposition */
-#define TELOPT_NAOFFD	13	/* negotiate about formfeed disposition	*/
-#define TELOPT_NAOVTS	14	/* negotiate about vertical tab stops	*/
-#define TELOPT_NAOVTD	15	/* negotiate about vertical tab disposition */
-#define TELOPT_NAOLFD	16	/* negotiate about output LF disposition */
-#define TELOPT_XASCII	17	/* extended ascic character set		*/
-#define	TELOPT_LOGOUT	18	/* force logout				*/
-#define	TELOPT_BM	19	/* byte macro				*/
-#define	TELOPT_DET	20	/* data entry terminal			*/
-#define	TELOPT_SUPDUP	21	/* supdup protocol			*/
-#define	TELOPT_SUPDUPOUTPUT 22	/* supdup output			*/
-#define	TELOPT_SNDLOC	23	/* send location			*/
-#define	TELOPT_TTYPE	24	/* terminal type			*/
-#define	TELOPT_EOR	25	/* end or record			*/
-#define	TELOPT_WINCH	31	/* window size				*/
-#define TELOPT_EXOPL	255	/* extended-options-list		*/
-
-/* Sub-option qualifiers. */
-#define	TELQUAL_IS	0	/* option is...				*/
-#define	TELQUAL_SEND	1	/* send option				*/
-
-#endif /* _ARPA_TELNET_H */
Index: trunk/minix/commands/telnetd/telnetd.h
===================================================================
--- trunk/minix/commands/telnetd/telnetd.h	(revision 9)
+++ 	(revision )
@@ -1,20 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		Definitions for the TELNET server.
- *
- * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- */
-
-extern int opt_d;			/* debugging flag		*/
-
-_PROTOTYPE(int get_pty, (int *, char **));
-_PROTOTYPE(void term_init, (void));
-_PROTOTYPE(void term_inout, (int pty_fd));
-_PROTOTYPE(void tel_init, (void));
-_PROTOTYPE(void telopt, (int fdout, int what, int option));
-_PROTOTYPE(int tel_in, (int fdout, int telout, char *buffer, int len));
-_PROTOTYPE(int tel_out, (int fdout, char *buf, int size));
Index: trunk/minix/commands/telnetd/term.c
===================================================================
--- trunk/minix/commands/telnetd/term.c	(revision 9)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		Handle the TERMINAL module.
- *
- * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- *              Michael Temari, <temari@temari.ae.ge.com>
- *
- * 07/29/92 MT  Telnet options hack which seems to work okay
- * 01/12/93 MT  Better telnet options processing instead of hack
- */
-#include <sys/types.h>
-#include <errno.h>
-#if 0
-#include <fcntl.h>
-#endif
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-#include "telnet.h"
-#include "telnetd.h"
-
-_PROTOTYPE(void sig_done, (int sig));
-
-static char buff[4096];
-
-void term_init()
-{
-  tel_init();
-
-  telopt(1, WILL, TELOPT_SGA);
-  telopt(1, DO,   TELOPT_SGA);
-  telopt(1, WILL, TELOPT_BINARY);
-  telopt(1, DO,   TELOPT_BINARY);
-  telopt(1, WILL, TELOPT_ECHO);
-  telopt(1, DO,   TELOPT_WINCH);
-}
-
-static int io_done = 0;
-
-void term_inout(pty_fd)
-int pty_fd;
-{
-register int i;
-pid_t pid;
-struct sigaction sa;
-
-  sigemptyset(&sa.sa_mask);
-  sa.sa_flags = 0;
-  sa.sa_handler = sig_done;
-  sigaction(SIGALRM, &sa, (struct sigaction *) NULL);
-
-  if ((pid = fork()) == -1) {
-	sprintf(buff, "telnetd: fork() failed: %s\r\n", strerror(errno));
-	(void) write(1, buff, strlen(buff));
-  }
-
-  if (pid != 0) {
-	/* network -> login process */
-	while (!io_done && (i = read(0, buff, sizeof(buff))) > 0) {
-		tel_in(pty_fd, 1, buff, i);
-	}
-	/* EOF, kill opposite number and exit. */
-	(void) kill(pid, SIGKILL);
-  } else {
-  	/* login process -> network */
-	while ((i = read(pty_fd, buff, sizeof(buff))) > 0) {
-		tel_out(1, buff, i);
-	}
-	/* EOF, alert opposite number and exit. */
-	(void) kill(getppid(), SIGALRM);
-  }
-  /* EOF. */
-}
-
-void sig_done(sig)
-int sig;
-{
-  io_done = 1;
-  alarm(1);			/* there is always a chance... */
-}
Index: trunk/minix/commands/telnetd/wtmp.c
===================================================================
--- trunk/minix/commands/telnetd/wtmp.c	(revision 9)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/*
- * TNET		A server program for MINIX which implements the TCP/IP
- *		suite of networking protocols.  It is based on the
- *		TCP/IP code written by Phil Karn et al, as found in
- *		his NET package for Packet Radio communications.
- *
- *		This file contains an implementation of the "server"
- *		for the TELNET protocol.  This protocol can be used to
- *		remote-login on other systems, just like a normal TTY
- *		session.
- *
- * Usage:	telnetd [-dv]
- *
- * Version:	@(#)telnetd.c	1.00	07/26/92
- *
- * Author:	Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
- *		Michael Temari, <temari@temari.ae.ge.com>
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <utmp.h>
-#include <time.h>
-#include <stdio.h>
-#include "telnetd.h"
-
-static char PATH_UTMP[] = "/etc/utmp";
-static char PATH_WTMP[] = "/usr/adm/wtmp";
-
-_PROTOTYPE(void wtmp, (int type, int linenr, char *line, pid_t pid,
-								char *host));
-_PROTOTYPE(void report, (char *label));
-
-void wtmp(type, linenr, line, pid, host)
-int type;			/* type of entry */
-int linenr;			/* line number in ttytab */
-char *line;			/* tty name (only good on login) */
-pid_t pid;			/* pid of process */
-char *host;			/* name of the remote host */
-{
-/* Log an event into the UTMP and WTMP files. */
-
-  struct utmp utmp;		/* UTMP/WTMP User Accounting */
-  int fd;
-
-  /* Clear the utmp record. */
-  memset((void *) &utmp, 0, sizeof(utmp));
-
-  /* Fill in utmp. */
-  switch (type) {
-  case LOGIN_PROCESS:
-  	/* A new login, fill in line and host name. */
-	strncpy(utmp.ut_line, line, sizeof(utmp.ut_line));
-	strncpy(utmp.ut_host, host, sizeof(utmp.ut_host));
-	break;
-
-  case DEAD_PROCESS:
-	/* A logout.  Use the current utmp entry, but make sure it is a
-	 * user process exiting, and not getty or login giving up.
-	 */
-	if ((fd = open(PATH_UTMP, O_RDONLY)) < 0) {
-		if (errno != ENOENT) report(PATH_UTMP);
-		return;
-	}
-	if (lseek(fd, (off_t) (linenr+1) * sizeof(utmp), SEEK_SET) == -1
-		|| read(fd, &utmp, sizeof(utmp)) == -1
-	) {
-		report(PATH_UTMP);
-		close(fd);
-		return;
-	}
-	close(fd);
-	if (utmp.ut_type != USER_PROCESS) return;
-	strncpy(utmp.ut_name, "", sizeof(utmp.ut_name));
-	break;
-  }
-
-  /* Finish new utmp entry. */
-  utmp.ut_pid = pid;
-  utmp.ut_type = type;
-  utmp.ut_time = time((time_t *) 0);
-
-  /* Write new entry to utmp. */
-  if ((fd = open(PATH_UTMP, O_WRONLY)) < 0
-	|| lseek(fd, (off_t) (linenr+1) * sizeof(utmp), SEEK_SET) == -1
-	|| write(fd, &utmp, sizeof(utmp)) == -1
-  ) {
-	if (errno != ENOENT) report(PATH_UTMP);
-  }
-  if (fd != -1) close(fd);
-
-  if (type == DEAD_PROCESS) {
-	/* Add new wtmp entry. */
-	if ((fd = open(PATH_WTMP, O_WRONLY | O_APPEND)) < 0
-		  || write(fd, &utmp, sizeof(utmp)) == -1
-	) {
-		if (errno != ENOENT) report(PATH_WTMP);
-	}
-	if (fd != -1) close(fd);
-  }
-}
-
-void report(label)
-char *label;
-{
-  char message[128];
-
-  sprintf(message, "telnetd: %s: %s\r\n", strerror(errno));
-  (void) write(1, message, strlen(message));
-}
