Index: trunk/minix/commands/talk/Makefile
===================================================================
--- trunk/minix/commands/talk/Makefile	(revision 9)
+++ 	(revision )
@@ -1,31 +1,0 @@
-# Makefile for talk
-#
-# 08/01/96 			Michael Temari, <temari@ix.netcom.com>
-#
-
-CFLAGS=	-O -D_MINIX -D_POSIX_SOURCE
-LDFLAGS=-i
-BINDIR=	/usr/bin
-PROG=	talk
-CC = exec cc
-
-OBJS=	talk.o screen.o net.o proto.o
-
-all:	$(PROG)
-
-$(PROG):	$(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $(OBJS) -lcurses
-	install -S 16kw $@
-
-clean:
-	rm -f $(PROG) $(OBJS)
-
-install:	$(BINDIR)/$(PROG)
-
-$(BINDIR)/$(PROG):	$(PROG)
-	install -cs -o bin $? $@
-
-talk.o:		talk.c	talk.h	proto.h	net.h	screen.h
-screen.o:	screen.c			screen.h
-net.o:		net.c	talk.h		net.h
-proto.o:	proto.c	talk.h	proto.h	net.h	screen.h
Index: trunk/minix/commands/talk/build
===================================================================
--- trunk/minix/commands/talk/build	(revision 9)
+++ 	(revision )
@@ -1,3 +1,0 @@
-#!/bin/sh
-make clean
-make && make install
Index: trunk/minix/commands/talk/net.c
===================================================================
--- trunk/minix/commands/talk/net.c	(revision 9)
+++ 	(revision )
@@ -1,266 +1,0 @@
-/* net.c Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <signal.h>
-#include <net/netlib.h>
-#include <net/hton.h>
-#include <net/gen/netdb.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-#include <net/gen/udp_hdr.h>
-
-#include "talk.h"
-#include "net.h"
-
-_PROTOTYPE(void TimeOut, (int sig));
-
-static unsigned char buffer[8192];
-
-static int udp_ctl;
-int tcp_fd;
-
-static udpport_t ntalk_port;
-
-char luser[USER_SIZE+1], ruser[USER_SIZE+1];
-char lhost[HOST_SIZE+1], rhost[HOST_SIZE+1];
-char ltty[TTY_SIZE+1], rtty[TTY_SIZE+1];
-udpport_t ctlport;
-tcpport_t dataport;
-ipaddr_t laddr, raddr;
-
-int NetInit()
-{
-int s;
-struct servent *servent;
-char *udp_device;
-char *tcp_device;
-nwio_udpopt_t udpopt;
-nwio_tcpconf_t tcpconf;
-
-   if((udp_device = getenv("UDP_DEVICE")) == (char *)NULL)
-   	udp_device = UDP_DEVICE;
-
-   if((udp_ctl = open(udp_device, O_RDWR)) < 0) {
-   	fprintf(stderr, "talk: Could not open %s: %s\n",
-   		udp_device, strerror(errno));
-   	return(-1);
-   }
-
-   if((servent = getservbyname("ntalk", "udp")) == (struct servent *)NULL) {
-   	fprintf(stderr, "talk: Could not find ntalk udp service\n");
-   	close(udp_ctl);
-   	return(-1);
-   }
-
-   ntalk_port = (udpport_t)servent->s_port;
-
-   udpopt.nwuo_flags = NWUO_NOFLAGS;
-   udpopt.nwuo_flags |= NWUO_COPY | NWUO_LP_SEL | NWUO_EN_LOC;
-   udpopt.nwuo_flags |= NWUO_DI_BROAD | NWUO_RP_SET | NWUO_RA_SET;
-   udpopt.nwuo_flags |= NWUO_RWDATONLY | NWUO_DI_IPOPT;
-   udpopt.nwuo_remaddr = raddr;
-   udpopt.nwuo_remport = ntalk_port;
-
-   s = ioctl(udp_ctl, NWIOSUDPOPT, &udpopt);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOSUDPOPT");
-   	close(udp_ctl);
-   	return(-1);
-   }
-
-   s = ioctl(udp_ctl, NWIOGUDPOPT, &udpopt);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOGUDPOPT");
-   	close(udp_ctl);
-   	return(-1);
-   }
-   laddr = udpopt.nwuo_locaddr;
-   ctlport = udpopt.nwuo_locport;
-
-   if((tcp_device = getenv("TCP_DEVICE")) == (char *)NULL)
-   	tcp_device = TCP_DEVICE;
-
-   if((tcp_fd = open(tcp_device, O_RDWR)) < 0) {
-   	fprintf(stderr, "talk: Could not open %s: %s\n",
-   		tcp_device, strerror(errno));
-   	close(udp_ctl);
-   	return(-1);
-   }
-
-   tcpconf.nwtc_flags = NWTC_NOFLAGS;
-   tcpconf.nwtc_flags |= NWTC_LP_SEL | NWTC_SET_RA | NWTC_UNSET_RP;
-   tcpconf.nwtc_remaddr = raddr;
-
-   s = ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOSTCPCONF");
-   	close(udp_ctl);
-   	close(tcp_fd);
-   	return(-1);
-   }
-
-   s = ioctl(tcp_fd, NWIOGTCPCONF, &tcpconf);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOGTCPCONF");
-   	close(udp_ctl);
-   	close(tcp_fd);
-   	return(-1);
-   }
-
-   dataport = tcpconf.nwtc_locport;
-
-   return(0);
-}
-
-int getreply(reply, timeout)
-struct talk_reply *reply;
-int timeout;
-{
-int s;
-int terrno;
-udp_io_hdr_t *udp_io_hdr;
-
-   signal(SIGALRM, TimeOut);
-   alarm(timeout);
-   s = read(udp_ctl, buffer, sizeof(buffer));
-   terrno = errno;
-   alarm(0);
-   errno = terrno;
-   if(s < 0 && errno == EINTR)
-   	return(1);
-   if(s < 0) {
-   	perror("talk: Read error in getreply");
-   	return(-1);
-   }
-
-   if(s == sizeof(struct talk_reply))
-	memcpy((char *)reply, buffer, s);
-
-   return(0);
-}
-
-int sendrequest(request, here)
-struct talk_request *request;
-int here;
-{
-int s;
-nwio_udpopt_t udpopt;
-udp_io_hdr_t *udp_io_hdr;
-
-   udpopt.nwuo_flags = NWUO_NOFLAGS;
-   udpopt.nwuo_flags |= NWUO_COPY | NWUO_LP_SET | NWUO_EN_LOC;
-   udpopt.nwuo_flags |= NWUO_DI_BROAD | NWUO_RP_SET | NWUO_RA_SET;
-   udpopt.nwuo_flags |= NWUO_RWDATONLY | NWUO_DI_IPOPT;
-   udpopt.nwuo_locport = ctlport;
-   if(here)
-	udpopt.nwuo_remaddr = laddr;
-   else
-	udpopt.nwuo_remaddr = raddr;
-   udpopt.nwuo_remport = ntalk_port;
-
-   s = ioctl(udp_ctl, NWIOSUDPOPT, &udpopt);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOSUDPOPT");
-   	return(-1);
-   }
-
-   s = ioctl(udp_ctl, NWIOGUDPOPT, &udpopt);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOGUDPOPT");
-   	return(-1);
-   }
-
-   s = write(udp_ctl, request, sizeof(struct talk_request));
-   if(s < 0) {
-   	perror("talk: write error in sendrequest");
-   	return(-1);
-   }
-
-   if(s != sizeof(struct talk_request)) {
-   	fprintf(stderr, "talk: sendrequest size mismatch %d %d\n", s, sizeof(struct talk_request));
-   	return(-1);
-   }
-
-   return(0);
-}
-
-void TimeOut(sig)
-int sig;
-{
-}
-
-int NetConnect(port)
-u16_t port;
-{
-int s;
-nwio_tcpconf_t tcpconf;
-nwio_tcpcl_t tcpcopt;
-
-   tcpconf.nwtc_flags = NWTC_NOFLAGS;
-   tcpconf.nwtc_flags |= NWTC_LP_SET | NWTC_SET_RA | NWTC_SET_RP;
-   tcpconf.nwtc_locport = dataport;
-   tcpconf.nwtc_remaddr = raddr;
-   tcpconf.nwtc_remport = port;
-
-   s = ioctl(tcp_fd, NWIOSTCPCONF, &tcpconf);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOSTCPCONF");
-   	return(-1);
-   }
-
-   s = ioctl(tcp_fd, NWIOGTCPCONF, &tcpconf);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOGTCPCONF");
-   	return(-1);
-   }
-
-   tcpcopt.nwtcl_flags = 0;
-
-   s = ioctl(tcp_fd, NWIOTCPCONN, &tcpcopt);
-   if(s < 0 && errno == ECONNREFUSED)
-   	return(1);
-   if(s < 0) {
-   	perror("talk: ioctl NWIOTCPCONN");
-   	return(-1);
-   }
-
-   return(0);
-}
-
-int NetListen(timeout)
-int timeout;
-{
-int s;
-nwio_tcpcl_t tcplopt;
-int terrno;
-
-   tcplopt.nwtcl_flags = 0;
-
-   signal(SIGALRM, TimeOut);
-   alarm(timeout);
-   s = ioctl(tcp_fd, NWIOTCPLISTEN, &tcplopt);
-   terrno = errno;
-   alarm(0);
-   errno = terrno;
-
-   if(s < 0 && errno == EINTR)
-   	return(1);
-
-   if(s < 0) {
-   	perror("talk: ioctl NWIOTCPLISTEN");
-   	return(-1);
-   }
-
-   return(0);
-}
Index: trunk/minix/commands/talk/net.h
===================================================================
--- trunk/minix/commands/talk/net.h	(revision 9)
+++ 	(revision )
@@ -1,15 +1,0 @@
-/* net.h Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-extern char luser[], ruser[];
-extern char lhost[], rhost[];
-extern char ltty[], rtty[];
-extern udpport_t ctlport;
-extern tcpport_t dataport;
-extern ipaddr_t laddr, raddr;
-extern int tcp_fd;
-
-_PROTOTYPE(int NetInit, (void));
-_PROTOTYPE(int getreply, (struct talk_reply *reply, int timeout));
-_PROTOTYPE(int sendrequest, (struct talk_request *request, int here));
-_PROTOTYPE(int NetConnect, (U16_t port));
-_PROTOTYPE(int NetListen, (int timeout));
Index: trunk/minix/commands/talk/proto.c
===================================================================
--- trunk/minix/commands/talk/proto.c	(revision 9)
+++ 	(revision )
@@ -1,142 +1,0 @@
-/* proto.c Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <net/hton.h>
-#include <net/gen/socket.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/tcp.h>
-#include <net/gen/udp.h>
-
-#include "talk.h"
-#include "proto.h"
-#include "net.h"
-#include "screen.h"
-
-_PROTOTYPE(static int TalkChk, (int gotreply, struct talk_reply *reply, char *msg));
-_PROTOTYPE(static int TalkTrans, (int type, long id, struct talk_reply *reply, int here));
-
-static char *AnswerMsgs[] = {
-	"Success",
-	"User Not Logged In",
-	"Failure",
-	"Remote Does Not Know who we are",
-	"User is not accepting calls",
-	"Are request was not know",
-	"Incorrect Version",
-	"Bad Address",
-	"Bad Control Address"
-};
-
-static int TalkChk(gotreply, reply, msg)
-int gotreply;
-struct talk_reply *reply;
-char *msg;
-{
-   if(!gotreply) {
-	ScreenMsg(msg);
-	return(-1);
-   }
-   if(reply->answer == SUCCESS) return(0);
-   if(reply->answer < (sizeof(AnswerMsgs) / sizeof(AnswerMsgs[0])))
-  	ScreenMsg(AnswerMsgs[reply->answer]);
-   else
-  	ScreenMsg("Bad Answer");
-
-   return(-1);
-}
-
-static int TalkTrans(type, id, reply, here)
-int type;
-long id;
-struct talk_reply *reply;
-int here;
-{
-struct talk_request request;
-int tries;
-int gotreply;
-
-   memset(&request, 0, sizeof(request));
-
-   request.version = TALK_VERSION;
-   request.type = type;
-   request.id = id;
-   request.addr.sa_family = htons(AF_INET);
-   request.addr.sin_port = dataport;
-   request.addr.sin_addr = laddr;
-   request.ctl_addr.sa_family = htons(AF_INET);
-   request.ctl_addr.sin_port = ctlport;
-   request.ctl_addr.sin_addr = laddr;
-   request.pid = getpid();
-   strncpy(request.luser, luser, USER_SIZE);
-   strncpy(request.ruser, ruser, USER_SIZE);
-   strncpy(request.rtty,  rtty,  TTY_SIZE);
-
-   tries = 0;
-   gotreply = 0;
-   while(!ScreenDone && tries++ < 3 && !gotreply) {
-	if(!sendrequest(&request, here))
-		if(!getreply(reply, 5))
-			gotreply = 1;
-	if(!gotreply) continue;
-	if(reply->version != request.version ||
-	   reply->type    != request.type)
-	   	gotreply = 0;
-   }
-   return(gotreply);
-}
-
-int TalkInit()
-{
-struct talk_reply reply;
-long id = 0;
-long rid;
-int s;
-int ring;
-char buff[32];
-
-   /* Check if someone was calling us */
-   ScreenMsg("Initiating Talk Protocol");
-
-   /* Check is someone was calling us */
-   s = TalkTrans(LOOK_UP, ++id, &reply, 0);
-
-   /* Someone was calling us */
-   if(s && reply.answer == SUCCESS) {
-   	s = NetConnect(reply.addr.sin_port);
-   	if(s == 1) {
-   		ScreenMsg("Your party has hung up");
-   		TalkTrans(DELETE, reply.id, &reply, 0);
-   	}
-   	return(s == 0 ? 0 : -1);
-   }
-
-   ScreenMsg("Ringing User");
-
-   ring = 0;
-   while(!ScreenDone && ring++ < 5) {
-   	if(TalkChk(TalkTrans(ANNOUNCE, -1, &reply, 0),
-   			&reply, "No response to are ring"))
-   		return(-1);
-   	rid = reply.id;
-	sprintf(buff, "Ring #%d", ring);
-	ScreenMsg(buff);
-	if(ring == 1) {
-   		if(TalkChk(TalkTrans(LEAVE_INVITE, ++id, &reply, 1),
-   				&reply, "Could not leave are invitaion locally"))
-			return(-1);
-	}
-   	s = NetListen(RING_WAIT);
-   	if(s <= 0) {
-   		TalkTrans(DELETE, reply.id, &reply, 1);
-   		TalkTrans(DELETE, rid, &reply, 0);
-   		return(s);
-   	}
-   }
-
-   return(-1);
-}
Index: trunk/minix/commands/talk/proto.h
===================================================================
--- trunk/minix/commands/talk/proto.h	(revision 9)
+++ 	(revision )
@@ -1,3 +1,0 @@
-/* proto.h Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-_PROTOTYPE(int TalkInit, (void));
Index: trunk/minix/commands/talk/screen.c
===================================================================
--- trunk/minix/commands/talk/screen.c	(revision 9)
+++ 	(revision )
@@ -1,208 +1,0 @@
-/* screen.c Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <string.h>
-#include <unistd.h>
-#include <curses.h>
-
-#include "screen.h"
-
-_PROTOTYPE(void gotsig, (int sig));
-_PROTOTYPE(static char *delword, (WINDOW *w));
-
-struct {
-	WINDOW *win;
-	char erase;
-	char kill;
-	char werase;
-} window[2];
-
-static char line[80+1];
-
-int ScreenDone = 0;
-
-static WINDOW *dwin;
-
-void gotsig(sig)
-int sig;
-{
-   ScreenDone = 1;
-   signal(sig, gotsig);
-}
-
-int ScreenInit()
-{
-int i;
-
-   if(initscr() == (WINDOW *)NULL) {
-   	fprintf(stderr, "talk: Could not initscr\n");
-   	return(-1);
-   }
-   signal(SIGINT, gotsig);
-   signal(SIGQUIT, gotsig);
-   signal(SIGPIPE, gotsig);
-   signal(SIGHUP, gotsig);
-   clear();
-   refresh();
-   noecho();
-   cbreak();
-
-   /* local window */
-   window[LOCALWIN].win = newwin(LINES / 2, COLS, 0, 0);
-   scrollok(window[LOCALWIN].win, TRUE);
-   wclear(window[LOCALWIN].win);
-
-   /* divider between windows */
-   dwin = newwin(1, COLS, LINES / 2, 0);
-   i = COLS;
-   while(i-- > 0)
-   	waddch(dwin, '-');
-   wrefresh(dwin);
-
-   /* remote window */
-   window[REMOTEWIN].win = newwin(LINES - (LINES / 2) - 1, COLS, LINES / 2 + 1, 0);
-   scrollok(window[REMOTEWIN].win, TRUE);
-   wclear(window[REMOTEWIN].win);
-
-   return(0);
-}
-
-void ScreenMsg(msg)
-char *msg;
-{
-WINDOW *w;
-
-   w =window[LOCALWIN].win;
-
-   wmove(w, 0, 0);
-
-   if(*msg != '\0') {
-	wprintw(w, "[%s]", msg);
-	wclrtoeol(w);
-   } else
-   	werase(w);
-
-   wrefresh(w);
-}
-
-void ScreenWho(user, host)
-char *user;
-char *host;
-{
-   if(*host != '\0') {
-   	wmove(dwin, 0, (COLS - (1 + strlen(user) + 1 + strlen(host) + 1)) / 2);
-   	wprintw(dwin, " %s@%s ", user, host);
-   } else {
-   	wmove(dwin, 0, (COLS - (1 + strlen(user) + 1)) / 2);
-   	wprintw(dwin, " %s ", user);
-   }
-   wrefresh(dwin);
-}
-
-void ScreenEdit(lcc, rcc)
-char lcc[];
-char rcc[];
-{
-   window[LOCALWIN].erase   = lcc[0];
-   window[LOCALWIN].kill    = lcc[1];
-   window[LOCALWIN].werase  = lcc[2];
-   window[REMOTEWIN].erase  = rcc[0];
-   window[REMOTEWIN].kill   = rcc[1];
-   window[REMOTEWIN].werase = rcc[2];
-}
-
-void ScreenPut(data, len, win)
-char *data;
-int len;
-int win;
-{
-WINDOW *w;
-unsigned char ch;
-int r, c;
-
-   w = window[win].win;
-
-   while(len-- > 0) {
-   	ch = *data++;
-   	/* new line CR, NL */
-   	if(ch == '\r' || ch == '\n') {
-		waddch(w, '\n');
-	} else
-	/* erase a character, BS, DEL  */
-	if(ch == 0x08 || ch == 0x7f || ch == window[win].erase) {
-		getyx(w, r, c);
-		if(c > 0)
-			c--;
-		wmove(w, r, c);
-		waddch(w, ' ');
-		wmove(w, r, c);
-	} else
-	/* erase line CTL-U */
-	if(ch == 0x15 || ch == window[win].kill) {
-		getyx(w, r, c);
-		wmove(w, r, 0);
-		wclrtoeol(w);
-	} else
-	/* refresh CTL-L */
-	if(ch == 0x0c) {
-		if(win == LOCALWIN) {
-			touchwin(w);
-			wrefresh(w);
-			touchwin(window[REMOTEWIN].win);
-			wrefresh(window[REMOTEWIN].win);
-		}
-	} else
-	/* bell CTL-G */
-	if(ch == 0x07) {
-		putchar(ch);
-	}
-	else
-	/* erase last word CTL-W */
-	if(ch == 0x17 || ch == window[win].werase) {
-		(void) delword(w);
-	} else {
-		getyx(w, r, c);
-		if(1 || isprint(ch)) {
-			if(ch != ' ' && c == (COLS - 1))
-				wprintw(w, "\n%s", delword(w));
-			waddch(w, ch);
-		}
-	}
-   }
-   wrefresh(w);
-}
-
-static char *delword(w)
-WINDOW *w;
-{
-int r, c;
-int i = 0;
-char ch;
-char *p = &line[80];
-
-   *p-- = '\0';
-   getyx(w, r, c);
-   if(c == 0) return;
-   while(c >= 0) {
-   	c--;
-   	ch = mvwinch(w, r, c);
-   	if(ch == ' ') break;
-   	*p-- = ch;
-   	i = 1;
-   	waddch(w, ' ');
-   }
-   c += i;
-   wmove(w, r, c);
-   return(++p);
-}
-
-void ScreenEnd()
-{
-   move(LINES - 1, 0);
-   refresh();
-   endwin();
-}
Index: trunk/minix/commands/talk/screen.h
===================================================================
--- trunk/minix/commands/talk/screen.h	(revision 9)
+++ 	(revision )
@@ -1,13 +1,0 @@
-/* screen.h Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-_PROTOTYPE(int ScreenInit, (void));
-_PROTOTYPE(void ScreenMsg, (char *msg));
-_PROTOTYPE(void ScreenWho, (char *user, char *host));
-_PROTOTYPE(void ScreenEdit, (char lcc[], char rcc[]));
-_PROTOTYPE(void ScreenPut, (char *data, int len, int mywin));
-_PROTOTYPE(void ScreenEnd, (void));
-
-extern int ScreenDone;
-
-#define	LOCALWIN	0
-#define	REMOTEWIN	1
Index: trunk/minix/commands/talk/talk.c
===================================================================
--- trunk/minix/commands/talk/talk.c	(revision 9)
+++ 	(revision )
@@ -1,237 +1,0 @@
-/* talk.c Copyright Michael Temari 08/01/1996 All Rights Reserved */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <utmp.h>
-#include <termios.h>
-#include <net/gen/netdb.h>
-#include <net/hton.h>
-#include <net/gen/socket.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/tcp.h>
-#include <net/gen/udp.h>
-
-#include "talk.h"
-#include "proto.h"
-#include "net.h"
-#include "screen.h"
-
-_PROTOTYPE(int main, (int argc, char *argv[]));
-_PROTOTYPE(void DoTalk, (void));
-
-int main(argc, argv)
-int argc;
-char *argv[];
-{
-char *p;
-struct hostent *hp;
-struct stat st;
-struct utmp utmp;
-int slot;
-FILE *fp;
-
-   if(argc < 2 || argc > 3) {
-   	fprintf(stderr, "Usage: talk user[@host] [tty]\n");
-   	return(-1);
-   }
-
-   /* get local host name */
-   if(gethostname(lhost, HOST_SIZE) < 0) {
-   	fprintf(stderr, "talk: Error getting local host name\n");
-   	return(-1);
-   }
-
-   /* get local user name and tty */
-   if((slot = ttyslot()) < 0) {
-   	fprintf(stderr, "talk: You are not on a terminal\n");
-   	return(-1);
-   }
-   if((fp = fopen(UTMP, "r")) == (FILE *)NULL) {
-   	fprintf(stderr, "talk: Could not open %s\n", UTMP);
-   	return(-1);
-   }
-   if(fseek(fp, (off_t) sizeof(utmp) * slot, SEEK_SET)) {
-   	fprintf(stderr, "talk: Could not seek %s\n", UTMP);
-   	fclose(fp);
-   	return(-1);
-   }
-   if(fread((char *)&utmp, sizeof(utmp), 1 , fp) != 1) {
-   	fprintf(stderr, "talk: Could not read %s\n", UTMP);
-   	fclose(fp);
-   	return(-1);
-   }
-   fclose(fp);
-   strncpy(luser, utmp.ut_user, USER_SIZE < sizeof(utmp.ut_user) ?
-   				USER_SIZE : sizeof(utmp.ut_user));
-   luser[USER_SIZE] = '\0';
-
-   /* get local tty */
-   if((p = ttyname(0)) == (char *)NULL) {
-   	fprintf(stderr, "talk: You are not on a terminal\n");
-   	return(-1);
-   }
-   strncpy(ltty, p+5, TTY_SIZE);
-   ltty[TTY_SIZE] = '\0';
-
-   /* check if local tty is going to be writable */
-   if(stat(p, &st) < 0) {
-   	perror("talk: Could not stat local tty");
-   	return(-1);
-   }
-   if((st.st_mode & S_IWGRP) == 0) {
-   	fprintf(stderr, "talk: Your terminal is not writable.  Use: mesg y\n");
-   	return(-1);
-   }
-
-   /* get remote user and host name */
-   if((p = strchr(argv[1], '@')) != (char *)NULL)
-   	*p++ = '\0';
-   else
-   	p = lhost;
-   strncpy(ruser, argv[1], USER_SIZE);
-   ruser[USER_SIZE] = '\0';
-   strncpy(rhost, p, HOST_SIZE);
-   rhost[HOST_SIZE] = '\0';
-
-   /* get remote tty */
-   if(argc > 2)
-   	strncpy(rtty, argv[2], TTY_SIZE);
-   else
-   	rtty[0] = '\0';
-   rtty[TTY_SIZE] = '\0';
-
-   if((hp = gethostbyname(rhost)) == (struct hostent *)NULL) {
-   	fprintf(stderr, "talk: Could not determine address of %s\n", rhost);
-   	return(-1);
-   }
-   memcpy((char *)&raddr, (char *)hp->h_addr, hp->h_length);
-
-   if(NetInit()) {
-   	fprintf(stderr, "talk: Error in NetInit\n");
-   	return(-1);
-   }
-
-   if(ScreenInit())
-   	return(-1);
-
-   if(!TalkInit())
-	DoTalk();
-
-   ScreenEnd();
-
-   return(0);
-}
-
-struct pdata {
-	int win;
-	int len;
-	char buffer[64];
-} pdata;
-
-void DoTalk()
-{
-int s;
-int s2;
-int kid;
-int pfd[2];
-int win;
-int len;
-struct termios termios;
-char lcc[3];
-char rcc[3];
-
-   ScreenMsg("");
-   ScreenWho(ruser, rhost);
-
-   /* Get and send edit characters */
-   s = tcgetattr(0, &termios);
-   if(s < 0) {
-   	perror("talk: tcgetattr");
-   	return;
-   }
-   lcc[0] = termios.c_cc[VERASE];
-   lcc[1] = termios.c_cc[VKILL];
-   lcc[2] = 0x17; /* Control - W */
-   s = write(tcp_fd, lcc, sizeof(lcc));
-   if(s != sizeof(lcc)) {
-   	ScreenMsg("Connection Closing due to error");
-   	return;
-   }
-   s = read(tcp_fd, rcc, sizeof(rcc));
-   if(s != sizeof(rcc)) {
-   	ScreenMsg("Connection Closing due to error");
-   	return;
-   }
-   ScreenEdit(lcc, rcc);
-
-   s = pipe(pfd);
-   if(s < 0) {
-   	ScreenMsg("Could not create pipes");
-   	return;
-   }
-
-   if((kid = fork()) < 0) {
-   	ScreenMsg("Could not fork");
-   	close(pfd[0]);
-   	close(pfd[1]);
-   	return;
-   }
-
-   if(kid == 0) {
-   	close(tcp_fd);
-   	close(pfd[1]);
-   	while(1) {
-   		s = read(pfd[0], &pdata, sizeof(pdata));
-   		if(s != sizeof(pdata)) {
-   			close(pfd[0]);
-   			exit(-1);
-   		}
-   		ScreenPut(pdata.buffer, pdata.len, pdata.win);
-   	}
-   }
-
-   close(pfd[0]);
-
-   if((kid = fork()) < 0) {
-   	ScreenMsg("Could not fork");
-   	close(pfd[1]);
-   	return;
-   }
-
-   if(kid == 0) {
-   	pdata.win = REMOTEWIN;
-   	while(!ScreenDone) {
-	   	s = read(tcp_fd, pdata.buffer, sizeof(pdata.buffer));
-   		if(s <= 0)
-   			break;
-   		pdata.len = s;
-		write(pfd[1], &pdata, sizeof(pdata));
-   	}
-   	close(pfd[1]);
-   	close(tcp_fd);
-	kill(getppid(), SIGINT);
-   	exit(-1);
-   }
-
-   pdata.win = LOCALWIN;
-   while(!ScreenDone) {
-	s = read(0, pdata.buffer, sizeof(pdata.buffer));
-	if(s <= 0)
-		break;
-	pdata.len = s;
-	write(pfd[1], &pdata, sizeof(pdata));
-	s2 = write(tcp_fd, pdata.buffer, s);
-	if(s2 != s)
-		break;
-   }
-   kill(kid, SIGINT);
-   close(pfd[1]);
-   close(tcp_fd);
-   return;
-}
Index: trunk/minix/commands/talk/talk.h
===================================================================
--- trunk/minix/commands/talk/talk.h	(revision 9)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/* talk.h Copyright Michael Temari 07/22/1996 All Rights Reserved */
-
-#define	USER_SIZE	12
-#define	TTY_SIZE	16
-#define	HOST_SIZE	255
-
-struct osockaddr {
-	u16_t sa_family;
-	u16_t sin_port;
-	ipaddr_t sin_addr;
-	char junk[8];
-};
-
-struct talk_request {
-	u8_t version;
-	u8_t type;
-	u8_t answer;
-	u8_t junk;
-	u32_t id;
-	struct osockaddr addr;
-	struct osockaddr ctl_addr;
-	long pid;
-	char	luser[USER_SIZE];
-	char	ruser[USER_SIZE];
-	char	rtty[TTY_SIZE];
-};
-
-struct talk_reply {
-	u8_t version;
-	u8_t type;
-	u8_t answer;
-	u8_t junk;
-	u32_t id;
-	struct osockaddr addr;
-};
-
-#define	TALK_VERSION	1
-
-/* message type values */
-#define LEAVE_INVITE	0	/* leave invitation with server */
-#define LOOK_UP		1	/* check for invitation by callee */
-#define DELETE		2	/* delete invitation by caller */
-#define ANNOUNCE	3	/* announce invitation by caller */
-
-/* answer values */
-#define SUCCESS		0	/* operation completed properly */
-#define NOT_HERE	1	/* callee not logged in */
-#define FAILED		2	/* operation failed for unexplained reason */
-#define MACHINE_UNKNOWN	3	/* caller's machine name unknown */
-#define PERMISSION_DENIED 4	/* callee's tty doesn't permit announce */
-#define UNKNOWN_REQUEST	5	/* request has invalid type value */
-#define	BADVERSION	6	/* request has invalid protocol version */
-#define	BADADDR		7	/* request has invalid addr value */
-#define	BADCTLADDR	8	/* request has invalid ctl_addr value */
-
-#define MAX_LIFE	60	/* max time daemon saves invitations */
-#define RING_WAIT	30	/* time to wait before resending invitation */
