Newsgroups: comp.sources.unix From: yenne@austin.eds.com (Britt Yenne) Subject: v27i089: ytalk-3.0 - multi-user replacement for the UNIX "talk" program, Patch02 Sender: unix-sources-moderator@gw.home.vix.com Approved: vixie@gw.home.vix.com Submitted-By: yenne@austin.eds.com (Britt Yenne) Posting-Number: Volume 27, Issue 89 Archive-Name: ytalk-3.0/patch02 Patch02 for ytalk-3.0, Volume 27 This patch will update Ytalk 3.0 to Patch Level 2. This patch requires that you have a directory of unmodified source code for YTalk version 3.0, with patch 01 currently applied. To determine which version of Ytalk you have, run it and look at the top of your window. The version identifier for ytalk version 3.0 patch level 1 will look like this: YTalk version 3.0 (1) The version above is what this patch will work on. The number in parentheses, if it exists, is the current Patch Level, meaning that all patches up to and including the displayed number have been applied. If there is not a number in parentheses then you need to apply patch 01 before you can apply this patch. If this is not the patch you require, check the ftp.uu.net USENET archive for comp.sources.unix via anonymous FTP (ytalk-3.0 is under volume27), or mail to ytalk@austin.eds.com. To apply this patch, make a copy of this file under your ytalk source directory and follow the instructions for the "shell archive" below. For a list of changes contained in this patch, see the README file after you apply the patch. Questions or comments to: ytalk@austin.eds.com (Britt Yenne) --------------- cut here --------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'patch_02' <<'END_OF_FILE' X*** 3.0.1/README Tue Aug 24 16:42:58 1993 X--- README Sat Nov 20 23:11:16 1993 X*************** X*** 45,50 **** X--- 45,60 ---- X X ytalk@austin.eds.com X X+ ---- PATCH LEVEL 02 X+ X+ 1. Remove #elif directive, patch by Pete Wenzel. X+ 2. Recognize if party is refusing messages, thanks to J. Adam Hawkes. X+ 3. Linux support, thanks to Thilo Wunderlich. X+ 4. Port to AIX 3.1+. X+ 5. Add -s option to start in a shell, thanks to Mark Musone. X+ 6. Fix various error messages. X+ 7. Fix possible obscure bug in socket.c. X+ X ---- PATCH LEVEL 01 X X 1. Forcibly reset the scrolling region after a shell exits. X*** 3.0.1/ytalk.1 Tue Aug 24 16:42:58 1993 X--- ytalk.1 Sat Nov 20 23:53:25 1993 X*************** X*** 8,20 **** X \fB\\$1\fR X .PP X .. X! .TH YTalk 1 "24 Jun 1993" X .SH NAME X ytalk - A multi-user chat program. X .SH SYNOPSIS X! .B ytalk [-x] username... X .SH DESCRIPTION X! .I YTalk V3.0 Patch Level 1 X .PP X YTalk is in essence a multi-user chat program. It works almost exactly like X the UNIX talk program and even communicates with the same talk daemon(s), but X--- 8,20 ---- X \fB\\$1\fR X .PP X .. X! .TH YTalk 1 "20 Nov 1993" X .SH NAME X ytalk - A multi-user chat program. X .SH SYNOPSIS X! .B ytalk [-x] [-s] username... X .SH DESCRIPTION X! .I YTalk V3.0 Patch Level 2 X .PP X YTalk is in essence a multi-user chat program. It works almost exactly like X the UNIX talk program and even communicates with the same talk daemon(s), but X*************** X*** 42,47 **** X--- 42,49 ---- X .PP X The -x option disables the X11 interface (described below). X .PP X+ The -s option starts your YTalk window in a shell. X+ .PP X For each user on the command line, YTalk will attempt to connect to the talk X daemon on the specified user's host and determine if that user has left an X invitation for you to call. If not, YTalk leaves an invitation for him X*************** X*** 307,318 **** X .SH FUTURE WORK X Work is being done on the following ideas: X .sp X- 1) private conversations which do not get interrupted X .br X! or transmitted to all YTalk connections, X .br X! 2) a dedicated YTalk daemon. X X .SH FILES X X /usr/local/etc/ytalkrc X--- 309,321 ---- X .SH FUTURE WORK X Work is being done on the following ideas: X .sp X .br X! 1) a dedicated YTalk daemon. X .br X! 2) MBCS/NLS support. X! .br X X+ X .SH FILES X X /usr/local/etc/ytalkrc X*************** X*** 342,353 **** X .PP X Thanks to Magnus Hammerin for Solaris 2.* support. X .PP X Thanks to Jonas Yngvesson for aside messages in X. X .PP X Thanks to Andreas Stolcke for fixing the X resource database calls. X .PP X Thanks to John Vanderpool, Shih-Chen Huang, Andrew Myers, Duncan Sinclair, X! Evan McLean, and Larry Schwimmer for comments and ideas. X .PP X The README file shipped with ytalk gives detailed attributions. X X--- 345,361 ---- X .PP X Thanks to Magnus Hammerin for Solaris 2.* support. X .PP X+ Thanks to Thilo Wunderlich for Linux support. X+ .PP X Thanks to Jonas Yngvesson for aside messages in X. X .PP X Thanks to Andreas Stolcke for fixing the X resource database calls. X .PP X+ Thanks to Pete Wenzel for fixing the #elif directive. X+ .PP X Thanks to John Vanderpool, Shih-Chen Huang, Andrew Myers, Duncan Sinclair, X! Evan McLean, Larry Schwimmer, J. Adam Hawkes, and Mark Musone for comments X! and ideas. X .PP X The README file shipped with ytalk gives detailed attributions. X X*** 3.0.1/header.h Tue Aug 24 16:42:58 1993 X--- header.h Fri Aug 27 13:49:21 1993 X*************** X*** 17,23 **** X /* Mail comments or questions to ytalk@austin.eds.com */ X X #include X! #include X #include X #include X #include X--- 17,27 ---- X /* Mail comments or questions to ytalk@austin.eds.com */ X X #include X! #ifdef LINUX X! # include X! #else X! # include X! #endif X #include X #include X #include X*************** X*** 30,36 **** X X #define VMAJOR 3 /* major version number */ X #define VMINOR 0 /* minor version number */ X! #define VPATCH 1 /* patch level */ X X /* ---- YTalk protocols ---- */ X X--- 34,40 ---- X X #define VMAJOR 3 /* major version number */ X #define VMINOR 0 /* minor version number */ X! #define VPATCH 2 /* patch level */ X X /* ---- YTalk protocols ---- */ X X*** 3.0.1/main.c Tue Aug 24 16:42:58 1993 X--- main.c Tue Nov 2 11:37:07 1993 X*************** X*** 134,140 **** X int argc; X char **argv; X { X! int xflg = 0; X char *prog; X X /* check for a 64-bit mis-compile */ X--- 134,140 ---- X int argc; X char **argv; X { X! int xflg = 0, sflg = 0; X char *prog; X X /* check for a 64-bit mis-compile */ X*************** X*** 178,183 **** X--- 178,188 ---- X xflg++; /* disable X from the command line */ X argv++, argc--; X } X+ else if(strcmp(*argv, "-s") == 0) X+ { X+ sflg++; /* immediately start a shell */ X+ argv++, argc--; X+ } X else X argc = 0; /* force a Usage error */ X } X*************** X*** 213,219 **** X init_socket(); X for(; argc > 0; argc--, argv++) X invite(*argv, 1); X! msg_term(me, "Waiting for connection..."); X main_loop(); X bail(YTE_SUCCESS); X X--- 218,227 ---- X init_socket(); X for(; argc > 0; argc--, argv++) X invite(*argv, 1); X! if(sflg) X! execute(NULL); X! else X! msg_term(me, "Waiting for connection..."); X main_loop(); X bail(YTE_SUCCESS); X X*** 3.0.1/comm.c Tue Aug 24 16:42:58 1993 X--- comm.c Thu Nov 18 18:13:20 1993 X*************** X*** 157,163 **** X if((host_addr = get_host_addr(host)) == (ylong)-1) X { X errno = 0; X! sprintf(errstr, "unknown host: '%s'\n", host); X show_error(errstr); X show_error("port from ytalk V2.? failed"); X return; X--- 157,163 ---- X if((host_addr = get_host_addr(host)) == (ylong)-1) X { X errno = 0; X! sprintf(errstr, "unknown host: '%s'", host); X show_error(errstr); X show_error("port from ytalk V2.? failed"); X return; X*************** X*** 748,756 **** X return -1; X X errno = 0; X! if(send_dgram(user, ANNOUNCE) != 0) X! return -1; X! return 0; X } X X /* ---- global functions ---- */ X--- 748,758 ---- X return -1; X X errno = 0; X! if((rc = send_dgram(user, ANNOUNCE)) == 0) X! return 0; X! if(rc == 4) /* mesg n (refusing messages) */ X! return 1; X! return -1; X } X X /* ---- global functions ---- */ X*************** X*** 833,842 **** X } X (void)send_dgram(user, LEAVE_INVITE); X user->last_invite = (ylong)time(NULL); X! if(send_announce && announce(user) < 0) X { X (void)send_dgram(user, DELETE_INVITE); X! sprintf(errstr, "%s not logged in", user->full_name); X show_error(errstr); X free_user(user); X return; X--- 835,847 ---- X } X (void)send_dgram(user, LEAVE_INVITE); X user->last_invite = (ylong)time(NULL); X! if(send_announce && (rc = announce(user)) != 0) X { X (void)send_dgram(user, DELETE_INVITE); X! if(rc > 0) X! sprintf(errstr, "%s refusing messages", user->full_name); X! else X! sprintf(errstr, "%s not logged in", user->full_name); X show_error(errstr); X free_user(user); X return; X*************** X*** 853,859 **** X ylong t; X static char estr[80]; X static ylong last_auto = 0; X! int answer; X X t = (ylong)time(NULL); X X--- 858,864 ---- X ylong t; X static char estr[80]; X static ylong last_auto = 0; X! int answer, rc; X X t = (ylong)time(NULL); X X*************** X*** 884,893 **** X if(answer == 'n') X continue; X } X! if(announce(u) < 0) X { X (void)send_dgram(u, DELETE_INVITE); X! sprintf(errstr, "%s not logged in", u->full_name); X show_error(errstr); X free_user(u); X } X--- 889,901 ---- X if(answer == 'n') X continue; X } X! if((rc = announce(u)) != 0) X { X (void)send_dgram(u, DELETE_INVITE); X! if(rc > 0) X! sprintf(errstr, "%s refusing messages", u->full_name); X! else X! sprintf(errstr, "%s not logged in", u->full_name); X show_error(errstr); X free_user(u); X } X*** 3.0.1/fd.c Tue Aug 24 16:42:58 1993 X--- fd.c Thu Aug 26 09:19:05 1993 X*************** X*** 130,137 **** X X #if defined(SIGCHLD) X signal(SIGCHLD, SIG_IGN); X! #elif defined(SIGCLD) X signal(SIGCLD, SIG_IGN); X #endif X X /* For housecleaning to occur every CLEAN_INTERVAL seconds, we make X--- 130,139 ---- X X #if defined(SIGCHLD) X signal(SIGCHLD, SIG_IGN); X! #else X! # if defined(SIGCLD) X signal(SIGCLD, SIG_IGN); X+ # endif X #endif X X /* For housecleaning to occur every CLEAN_INTERVAL seconds, we make X*** 3.0.1/exec.c Tue Aug 24 16:42:59 1993 X--- exec.c Fri Sep 17 18:21:58 1993 X*************** X*** 55,60 **** X--- 55,76 ---- X char *name; X { X register int pty, tty; X+ char *pty_dev = "/dev/ptc", *tt; X+ extern char *ttyname(); X+ X+ /* first look for a SYSV-type pseudo device */ X+ X+ if((pty = open(pty_dev, O_RDWR)) >= 0) X+ { X+ if((tt = ttyname(pty)) != NULL) X+ { X+ strcpy(name, tt); X+ return pty; X+ } X+ close(pty); X+ } X+ X+ /* scan Berkeley-style */ X X strcpy(name, "/dev/ptyp0"); X while(access(name, 0) == 0) X*** 3.0.1/socket.c Tue Aug 24 16:42:59 1993 X--- socket.c Sat Nov 20 23:09:26 1993 X*************** X*** 653,659 **** X--- 653,663 ---- X nmsg.addr = user->sock; X nmsg.addr.sin_family = htons(AF_INET); X if(sendit(addr, d) != 0) X+ { X+ if(type == AUTO_LOOK_UP || type == AUTO_DELETE) X+ strncpy(nmsg.l_name, me->user_name, NAME_SIZE); X return -2; X+ } X X switch(type) X { X*************** X*** 830,840 **** X ylong addr; X ylong inet_addr(); X X if((host = (struct hostent *) gethostbyname(hostname)) != NULL) X { X if(host->h_length != sizeof(addr)) X { X! sprintf(errstr, "Bad IN addr: %s\n", hostname); X show_error(errstr); X return (ylong)-1; X } X--- 834,845 ---- X ylong addr; X ylong inet_addr(); X X+ errno = 0; X if((host = (struct hostent *) gethostbyname(hostname)) != NULL) X { X if(host->h_length != sizeof(addr)) X { X! sprintf(errstr, "Bad IN addr: %s", hostname); X show_error(errstr); X return (ylong)-1; X } X*************** X*** 878,896 **** X X if((from_addr = get_host_addr(from_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'\n", from_id); X show_error(errstr); X return; X } X if((to_addr = get_host_addr(to_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'\n", to_id); X show_error(errstr); X return; X } X if((on_addr = get_host_addr(on_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'\n", on_id); X show_error(errstr); X return; X } X--- 883,901 ---- X X if((from_addr = get_host_addr(from_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'", from_id); X show_error(errstr); X return; X } X if((to_addr = get_host_addr(to_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'", to_id); X show_error(errstr); X return; X } X if((on_addr = get_host_addr(on_id)) == (ylong)-1) X { X! sprintf(errstr, "Unknown host: '%s'", on_id); X show_error(errstr); X return; X } X*** 3.0.1/user.c Tue Aug 24 16:42:59 1993 X--- user.c Thu Nov 18 18:13:48 1993 X*************** X*** 195,201 **** X } X else if((addr = get_host_addr(hostname)) == (ylong)-1) X { X! sprintf(errstr, "new_user: bad host: '%s'\n", hostname); X show_error(errstr); X return NULL; X } X--- 195,201 ---- X } X else if((addr = get_host_addr(hostname)) == (ylong)-1) X { X! sprintf(errstr, "new_user: bad host: '%s'", hostname); X show_error(errstr); X return NULL; X } X*** 3.0.1/term.c Tue Aug 24 16:42:59 1993 X--- term.c Fri Sep 17 17:37:03 1993 X*************** X*** 17,24 **** X /* Mail comments or questions to ytalk@austin.eds.com */ X X #include "header.h" X #ifdef USE_SGTTY X- # include X # ifdef hpux X # include X # include X--- 17,24 ---- X /* Mail comments or questions to ytalk@austin.eds.com */ X X #include "header.h" X+ #include X #ifdef USE_SGTTY X # ifdef hpux X # include X # include X*** 3.0.1/cwin.c Tue Aug 24 16:42:59 1993 X--- cwin.c Fri Sep 17 17:32:38 1993 X*************** X*** 433,436 **** X--- 433,438 ---- X set_cooked_curses() X { X noraw(); X+ crmode(); X+ noecho(); X } END_OF_FILE if test 12468 -ne `wc -c <'patch_02'`; then echo shar: \"'patch_02'\" unpacked with wrong size! fi # end of 'patch_02' fi echo shar: End of shell archive. echo "== Now run 'patch < patch_02' ==" exit 0