--- Makefile +++ Makefile 1994/02/28 15:30:32 @@ -0,0 +1,16 @@ +CFLAGS = -O2 -fomit-frame-pointer -m486 \ + -include /usr/include/bsd/bsd.h -I/usr/include/bsd \ + -DMSG_EOR -Dosockaddr=sockaddr +LDFLAGS = -s -v +LDLIBS = -lbsd -lcurses + +talk: ctl.o ctl_transact.o display.o get_addrs.o get_names.o \ + init_disp.o invite.o io.o look_up.o msgs.o talk.o + +install: talk + install talk /usr/bin + install -m644 talk.1 /usr/man/man1 + +clean: + rm -f *.o talk + --- ctl.c +++ ctl.c 1994/02/28 15:30:32 @@ -49,9 +49,15 @@ #include "talk.h" #include "talk_ctl.h" +#ifdef __linux__ +struct sockaddr_in daemon_addr = { AF_INET }; +struct sockaddr_in ctl_addr = { AF_INET }; +struct sockaddr_in my_addr = { AF_INET }; +#else struct sockaddr_in daemon_addr = { sizeof(daemon_addr), AF_INET }; struct sockaddr_in ctl_addr = { sizeof(ctl_addr), AF_INET }; struct sockaddr_in my_addr = { sizeof(my_addr), AF_INET }; +#endif /* inet addresses of the two machines */ struct in_addr my_machine_addr; --- ctl_transact.c +++ ctl_transact.c 1994/02/28 15:30:32 @@ -70,8 +70,6 @@ * the proper type is obtained. */ do { - wait.tv_sec = CTL_WAIT; - wait.tv_usec = 0; /* resend message until a response is obtained */ do { cc = sendto(ctl_sockt, (char *)&msg, sizeof (msg), 0, @@ -83,6 +81,8 @@ p_error("Error on write to talk daemon"); } read_mask = ctl_mask; + wait.tv_sec = CTL_WAIT; + wait.tv_usec = 0; nready = select(32, &read_mask, 0, 0, &wait); if (nready < 0) { if (errno == EINTR) --- get_names.c +++ get_names.c 1994/02/28 15:30:32 @@ -68,7 +68,7 @@ printf("Standard input must be a tty, not a pipe or a file\n"); exit(-1); } - if ((my_name = getlogin()) == NULL) { + if ((my_name = getlogin()) == NULL || my_name[0] == 0) { struct passwd *pw; if ((pw = getpwuid(getuid())) == NULL) { --- init_disp.c +++ init_disp.c 1994/02/28 15:30:32 @@ -43,7 +43,6 @@ #include "talk.h" #include -#include /* * Set up curses, catch the appropriate signals, @@ -54,6 +53,7 @@ void sig_sent(); struct sigvec sigv; + LINES = COLS = 0; initscr(); (void) sigvec(SIGTSTP, (struct sigvec *)0, &sigv); sigv.sv_mask |= sigmask(SIGALRM); @@ -66,6 +66,7 @@ signal(SIGINT, sig_sent); signal(SIGPIPE, sig_sent); /* curses takes care of ^Z */ + signal(SIGTSTP,SIG_IGN); /* No, it doesn't. */ my_win.x_nlines = LINES / 2; my_win.x_ncols = COLS; my_win.x_win = newwin(my_win.x_nlines, my_win.x_ncols, 0, 0); @@ -95,15 +96,17 @@ { char buf[3]; int cc; - struct termios tty; - - tcgetattr(0, &tty); - my_win.cerase = tty.c_cc[VERASE]; - my_win.kill = tty.c_cc[VKILL]; - if (tty.c_cc[VWERASE] == (char) -1) + struct sgttyb tty; + struct ltchars ltc; + + ioctl(0, TIOCGETP, &tty); + ioctl(0, TIOCGLTC, (struct sgttyb *)<c); + my_win.cerase = tty.sg_erase; + my_win.kill = tty.sg_kill; + if (ltc.t_werasc == (char) -1) my_win.werase = '\027'; /* control W */ else - my_win.werase = tty.c_cc[VWERASE]; + my_win.werase = ltc.t_werasc; buf[0] = my_win.cerase; buf[1] = my_win.kill; buf[2] = my_win.werase; --- invite.c +++ invite.c 1994/02/28 15:30:32 @@ -65,7 +65,7 @@ invite_remote() { - int nfd, read_mask, template, new_sockt; + volatile int nfd, read_mask, template, new_sockt; struct itimerval itimer; CTL_RESPONSE response; @@ -121,6 +121,7 @@ void re_invite() { + signal(SIGALRM, re_invite); message("Ringing your party again"); current_line++; --- msgs.c +++ msgs.c 1994/02/28 15:30:32 @@ -54,6 +54,7 @@ void disp_msg() { + /* signal(SIGALRM,disp_msg); */ message(current_state); }