home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume27
/
ytalk-3.0
/
patch01
/
patch_01
< prev
Wrap
Text File
|
1993-08-24
|
62KB
|
2,559 lines
*** 3.0.0/README Mon Aug 23 14:05:01 1993
--- README Tue Aug 24 16:37:57 1993
***************
*** 22,27 ****
--- 22,31 ----
The resulting executable program will be named "ytalk".
+ If you ever go back and change some configuration parameters at the
+ top of Imakefile or Makefile, you should run 'make clean' before running
+ 'xmkmf' and/or 'make' again. This will ensure that everything recompiles.
+
A manpage will automatically be built. It will be named "ytalk.cat".
You can read the manual page by running:
***************
*** 40,42 ****
--- 44,69 ----
at this email address:
ytalk@austin.eds.com
+
+ ---- PATCH LEVEL 01
+
+ 1. Forcibly reset the scrolling region after a shell exits.
+ 2. Handle a local X resize while in a shell.
+ 3. Repair the password entry lookup stuff.
+ 4. Character-wrap to next line if word-wrap is disabled.
+ 5. Solaris 2.* support, patch by Magnus Hammerin.
+ 6. Aside messages in X, patch by Jonas Yngvesson.
+ 7. Fix X support, patch by Carl Edman.
+ 8. Option -x to disable X from the command line, thanks to John Vanderpool.
+ 9. Ctrl-L or ctrl-R to redraw screen, thanks to Shih-Chen Huang.
+ 10. Fix bizarre WINCH bug in exec.c.
+ 11. Handle 64-bit machines, thanks to Andrew Myers.
+ 12. Implement raw/cooked curses -- fixes 8-bit/parity problems with some
+ terminals and allows ytalk to be suspended. Thanks to Duncan Sinclair.
+ 13. System ytalkrc file, thanks to Evan McLean.
+ 14. Place user's full name in title bar, thanks to Evan McLean.
+ 15. Better imake support, thanks to Carl Edman.
+ 16. Installation features for make.
+ 17. Fix X resource database calls, patch by Andreas Stolcke.
+ 18. Fix cross-platform problems, thanks to Larry Schwimmer.
+
*** 3.0.0/ytalk.1 Mon Aug 23 14:05:02 1993
--- ytalk.1 Tue Aug 24 12:11:08 1993
***************
*** 12,20 ****
.SH NAME
ytalk - A multi-user chat program.
.SH SYNOPSIS
! .B ytalk username...
.SH DESCRIPTION
! .I YTalk V3.0
.PP
YTalk is in essence a multi-user chat program. It works almost exactly like
the UNIX talk program and even communicates with the same talk daemon(s), but
--- 12,20 ----
.SH NAME
ytalk - A multi-user chat program.
.SH SYNOPSIS
! .B ytalk [-x] username...
.SH DESCRIPTION
! .I YTalk V3.0 Patch Level 1
.PP
YTalk is in essence a multi-user chat program. It works almost exactly like
the UNIX talk program and even communicates with the same talk daemon(s), but
***************
*** 40,45 ****
--- 40,47 ----
.sp
ytalk george fred@hissun.edu marc@grumpy.cc
.PP
+ The -x option disables the X11 interface (described below).
+ .PP
For each user on the command line, YTalk will attempt to connect to the talk
daemon on the specified user's host and determine if that user has left an
invitation for you to call. If not, YTalk leaves an invitation for him
***************
*** 95,111 ****
moment has these options:
.sp
a: add a user
! .sp
d: delete a user
! .sp
o: options
! .sp
s: shell
! .sp
u: user list
! .sp
w: output user to file
! .sp
q: quit
.PP
By choosing option "a", you are given the opportunity to type the name of any
--- 97,113 ----
moment has these options:
.sp
a: add a user
! .br
d: delete a user
! .br
o: options
! .br
s: shell
! .br
u: user list
! .br
w: output user to file
! .br
q: quit
.PP
By choosing option "a", you are given the opportunity to type the name of any
***************
*** 148,161 ****
to edit the YTalk options. The current options are:
.sp
s: turn scrolling [off/on]
! .sp
w: turn word-wrap [off/on]
! .sp
i: turn auto-import [off/on]
! .sp
v: turn auto-invite [off/on]
! .sp
r: turn auto-rering [off/on]
.PP
If
.I scrolling
--- 150,165 ----
to edit the YTalk options. The current options are:
.sp
s: turn scrolling [off/on]
! .br
w: turn word-wrap [off/on]
! .br
i: turn auto-import [off/on]
! .br
v: turn auto-invite [off/on]
! .br
r: turn auto-rering [off/on]
+ .br
+ a: turn asides [off/on]
.PP
If
.I scrolling
***************
*** 186,191 ****
--- 190,201 ----
respond to your invitation within 30 seconds. You will not be asked for
verification.
.PP
+ If
+ .I asides
+ is turned on (it may not be available), then keyboard input received while
+ the input focus is in a specific users' window will only be sent to that
+ user. See the X11 interface description below.
+ .PP
Any of these options can be set to your preference in your .ytalkrc file,
as described below.
.SH YTALK STARTUP FILE
***************
*** 207,212 ****
--- 217,223 ----
.I auto-import ,
.I auto-invite ,
.I auto-rering ,
+ .I asides ,
or
.I X .
Setting these options works just like described above. Turning
***************
*** 269,278 ****
If the DISPLAY environment variable is defined when YTalk starts up, then
YTalk will attempt to communicate with that X server. A window will be
created for you and each user you are connected to. The X11 Interface can
! be disabled by putting this line into your .ytalkrc file:
.sp
turn X off
.PP
YTalk consults the X11 Resource Database for these user-definable
configuration options:
.sp
--- 280,298 ----
If the DISPLAY environment variable is defined when YTalk starts up, then
YTalk will attempt to communicate with that X server. A window will be
created for you and each user you are connected to. The X11 Interface can
! be disabled either by specifying -x on the command line or by putting this
! line into your .ytalkrc file:
.sp
turn X off
.PP
+ A window is created for each individual user in the conversation. If the
+ input focus is in the main window (ie: the one with "ytalk" in the title
+ bar) then anything typed will be sent to all connected users. If the input
+ focus is in one of the users' windows, then anything typed will be sent
+ as an aside to only that user. If the "aside" option is turned off (see
+ above) then ytalk will beep and not accept anything typed when the input
+ focus is not in the main window.
+ .PP
YTalk consults the X11 Resource Database for these user-definable
configuration options:
.sp
***************
*** 291,301 ****
.br
or transmitted to all YTalk connections,
.br
! 2) a way to send an aside to just one or a few of the
.br
! connected users,
.br
! 3) a dedicated YTalk daemon.
.SH AUTHOR
--- 311,329 ----
.br
or transmitted to all YTalk connections,
.br
! 2) a dedicated YTalk daemon.
!
! .SH FILES
!
! /usr/local/etc/ytalkrc
.br
! System-wide defaults file.
! .PP
! $HOME/.ytalkrc
.br
! User's local configuration file. This file overrides
! .br
! options set in the system ytalkrc file.
.SH AUTHOR
***************
*** 304,313 ****
yenne@austin.eds.com
.SH CONTRIBUTORS
! Special thanks to Carl Edman, Tobias Hahn, and Geoff W. for beta
! testing and suggestions.
.PP
Thanks to Sitaram Ramaswamy for the original YTalk manpage.
.SH BUGS
--- 332,355 ----
yenne@austin.eds.com
.SH CONTRIBUTORS
! Special thanks to Carl Edman for numerous code patches, beta testing,
! and comments. I think this guy spends as much time on ytalk as I do.
.PP
+ Special thanks to Tobias Hahn and Geoff W. for beta testing and
+ suggestions.
+ .PP
Thanks to Sitaram Ramaswamy for the original YTalk manpage.
+ .PP
+ Thanks to Magnus Hammerin for Solaris 2.* support.
+ .PP
+ Thanks to Jonas Yngvesson for aside messages in X.
+ .PP
+ Thanks to Andreas Stolcke for fixing the X resource database calls.
+ .PP
+ Thanks to John Vanderpool, Shih-Chen Huang, Andrew Myers, Duncan Sinclair,
+ Evan McLean, and Larry Schwimmer for comments and ideas.
+ .PP
+ The README file shipped with ytalk gives detailed attributions.
.SH BUGS
*** 3.0.0/term.doc Mon Aug 23 14:05:02 1993
--- term.doc Sun Aug 22 21:34:48 1993
***************
*** 19,27 ****
by calling this function in comm.c:
void
! my_input(buf, len) [in comm.c]
ychar *buf;
int len;
Note that it is much more optimal to call this function once with a
batch of input characters rather than calling this function once for
--- 19,37 ----
by calling this function in comm.c:
void
! my_input(user, buf, len) [in comm.c]
! yuser *user;
ychar *buf;
int len;
+
+ The "user" parameter should be set to the user pointer whose window
+ the given input was taken from (ie: I had my mouse cursor in the
+ window assigned to user X and typed some info). The my_input routine
+ will send the given info to the given user as an aside, ie: no other
+ users get sent this info. If a terminal interface cannot distinguish
+ input from various windows, or if you do not wish to bother with this,
+ then just send "me" as the user. Any input given the "me" user will
+ get sent to all connected users.
Note that it is much more optimal to call this function once with a
batch of input characters rather than calling this function once for
*** 3.0.0/header.h Mon Aug 23 14:05:02 1993
--- header.h Tue Aug 24 10:39:40 1993
***************
*** 30,35 ****
--- 30,36 ----
#define VMAJOR 3 /* major version number */
#define VMINOR 0 /* minor version number */
+ #define VPATCH 1 /* patch level */
/* ---- YTalk protocols ---- */
***************
*** 49,54 ****
--- 50,61 ----
typedef yaddr yterm; /* terminal cookie */
typedef u_char ychar; /* we use unsigned chars */
+ #ifdef Y64BIT
+ typedef u_int ylong; /* unsigned 32-bit */
+ #else
+ typedef u_long ylong; /* unsigned 32-bit */
+ #endif
+
typedef struct {
u_char w_rows, w_cols; /* window size FOR PROTOCOL YTP_OLD */
char protocol; /* ytalk protocol -- see above */
***************
*** 56,62 ****
short vmajor, vminor; /* version numbers */
u_short rows, cols; /* his window size over there */
u_short my_rows, my_cols; /* my window size over there */
! u_long pid; /* my process id */
char pad[44]; /* zeroed out */
} y_parm;
--- 63,69 ----
short vmajor, vminor; /* version numbers */
u_short rows, cols; /* his window size over there */
u_short my_rows, my_cols; /* my window size over there */
! ylong pid; /* my process id */
char pad[44]; /* zeroed out */
} y_parm;
***************
*** 67,73 ****
struct _yuser *unext; /* next user in full user list */
int fd; /* file descriptor */
int output_fd; /* non-zero if output is going to a file */
! u_long flags; /* active FL_* flags below */
ychar edit[4]; /* edit characters */
u_short t_rows, t_cols; /* his rows and cols on window over here */
u_short rows, cols; /* his active region rows and cols over here */
--- 74,80 ----
struct _yuser *unext; /* next user in full user list */
int fd; /* file descriptor */
int output_fd; /* non-zero if output is going to a file */
! ylong flags; /* active FL_* flags below */
ychar edit[4]; /* edit characters */
u_short t_rows, t_cols; /* his rows and cols on window over here */
u_short rows, cols; /* his active region rows and cols over here */
***************
*** 85,95 ****
char *user_name; /* user name */
char *host_name; /* host name */
char *tty_name; /* tty name */
! u_long host_addr; /* host inet address */
int daemon; /* daemon type to use */
! u_long l_id, r_id; /* local and remote talkd invite list index */
! u_long d_id; /* talk daemon process id -- see socket.c */
! long last_invite; /* timestamp of last invitation sent */
struct sockaddr_in sock; /* communication socket */
struct sockaddr_in orig_sock; /* original socket -- another sick hack */
u_int av[MAXARG]; /* ESC sequence arguments */
--- 92,102 ----
char *user_name; /* user name */
char *host_name; /* host name */
char *tty_name; /* tty name */
! ylong host_addr; /* host inet address */
int daemon; /* daemon type to use */
! ylong l_id, r_id; /* local and remote talkd invite list index */
! ylong d_id; /* talk daemon process id -- see socket.c */
! ylong last_invite; /* timestamp of last invitation sent */
struct sockaddr_in sock; /* communication socket */
struct sockaddr_in orig_sock; /* original socket -- another sick hack */
u_int av[MAXARG]; /* ESC sequence arguments */
***************
*** 119,124 ****
--- 126,132 ----
#define FL_INVITE 0x00000010L /* auto-invite enabled */
#define FL_RING 0x00000020L /* auto-rering enabled */
#define FL_XWIN 0x00000040L /* X Windows enabled (startup opt) */
+ #define FL_ASIDE 0x00000080L /* multiple window input/asides */
#define FL_LOCKED 0x40000000L /* flags locked by other end */
/* ---- defines and short-cuts ---- */
***************
*** 151,158 ****
typedef struct {
ychar code; /* V3_EXPORT, V3_IMPORT, or V3_ACCEPT */
char filler[3];
! u_long host_addr; /* host address */
! u_long pid; /* process id */
char name[V3_NAMELEN]; /* user name */
char host[V3_HOSTLEN]; /* host name */
} v3_pack;
--- 159,166 ----
typedef struct {
ychar code; /* V3_EXPORT, V3_IMPORT, or V3_ACCEPT */
char filler[3];
! ylong host_addr; /* host address */
! ylong pid; /* process id */
char name[V3_NAMELEN]; /* user name */
char host[V3_HOSTLEN]; /* host name */
} v3_pack;
***************
*** 165,171 ****
typedef struct {
ychar code; /* V3_LOCKF or V3_UNLOCKF */
char filler[3];
! u_long flags; /* flags */
} v3_flags;
#define V3_FLAGSLEN sizeof(v3_flags)
--- 173,179 ----
typedef struct {
ychar code; /* V3_LOCKF or V3_UNLOCKF */
char filler[3];
! ylong flags; /* flags */
} v3_flags;
#define V3_FLAGSLEN sizeof(v3_flags)
***************
*** 220,226 ****
extern yuser *fd_to_user[MAX_FILES]; /* convert file descriptors to users */
extern yuser *key_to_user[128]; /* convert menu ident chars to users */
extern char errstr[MAXERR]; /* temporary string for errors */
! extern u_long def_flags; /* default FL_* flags */
extern int user_winch; /* user window/status changed flag */
extern ychar *io_ptr; /* user input pointer */
--- 228,234 ----
extern yuser *fd_to_user[MAX_FILES]; /* convert file descriptors to users */
extern yuser *key_to_user[128]; /* convert menu ident chars to users */
extern char errstr[MAXERR]; /* temporary string for errors */
! extern ylong def_flags; /* default FL_* flags */
extern int user_winch; /* user window/status changed flag */
extern ychar *io_ptr; /* user input pointer */
***************
*** 228,233 ****
--- 236,249 ----
extern int running_process; /* flag: is process running? */
+ /* ---- some machine compatibility definitions ---- */
+
+ #if defined(SYSV)
+ # define Y_USE_SIGHOLD 1
+ #endif
+
+ extern int errno;
+
/* ---- global functions ---- */
extern void bail ( /* int */ ); /* main.c */
***************
*** 267,272 ****
--- 283,292 ----
extern void msg_term ( /* yuser, str */ ); /* term.c */
extern void spew_term ( /* yuser, fd, rows, cols */ ); /* term.c */
extern int center ( /* width, n */ ); /* term.c */
+ extern void redraw_all_terms(); /* term.c */
+ extern void set_raw_term (); /* term.c */
+ extern void set_cooked_term (); /* term.c */
+ extern int term_does_asides(); /* term.c */
extern void init_user (); /* user.c */
extern yuser *new_user ( /* name, host, tty */ ); /* user.c */
***************
*** 298,304 ****
extern void kill_auto (); /* socket.c */
extern int newsock ( /* yuser */ ); /* socket.c */
extern int connect_to ( /* yuser */ ); /* socket.c */
! extern u_long get_host_addr ( /* hostname */ ); /* socket.c */
extern char *host_name ( /* addr */ ); /* socket.c */
extern void readdress_host ( /* from, to, on */ ); /* socket.c */
--- 318,324 ----
extern void kill_auto (); /* socket.c */
extern int newsock ( /* yuser */ ); /* socket.c */
extern int connect_to ( /* yuser */ ); /* socket.c */
! extern ylong get_host_addr ( /* hostname */ ); /* socket.c */
extern char *host_name ( /* addr */ ); /* socket.c */
extern void readdress_host ( /* from, to, on */ ); /* socket.c */
*** 3.0.0/socket.h Mon Aug 23 14:05:03 1993
--- socket.h Sun Aug 22 21:05:40 1993
***************
*** 18,33 ****
typedef struct _hostinfo {
struct _hostinfo *next; /* next in linked list */
! u_long host_addr; /* host address */
int dtype; /* active daemon types bitmask */
} hostinfo;
typedef struct _readdr {
struct _readdr *next; /* next in linked list */
! u_long addr; /* this net address [group?], */
! u_long mask; /* with this mask, */
! u_long id_addr; /* thinks I'm at this net address, */
! u_long id_mask; /* with this mask. */
} readdr;
extern struct _talkd talkd[MAXDAEMON+1];
--- 18,33 ----
typedef struct _hostinfo {
struct _hostinfo *next; /* next in linked list */
! ylong host_addr; /* host address */
int dtype; /* active daemon types bitmask */
} hostinfo;
typedef struct _readdr {
struct _readdr *next; /* next in linked list */
! ylong addr; /* this net address [group?], */
! ylong mask; /* with this mask, */
! ylong id_addr; /* thinks I'm at this net address, */
! ylong id_mask; /* with this mask. */
} readdr;
extern struct _talkd talkd[MAXDAEMON+1];
***************
*** 45,52 ****
char l_name[NAME_SIZE];
char r_name[NAME_SIZE];
char filler;
! u_long id_num;
! u_long pid;
char r_tty[TTY_SIZE];
struct sockaddr_in addr;
struct sockaddr_in ctl_addr;
--- 45,52 ----
char l_name[NAME_SIZE];
char r_name[NAME_SIZE];
char filler;
! ylong id_num;
! ylong pid;
char r_tty[TTY_SIZE];
struct sockaddr_in addr;
struct sockaddr_in ctl_addr;
***************
*** 58,64 ****
char type;
char answer;
u_short filler;
! u_long id_num;
struct sockaddr_in addr;
} CTL_RESPONSE;
--- 58,64 ----
char type;
char answer;
u_short filler;
! ylong id_num;
struct sockaddr_in addr;
} CTL_RESPONSE;
***************
*** 68,77 ****
u_char vers;
char type;
u_short filler;
! u_long id_num;
struct sockaddr_in addr;
struct sockaddr_in ctl_addr;
! u_long pid;
char l_name[NAME_SIZE];
char l_name_filler[3];
char r_name[NAME_SIZE];
--- 68,77 ----
u_char vers;
char type;
u_short filler;
! ylong id_num;
struct sockaddr_in addr;
struct sockaddr_in ctl_addr;
! ylong pid;
char l_name[NAME_SIZE];
char l_name_filler[3];
char r_name[NAME_SIZE];
***************
*** 86,92 ****
char type;
char answer;
char filler;
! u_long id_num;
struct sockaddr_in addr;
} CTL_RESPONSE42;
--- 86,92 ----
char type;
char answer;
char filler;
! ylong id_num;
struct sockaddr_in addr;
} CTL_RESPONSE42;
*** 3.0.0/cwin.h Mon Aug 23 14:05:03 1993
--- cwin.h Tue Aug 24 11:16:40 1993
***************
*** 1,4 ****
! /* curses.h -- curses interface (curses.c) */
/* NOTICE
*
--- 1,4 ----
! /* cwin.h -- curses interface (cwin.c) */
/* NOTICE
*
***************
*** 26,31 ****
--- 26,34 ----
extern void clreos_curses ( /* yuser */ );
extern void scroll_curses ( /* yuser */ );
extern void flush_curses ( /* yuser */ );
+ extern void redisplay_curses();
+ extern void set_raw_curses();
+ extern void set_cooked_curses();
#ifndef getyx
# define getyx(w,y,x) y = w->_cury, x = w->_curx
*** 3.0.0/main.c Mon Aug 23 14:05:03 1993
--- main.c Tue Aug 24 16:07:47 1993
***************
*** 134,146 ****
int argc;
char **argv;
{
! if(argc <= 1)
{
! fprintf(stderr, "Usage: %s user[@hostname][#tty] [user...]\n", *argv);
(void)exit(YTE_INIT);
}
argv++, argc--;
/* set up signals */
signal(SIGINT, got_sig);
--- 134,195 ----
int argc;
char **argv;
{
! int xflg = 0;
! char *prog;
!
! /* check for a 64-bit mis-compile */
!
! if(sizeof(ylong) != 4)
{
! if(sizeof(ylong) > 4)
! {
! fprintf(stderr,
! "You should have compiled ytalk with the -DY64BIT option.\n");
! }
! else
! {
! #ifdef Y64BIT
! fprintf(stderr,
! "You should NOT have compiled ytalk with the -DY64BIT option.\n");
! #else
! fprintf(stderr,
! "Your machine doesn't support 32-bit longs. Please mail\n");
! fprintf(stderr,
! "ytalk@austin.eds.com your machine type and OS version.\n");
! (void)exit(YTE_INIT);
! #endif
! }
! fprintf(stderr,
! "See the README file on how to update the appropriate\n");
! fprintf(stderr,
! "makefile, then type 'make clean', 'make'.\n");
(void)exit(YTE_INIT);
}
+
+ /* search for options */
+
+ prog = *argv;
argv++, argc--;
+ while(argc > 0 && **argv == '-')
+ {
+ if(strcmp(*argv, "-x") == 0
+ || strcmp(*argv, "-nw") == 0)
+ {
+ xflg++; /* disable X from the command line */
+ argv++, argc--;
+ }
+ else
+ argc = 0; /* force a Usage error */
+ }
+ /* check for users */
+
+ if(argc <= 0)
+ {
+ fprintf(stderr, "Usage: %s [-x] user[@hostname][#tty]...\n", prog);
+ (void)exit(YTE_INIT);
+ }
+
/* set up signals */
signal(SIGINT, got_sig);
***************
*** 158,163 ****
--- 207,214 ----
init_fd();
init_user();
read_ytalkrc();
+ if(xflg)
+ def_flags &= ~FL_XWIN;
init_term();
init_socket();
for(; argc > 0; argc--, argv++)
*** 3.0.0/comm.c Mon Aug 23 14:05:03 1993
--- comm.c Mon Aug 23 13:30:30 1993
***************
*** 142,148 ****
v2_pack *pack;
{
register yuser *u;
! u_long host_addr;
static char name[V2_NAMELEN + 1];
static char host[V2_HOSTLEN + 1];
static char estr[V2_NAMELEN + V2_HOSTLEN + 20];
--- 142,148 ----
v2_pack *pack;
{
register yuser *u;
! ylong host_addr;
static char name[V2_NAMELEN + 1];
static char host[V2_HOSTLEN + 1];
static char estr[V2_NAMELEN + V2_HOSTLEN + 20];
***************
*** 154,160 ****
strncpy(host, pack->host, V2_HOSTLEN);
name[V2_NAMELEN] = '\0';
host[V2_HOSTLEN] = '\0';
! if((host_addr = get_host_addr(host)) == (u_long)-1)
{
errno = 0;
sprintf(errstr, "unknown host: '%s'\n", host);
--- 154,160 ----
strncpy(host, pack->host, V2_HOSTLEN);
name[V2_NAMELEN] = '\0';
host[V2_HOSTLEN] = '\0';
! if((host_addr = get_host_addr(host)) == (ylong)-1)
{
errno = 0;
sprintf(errstr, "unknown host: '%s'\n", host);
***************
*** 168,174 ****
/* Don't import a user with the same name of an existing
* user at this end. yukk.
*/
! if(find_user(name, host_addr, (u_long)-1) != NULL)
break;
if(!(def_flags & FL_IMPORT))
{
--- 168,174 ----
/* Don't import a user with the same name of an existing
* user at this end. yukk.
*/
! if(find_user(name, host_addr, (ylong)-1) != NULL)
break;
if(!(def_flags & FL_IMPORT))
{
***************
*** 193,199 ****
* send_accept() will think his version number is zero
* and won't send anything.
*/
! if((u = find_user(name, host_addr, (u_long)-1)) == NULL)
break;
send_accept(u, user);
break;
--- 193,199 ----
* send_accept() will think his version number is zero
* and won't send anything.
*/
! if((u = find_user(name, host_addr, (ylong)-1)) == NULL)
break;
send_accept(u, user);
break;
***************
*** 212,218 ****
v3_pack *pack;
{
register yuser *u;
! u_long host_addr, pid;
static char name[V3_NAMELEN + 1];
static char host[V3_HOSTLEN + 1];
static char estr[V3_NAMELEN + V3_HOSTLEN + 20];
--- 212,218 ----
v3_pack *pack;
{
register yuser *u;
! ylong host_addr, pid;
static char name[V3_NAMELEN + 1];
static char host[V3_HOSTLEN + 1];
static char estr[V3_NAMELEN + V3_HOSTLEN + 20];
***************
*** 221,227 ****
strncpy(host, pack->host, V3_HOSTLEN);
name[V3_NAMELEN] = '\0';
host[V3_HOSTLEN] = '\0';
! if((host_addr = get_host_addr(host)) == (u_long)-1)
host_addr = ntohl(pack->host_addr);
pid = ntohl(pack->pid);
--- 221,227 ----
strncpy(host, pack->host, V3_HOSTLEN);
name[V3_NAMELEN] = '\0';
host[V3_HOSTLEN] = '\0';
! if((host_addr = get_host_addr(host)) == (ylong)-1)
host_addr = ntohl(pack->host_addr);
pid = ntohl(pack->pid);
***************
*** 524,532 ****
parm.my_rows = ntohs(parm.my_rows);
parm.my_cols = ntohs(parm.my_cols);
parm.pid = ntohl(parm.pid);
! if(user->remote.vmajor <= 2)
! spew_term(me, fd, parm.rows, parm.cols);
! /* else we spew_term later */
break;
default:
free_user(user);
--- 524,530 ----
parm.my_rows = ntohs(parm.my_rows);
parm.my_cols = ntohs(parm.my_cols);
parm.pid = ntohl(parm.pid);
! /* we spew_term later */
break;
default:
free_user(user);
***************
*** 603,609 ****
show_error("connect_user: bad read");
return;
}
! if(open_term(user, user->user_name) < 0)
{
free_user(user);
show_error("connect_user: open_term() failed");
--- 601,607 ----
show_error("connect_user: bad read");
return;
}
! if(open_term(user, user->full_name) < 0)
{
free_user(user);
show_error("connect_user: open_term() failed");
***************
*** 699,710 ****
for(i = 1; i < bound && user->scr[user->y][x-i] != ' '; i++)
temp[i] = user->scr[user->y][x-i];
if(i >= bound)
! return;
move_term(user, user->y, x - i);
clreol_term(user);
newline_term(user);
for(i--; i >= 1; i--)
addch_term(user, temp[i]);
}
/* Ring a user. If he has an auto-invitation port established then talk
--- 697,709 ----
for(i = 1; i < bound && user->scr[user->y][x-i] != ' '; i++)
temp[i] = user->scr[user->y][x-i];
if(i >= bound)
! return -1;
move_term(user, user->y, x - i);
clreol_term(user);
newline_term(user);
for(i--; i >= 1; i--)
addch_term(user, temp[i]);
+ return 0;
}
/* Ring a user. If he has an auto-invitation port established then talk
***************
*** 812,818 ****
free_user(user);
return;
}
! user->last_invite = time(NULL);
add_fd(user->fd, connect_user);
(void)write(user->fd, me->edit, 3); /* send the edit keys */
return;
--- 811,817 ----
free_user(user);
return;
}
! user->last_invite = (ylong)time(NULL);
add_fd(user->fd, connect_user);
(void)write(user->fd, me->edit, 3); /* send the edit keys */
return;
***************
*** 833,839 ****
return;
}
(void)send_dgram(user, LEAVE_INVITE);
! user->last_invite = time(NULL);
if(send_announce && announce(user) < 0)
{
(void)send_dgram(user, DELETE_INVITE);
--- 832,838 ----
return;
}
(void)send_dgram(user, LEAVE_INVITE);
! user->last_invite = (ylong)time(NULL);
if(send_announce && announce(user) < 0)
{
(void)send_dgram(user, DELETE_INVITE);
***************
*** 851,862 ****
house_clean()
{
register yuser *u, *next;
! long t;
static char estr[80];
! static u_long last_auto = 0;
int answer;
! t = time(NULL);
if(t - last_auto >= 30)
{
--- 850,861 ----
house_clean()
{
register yuser *u, *next;
! ylong t;
static char estr[80];
! static ylong last_auto = 0;
int answer;
! t = (ylong)time(NULL);
if(t - last_auto >= 30)
{
***************
*** 874,880 ****
if(t - u->last_invite >= 30)
{
(void)send_dgram(u, LEAVE_INVITE);
! u->last_invite = t = time(NULL);
if(!(def_flags & FL_RING))
{
if(input_flag)
--- 873,879 ----
if(t - u->last_invite >= 30)
{
(void)send_dgram(u, LEAVE_INVITE);
! u->last_invite = t = (ylong)time(NULL);
if(!(def_flags & FL_RING))
{
if(input_flag)
***************
*** 881,887 ****
continue;
sprintf(estr, "Rering %s?", u->full_name);
answer = yes_no(estr);
! t = time(NULL);
if(answer == 'n')
continue;
}
--- 880,886 ----
continue;
sprintf(estr, "Rering %s?", u->full_name);
answer = yes_no(estr);
! t = (ylong)time(NULL);
if(answer == 'n')
continue;
}
***************
*** 948,955 ****
send_oob(u->fd, &v3w, V3_WINCHLEN);
}
void
! send_users(buf, len)
ychar *buf;
register int len;
{
--- 947,958 ----
send_oob(u->fd, &v3w, V3_WINCHLEN);
}
+ /* Send some output to a given user. Sends the output to all connected
+ * users if the given user is either "me" or NULL.
+ */
void
! send_users(user, buf, len)
! yuser *user;
ychar *buf;
register int len;
{
***************
*** 971,981 ****
if(*b == V3_OOB)
*(o++) = V3_OOB;
}
! for(u = connect_list; u; u = u->next)
! if(u->remote.vmajor > 2)
! (void)write(u->fd, o_buf, o - o_buf);
! else
! (void)write(u->fd, buf, b - buf);
}
/* Display user input. Emulate ANSI.
--- 974,996 ----
if(*b == V3_OOB)
*(o++) = V3_OOB;
}
!
! if(user && user != me)
! {
! if(user->fd > 0) /* just to be sure... */
! {
! if(user->remote.vmajor > 2)
! (void)write(user->fd, o_buf, o - o_buf);
! else
! (void)write(user->fd, buf, b - buf);
! }
! }
! else
! for(u = connect_list; u; u = u->next)
! if(u->remote.vmajor > 2)
! (void)write(u->fd, o_buf, o - o_buf);
! else
! (void)write(u->fd, buf, b - buf);
}
/* Display user input. Emulate ANSI.
***************
*** 1136,1149 ****
{
if(*buf >= ' ' && *buf <= '~')
{
! if((user->flags & FL_WRAP) && user->x + 1 >= user->cols)
{
! if(*buf == ' ')
! newline_term(user);
else
{
- word_wrap(user);
addch_term(user, *buf);
}
}
else
--- 1151,1174 ----
{
if(*buf >= ' ' && *buf <= '~')
{
! if(user->x + 1 >= user->cols)
{
! if(user->flags & FL_WRAP)
! {
! if(*buf == ' ')
! newline_term(user);
! else if(word_wrap(user) >= 0)
! addch_term(user, *buf);
! else
! {
! addch_term(user, *buf);
! newline_term(user);
! }
! }
else
{
addch_term(user, *buf);
+ newline_term(user);
}
}
else
***************
*** 1199,1205 ****
/* Process keyboard input.
*/
void
! my_input(buf, len)
register ychar *buf;
int len;
{
--- 1224,1231 ----
/* Process keyboard input.
*/
void
! my_input(user, buf, len)
! yuser *user;
register ychar *buf;
int len;
{
***************
*** 1246,1268 ****
{
/* do normal input */
! c = buf;
! for(; len > 0; buf++, len--)
{
! if(*buf == me->old_rub)
! *buf = me->RUB;
! else if(*buf == '\r')
! *buf = '\n';
! else if(*buf == 3) /* Ctrl-C */
! bail(0);
! else if(*buf == 27) /* Esc */
! break;
}
- if((i = buf - c) > 0)
- {
- show_input(me, c, i);
- send_users(c, i);
- }
}
/* start a menu if necessary */
--- 1272,1314 ----
{
/* do normal input */
! while(len > 0)
{
! c = buf;
! for(; len > 0; buf++, len--)
! {
! if(*buf == me->old_rub)
! *buf = me->RUB;
! else if(*buf == '\r')
! *buf = '\n';
! else if(*buf == 3) /* Ctrl-C */
! bail(0);
! else if(*buf == 27) /* Esc */
! break;
! else if(*buf == 12 || *buf == 18) /* ^L or ^R */
! break;
! }
! if((i = buf - c) > 0)
! {
! if(user != NULL && user != me && !(def_flags & FL_ASIDE))
! putc(7, stderr);
! else
! {
! show_input(me, c, i);
! send_users(user, c, i);
! }
! }
! if(len > 0) /* we broke for a special char */
! {
! if(*buf == 27) /* ESC */
! break;
! if(*buf == 12 || *buf == 18) /* ^L or ^R */
! {
! redraw_all_terms();
! buf++, len--;
! }
! }
}
}
/* start a menu if necessary */
***************
*** 1269,1276 ****
if(len > 0)
{
! buf++;
! len--;
show_main_menu();
if(len <= 0)
update_menu();
--- 1315,1321 ----
if(len > 0)
{
! buf++, len--;
show_main_menu();
if(len <= 0)
update_menu();
***************
*** 1280,1286 ****
void
lock_flags(flags)
! u_long flags;
{
register yuser *u;
--- 1325,1331 ----
void
lock_flags(flags)
! ylong flags;
{
register yuser *u;
*** 3.0.0/fd.c Mon Aug 23 14:05:04 1993
--- fd.c Tue Aug 24 11:12:15 1993
***************
*** 103,127 ****
/* -- MAIN LOOPS -- */
! static long lastping, curtime;
void
main_loop()
{
register int fd, rc;
- int mask, old_mask;
struct timeval tv;
/* Some signals need to be blocked while doing internal
* processing, else some craziness might occur.
*/
mask = 0;
! #ifdef SIGWINCH
mask |= sigmask(SIGWINCH);
#endif
/* For housecleaning to occur every CLEAN_INTERVAL seconds, we make
* our own little timer system. SIGALRM is nice; in fact it's so
* useful that we'll be using it in other parts of YTalk. Since
--- 103,139 ----
/* -- MAIN LOOPS -- */
! static ylong lastping, curtime;
void
main_loop()
{
register int fd, rc;
struct timeval tv;
+ #ifndef Y_USE_SIGHOLD
+ int mask, old_mask;
+ #endif
/* Some signals need to be blocked while doing internal
* processing, else some craziness might occur.
*/
+ #ifndef Y_USE_SIGHOLD
+
mask = 0;
! # ifdef SIGWINCH
mask |= sigmask(SIGWINCH);
+ # endif
+
#endif
+ #if defined(SIGCHLD)
+ signal(SIGCHLD, SIG_IGN);
+ #elif defined(SIGCLD)
+ signal(SIGCLD, SIG_IGN);
+ #endif
+
/* For housecleaning to occur every CLEAN_INTERVAL seconds, we make
* our own little timer system. SIGALRM is nice; in fact it's so
* useful that we'll be using it in other parts of YTalk. Since
***************
*** 129,135 ****
*/
house_clean();
! curtime = lastping = time(NULL);
for(;;)
{
/* check if we're done */
--- 141,147 ----
*/
house_clean();
! curtime = lastping = (ylong)time(NULL);
for(;;)
{
/* check if we're done */
***************
*** 154,160 ****
--- 166,178 ----
/* block signals while doing internal processing */
+ #ifdef Y_USE_SIGHOLD
+ # ifdef SIGWINCH
+ sighold(SIGWINCH);
+ # endif
+ #else
old_mask = sigblock(mask);
+ #endif
/* process file descriptors with input waiting */
***************
*** 170,185 ****
/* check timer */
! curtime = time(NULL);
if(curtime - lastping >= CLEAN_INTERVAL)
{
house_clean();
! lastping = time(NULL);
}
/* re-allow signals */
sigsetmask(old_mask);
if(user_winch)
{
/* This is a cute hack that updates a user menu
--- 188,209 ----
/* check timer */
! curtime = (ylong)time(NULL);
if(curtime - lastping >= CLEAN_INTERVAL)
{
house_clean();
! lastping = (ylong)time(NULL);
}
/* re-allow signals */
+ #ifdef Y_USE_SIGHOLD
+ # ifdef SIGWINCH
+ sigrelse(SIGWINCH);
+ # endif
+ #else
sigsetmask(old_mask);
+ #endif
if(user_winch)
{
/* This is a cute hack that updates a user menu
***************
*** 248,259 ****
/* check timer */
! curtime = time(NULL);
if(curtime - lastping >= CLEAN_INTERVAL)
{
input_flag = 1;
house_clean();
! lastping = time(NULL);
}
}
input_flag = 0;
--- 272,283 ----
/* check timer */
! curtime = (ylong)time(NULL);
if(curtime - lastping >= CLEAN_INTERVAL)
{
input_flag = 1;
house_clean();
! lastping = (ylong)time(NULL);
}
}
input_flag = 0;
*** 3.0.0/menu.c Mon Aug 23 14:05:04 1993
--- menu.c Mon Aug 23 11:31:43 1993
***************
*** 175,185 ****
ychar key;
{
register yuser *u;
! u_long old_flags;
old_flags = def_flags;
switch(key)
{
case 's': /* toggle scrolling */
def_flags ^= FL_SCROLL;
break;
--- 175,188 ----
ychar key;
{
register yuser *u;
! ylong old_flags;
old_flags = def_flags;
switch(key)
{
+ case 'a': /* toggle asides */
+ def_flags ^= FL_ASIDE;
+ break;
case 's': /* toggle scrolling */
def_flags ^= FL_SCROLL;
break;
***************
*** 713,718 ****
--- 716,732 ----
option_menu[i].func = option_menu_sel;
option_menu[i].key = 'r';
i++;
+
+ if(term_does_asides())
+ {
+ if(def_flags & FL_ASIDE)
+ option_menu[i].item = "turn asides off";
+ else
+ option_menu[i].item = "turn asides on";
+ option_menu[i].func = option_menu_sel;
+ option_menu[i].key = 'a';
+ i++;
+ }
return show_menu(option_menu, i);
}
*** 3.0.0/exec.c Mon Aug 23 14:05:04 1993
--- exec.c Tue Aug 24 14:40:49 1993
***************
*** 102,108 ****
return;
}
show_input(me, buf, rc);
! send_users(buf, rc);
}
static void
--- 102,108 ----
return;
}
show_input(me, buf, rc);
! send_users(me, buf, rc);
}
static void
***************
*** 147,157 ****
msg_term(me, "cannot get pseudo terminal");
return;
}
! if((shell = getenv("SHELL")) == NULL)
shell = "/bin/sh";
calculate_size(&prows, &pcols);
if((pid = fork()) == 0)
{
close_all();
if(setsid() < 0)
exit(-1);
--- 147,158 ----
msg_term(me, "cannot get pseudo terminal");
return;
}
! if((shell = (char *)getenv("SHELL")) == NULL)
shell = "/bin/sh";
calculate_size(&prows, &pcols);
if((pid = fork()) == 0)
{
+ close(fd);
close_all();
if(setsid() < 0)
exit(-1);
***************
*** 161,166 ****
--- 162,173 ----
dup2(fd, 1);
dup2(fd, 2);
+ /* tricky bit -- ignore WINCH */
+
+ #ifdef SIGWINCH
+ signal(SIGWINCH, SIG_IGN);
+ #endif
+
/* set terminal characteristics */
set_terminal_flags(fd);
***************
*** 188,193 ****
--- 195,201 ----
pfd = fd;
running_process = 1;
lock_flags(FL_RAW | FL_SCROLL);
+ set_raw_term();
add_fd(fd, exec_input);
}
***************
*** 211,216 ****
--- 219,225 ----
close(pfd);
running_process = 0;
unlock_flags();
+ set_cooked_term();
end_win_region(me);
}
***************
*** 223,231 ****
--- 232,250 ----
if(!running_process)
return;
+
+ /* if the winch has no effect, return now */
+
calculate_size(&rows, &cols);
if(rows == prows && cols == pcols)
+ {
+ if(prows != me->rows || pcols != me->cols)
+ set_win_region(me, prows, pcols);
return;
+ }
+
+ /* oh well -- redo everything */
+
prows = rows;
pcols = cols;
set_terminal_size(pfd, prows, pcols);
*** 3.0.0/rc.c Mon Aug 23 14:05:05 1993
--- rc.c Tue Aug 24 14:41:04 1993
***************
*** 46,52 ****
set_option(opt, value)
char *opt, *value;
{
! u_long mask = 0L;
int set_it;
if(strcmp(value, "true") == 0 || strcmp(value, "on") == 0)
--- 46,52 ----
set_option(opt, value)
char *opt, *value;
{
! ylong mask = 0;
int set_it;
if(strcmp(value, "true") == 0 || strcmp(value, "on") == 0)
***************
*** 81,87 ****
|| strcmp(opt, "autoinvite") == 0
|| strcmp(opt, "aiv") == 0
|| strcmp(opt, "av") == 0)
! mask |= FL_IMPORT;
if(strcmp(opt, "ring") == 0
|| strcmp(opt, "auto-ring") == 0
--- 81,87 ----
|| strcmp(opt, "autoinvite") == 0
|| strcmp(opt, "aiv") == 0
|| strcmp(opt, "av") == 0)
! mask |= FL_INVITE;
if(strcmp(opt, "ring") == 0
|| strcmp(opt, "auto-ring") == 0
***************
*** 98,103 ****
--- 98,108 ----
|| strcmp(opt, "x") == 0
|| strcmp(opt, "X") == 0)
mask |= FL_XWIN;
+
+ if(strcmp(opt, "asides") == 0
+ || strcmp(opt, "aside") == 0
+ || strcmp(opt, "as") == 0)
+ mask |= FL_ASIDE;
if(!mask)
return -1;
***************
*** 110,137 ****
return 0;
}
! /* ---- global functions ---- */
!
! void
! read_ytalkrc()
{
FILE *fp;
char *buf, *ptr;
char *w, *arg1, *arg2, *arg3;
int line_no, errline;
- yuser *u;
! if((w = getenv("HOME")) == NULL)
! return;
! buf = get_mem(BUFSIZ);
! sprintf(buf, "%s/.ytalkrc", w);
! if((fp = fopen(buf, "r")) == NULL)
{
if(errno != ENOENT)
! show_error(buf);
! free(buf);
return;
}
line_no = errline = 0;
while(fgets(buf, BUFSIZ, fp) != NULL)
--- 115,136 ----
return 0;
}
! static void
! read_rcfile(fname)
! char *fname;
{
FILE *fp;
char *buf, *ptr;
char *w, *arg1, *arg2, *arg3;
int line_no, errline;
! if((fp = fopen(fname, "r")) == NULL)
{
if(errno != ENOENT)
! show_error(fname);
return;
}
+ buf = get_mem(BUFSIZ);
line_no = errline = 0;
while(fgets(buf, BUFSIZ, fp) != NULL)
***************
*** 177,183 ****
}
if(errline)
{
! sprintf(errstr, ".ytalkrc: syntax error at line %d", errline);
errno = 0;
show_error(errstr);
}
--- 176,182 ----
}
if(errline)
{
! sprintf(errstr, "%s: syntax error at line %d", fname, errline);
errno = 0;
show_error(errstr);
}
***************
*** 184,189 ****
--- 183,214 ----
free(buf);
fclose(fp);
+ }
+
+ /* ---- global functions ---- */
+
+ void
+ read_ytalkrc()
+ {
+ char *w;
+ yuser *u;
+ char fname[256];
+
+ /* read the system ytalkrc file */
+
+ #ifdef SYSTEM_YTALKRC
+ read_rcfile(SYSTEM_YTALKRC);
+ #endif
+
+ /* read the user's ytalkrc file */
+
+ if((w = (char *)getenv("HOME")) != NULL)
+ {
+ sprintf(fname, "%s/.ytalkrc", w);
+ read_rcfile(fname);
+ }
+
+ /* set all default flags */
for(u = user_list; u != NULL; u = u->unext)
if(!(u->flags & FL_LOCKED))
*** 3.0.0/socket.c Mon Aug 23 14:05:05 1993
--- socket.c Sun Aug 22 21:03:21 1993
***************
*** 35,42 ****
static int autofd = -1; /* auto invite socket fd */
static struct sockaddr_in autosock; /* auto invite socket */
! static long autoid[MAXDAEMON+1]; /* auto invite seq numbers */
! static u_long announce_id = 0; /* announce sequence id */
static readdr *readdr_list = NULL; /* list of re-addresses */
#define IN_ADDR(s) ((s).sin_addr.s_addr)
--- 35,42 ----
static int autofd = -1; /* auto invite socket fd */
static struct sockaddr_in autosock; /* auto invite socket */
! static ylong autoid[MAXDAEMON+1]; /* auto invite seq numbers */
! static ylong announce_id = 0; /* announce sequence id */
static readdr *readdr_list = NULL; /* list of re-addresses */
#define IN_ADDR(s) ((s).sin_addr.s_addr)
***************
*** 188,194 ****
show_error("init_autoport: listen() failed");
return;
}
! (void)memset(autoid, 0, (MAXDAEMON + 1) * sizeof(long));
add_fd(autofd, read_autoport);
}
--- 188,194 ----
show_error("init_autoport: listen() failed");
return;
}
! (void)memset(autoid, 0, (MAXDAEMON + 1) * sizeof(ylong));
add_fd(autofd, read_autoport);
}
***************
*** 198,204 ****
static void
place_my_address(sock, addr)
struct sockaddr_in *sock;
! register u_long addr;
{
register readdr *r;
--- 198,204 ----
static void
place_my_address(sock, addr)
struct sockaddr_in *sock;
! register ylong addr;
{
register readdr *r;
***************
*** 220,226 ****
*/
static int
sendit(addr, d)
! u_long addr; /* host internet address */
int d; /* daemon number */
{
int n;
--- 220,226 ----
*/
static int
sendit(addr, d)
! ylong addr; /* host internet address */
int d; /* daemon number */
{
int n;
***************
*** 379,385 ****
*/
static int
find_daemon(addr)
! u_long addr;
{
register hostinfo *h;
register int n, i, d;
--- 379,385 ----
*/
static int
find_daemon(addr)
! ylong addr;
{
register hostinfo *h;
register int n, i, d;
***************
*** 468,486 ****
return 0;
}
! static u_long
make_net_mask(addr)
! u_long addr;
{
! if(addr & (u_long)0xff)
! return (u_long)0xffffffff;
! if(addr & (u_long)0xffff)
! return (u_long)0xffffff00;
! if(addr & (u_long)0xffffff)
! return (u_long)0xffff0000;
if(addr)
! return (u_long)0xff000000;
! return (u_long)0;
}
/* ---- global functions ---- */
--- 468,486 ----
return 0;
}
! static ylong
make_net_mask(addr)
! ylong addr;
{
! if(addr & (ylong)0xff)
! return (ylong)0xffffffff;
! if(addr & (ylong)0xffff)
! return (ylong)0xffffff00;
! if(addr & (ylong)0xffffff)
! return (ylong)0xffff0000;
if(addr)
! return (ylong)0xff000000;
! return (ylong)0;
}
/* ---- global functions ---- */
***************
*** 540,546 ****
yuser *user;
u_char type;
{
! u_long addr;
int d;
/* set up the message type and where to send it */
--- 540,546 ----
yuser *user;
u_char type;
{
! ylong addr;
int d;
/* set up the message type and where to send it */
***************
*** 822,834 ****
/* Find a host's address.
*/
! u_long
get_host_addr(hostname)
char *hostname;
{
struct hostent *host;
! u_long addr;
! u_long inet_addr();
if((host = (struct hostent *) gethostbyname(hostname)) != NULL)
{
--- 822,834 ----
/* Find a host's address.
*/
! ylong
get_host_addr(hostname)
char *hostname;
{
struct hostent *host;
! ylong addr;
! ylong inet_addr();
if((host = (struct hostent *) gethostbyname(hostname)) != NULL)
{
***************
*** 836,847 ****
{
sprintf(errstr, "Bad IN addr: %s\n", hostname);
show_error(errstr);
! return (u_long)-1;
}
(void)memcpy(&addr, host->h_addr, sizeof(addr));
}
! else if((addr = inet_addr(hostname)) == (u_long)-1)
! return (u_long)-1;
return addr;
}
--- 836,847 ----
{
sprintf(errstr, "Bad IN addr: %s\n", hostname);
show_error(errstr);
! return (ylong)-1;
}
(void)memcpy(&addr, host->h_addr, sizeof(addr));
}
! else if((addr = (ylong)inet_addr(hostname)) == (ylong)-1)
! return (ylong)-1;
return addr;
}
***************
*** 849,855 ****
*/
char *
host_name(addr)
! u_long addr;
{
struct hostent *host;
char *inet_ntoa();
--- 849,855 ----
*/
char *
host_name(addr)
! ylong addr;
{
struct hostent *host;
char *inet_ntoa();
***************
*** 873,894 ****
char *from_id, *to_id, *on_id;
{
register readdr *new;
! u_long from_addr, to_addr, on_addr;
! u_long from_mask, to_mask, on_mask;
! if((from_addr = get_host_addr(from_id)) == (u_long)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", from_id);
show_error(errstr);
return;
}
! if((to_addr = get_host_addr(to_id)) == (u_long)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", to_id);
show_error(errstr);
return;
}
! if((on_addr = get_host_addr(on_id)) == (u_long)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", on_id);
show_error(errstr);
--- 873,894 ----
char *from_id, *to_id, *on_id;
{
register readdr *new;
! ylong from_addr, to_addr, on_addr;
! ylong from_mask, to_mask, on_mask;
! if((from_addr = get_host_addr(from_id)) == (ylong)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", from_id);
show_error(errstr);
return;
}
! if((to_addr = get_host_addr(to_id)) == (ylong)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", to_id);
show_error(errstr);
return;
}
! if((on_addr = get_host_addr(on_id)) == (ylong)-1)
{
sprintf(errstr, "Unknown host: '%s'\n", on_id);
show_error(errstr);
*** 3.0.0/user.c Mon Aug 23 14:05:05 1993
--- user.c Tue Aug 24 15:44:59 1993
***************
*** 27,34 ****
yuser *wait_list; /* list of connected users */
yuser *fd_to_user[MAX_FILES]; /* convert file descriptors to users */
yuser *key_to_user[128]; /* convert menu ident chars to users */
! u_long def_flags = 0L; /* default FL_* flags */
! static u_long daemon_id; /* running daemon ID counter */
/* ---- local functions ----- */
--- 27,34 ----
yuser *wait_list; /* list of connected users */
yuser *fd_to_user[MAX_FILES]; /* convert file descriptors to users */
yuser *key_to_user[128]; /* convert menu ident chars to users */
! ylong def_flags = 0L; /* default FL_* flags */
! static ylong daemon_id; /* running daemon ID counter */
/* ---- local functions ----- */
***************
*** 41,47 ****
register struct passwd *pw;
passwd_opened = 1;
if((pw = getpwnam(name)) == NULL)
! return -1;
return pw->pw_uid;
}
--- 41,47 ----
register struct passwd *pw;
passwd_opened = 1;
if((pw = getpwnam(name)) == NULL)
! return -60000; /* for most archs, an impossible user ID */
return pw->pw_uid;
}
***************
*** 59,69 ****
static void
close_passwd()
{
- extern void endpwent();
-
if(passwd_opened)
{
! endpwent();
passwd_opened = 0;
}
}
--- 59,67 ----
static void
close_passwd()
{
if(passwd_opened)
{
! (void)endpwent();
passwd_opened = 0;
}
}
***************
*** 147,157 ****
/* get my username */
if((my_name = getlogin()) != NULL)
! if(my_uid < 0 || user_id(my_name) != my_uid)
my_name = NULL;
if(my_name == NULL)
! my_name = user_name(getuid());
if(my_name == NULL)
{
show_error("Who are you?");
bail(YTE_ERROR);
--- 145,157 ----
/* get my username */
if((my_name = getlogin()) != NULL)
! if(user_id(my_name) != my_uid)
my_name = NULL;
if(my_name == NULL)
! my_name = user_name(my_uid);
if(my_name == NULL)
+ my_name = getlogin();
+ if(my_name == NULL || my_name[0] == '\0')
{
show_error("Who are you?");
bail(YTE_ERROR);
***************
*** 184,190 ****
char *name, *hostname, *tty;
{
register yuser *out, *u;
! u_long addr;
/* find the host address */
--- 184,190 ----
char *name, *hostname, *tty;
{
register yuser *out, *u;
! ylong addr;
/* find the host address */
***************
*** 193,199 ****
hostname = me->host_name;
addr = me->host_addr;
}
! else if((addr = get_host_addr(hostname)) == (u_long)-1)
{
sprintf(errstr, "new_user: bad host: '%s'\n", hostname);
show_error(errstr);
--- 193,199 ----
hostname = me->host_name;
addr = me->host_addr;
}
! else if((addr = get_host_addr(hostname)) == (ylong)-1)
{
sprintf(errstr, "new_user: bad host: '%s'\n", hostname);
show_error(errstr);
***************
*** 298,324 ****
}
/* Find a user by name/host/pid. If name is NULL, then it is not checked.
! * If host_addr is (u_long)-1 then it is not checked. If pid is (u_long)-1
* then it is not checked.
*/
yuser *
find_user(name, host_addr, pid)
char *name;
! u_long host_addr, pid;
{
register yuser *u;
for(u = user_list; u; u = u->unext)
if(name == NULL || strcmp(u->user_name, name) == 0)
! if(host_addr == (u_long)-1 || u->host_addr == host_addr)
! if(pid == (u_long)-1 || u->remote.pid == pid)
return u;
/* it could be _me_! */
if(name == NULL || strcmp(me->user_name, name) == 0)
! if(host_addr == (u_long)-1 || me->host_addr == host_addr)
! if(pid == (u_long)-1 || me->remote.pid == pid)
return me;
/* nobody I know */
--- 298,324 ----
}
/* Find a user by name/host/pid. If name is NULL, then it is not checked.
! * If host_addr is (ylong)-1 then it is not checked. If pid is (ylong)-1
* then it is not checked.
*/
yuser *
find_user(name, host_addr, pid)
char *name;
! ylong host_addr, pid;
{
register yuser *u;
for(u = user_list; u; u = u->unext)
if(name == NULL || strcmp(u->user_name, name) == 0)
! if(host_addr == (ylong)-1 || u->host_addr == host_addr)
! if(pid == (ylong)-1 || u->remote.pid == pid)
return u;
/* it could be _me_! */
if(name == NULL || strcmp(me->user_name, name) == 0)
! if(host_addr == (ylong)-1 || me->host_addr == host_addr)
! if(pid == (ylong)-1 || me->remote.pid == pid)
return me;
/* nobody I know */
*** 3.0.0/term.c Mon Aug 23 14:05:05 1993
--- term.c Tue Aug 24 11:00:02 1993
***************
*** 26,32 ****
#else
# include <termios.h>
#endif
! #include "curses.h"
#include "xwin.h"
#include "menu.h"
--- 26,32 ----
#else
# include <termios.h>
#endif
! #include "cwin.h"
#include "xwin.h"
#include "menu.h"
***************
*** 170,176 ****
/* set me up a terminal */
! sprintf(tmpstr, "YTalk version %d.%d", VMAJOR, VMINOR);
if(open_term(me, tmpstr) < 0)
{
end_term();
--- 170,176 ----
/* set me up a terminal */
! sprintf(tmpstr, "YTalk version %d.%d (%d)", VMAJOR, VMINOR, VPATCH);
if(open_term(me, tmpstr) < 0)
{
end_term();
***************
*** 386,391 ****
--- 386,392 ----
{
register int i;
register ychar *c;
+ int sy, sx;
if(user->sc_bot > user->sc_top)
{
***************
*** 406,413 ****
--- 407,417 ----
}
else
{
+ sy = user->y;
+ sx = user->x;
move_term(user, user->sc_top, 0);
clreol_term(user);
+ move_term(user, sy, sx);
}
}
***************
*** 419,424 ****
--- 423,429 ----
{
register int i;
register ychar *c;
+ int sy, sx;
if(user->sc_bot > user->sc_top)
{
***************
*** 439,446 ****
--- 444,454 ----
}
else
{
+ sy = user->y;
+ sx = user->x;
move_term(user, user->sc_top, 0);
clreol_term(user);
+ move_term(user, sy, sx);
}
}
***************
*** 1022,1027 ****
--- 1030,1037 ----
old_width = user->cols;
user->rows = user->t_rows;
user->cols = user->t_cols;
+ user->sc_top = 0;
+ user->sc_bot = user->rows - 1;
if(old_height < user->t_rows || old_width < user->t_cols)
draw_box(user, old_height, old_width, ' ');
user->region_set = 0;
***************
*** 1166,1169 ****
--- 1176,1239 ----
if(n >= width)
return 0;
return (width - n) >> 1;
+ }
+
+ void
+ redraw_all_terms()
+ {
+ register yuser *u;
+
+ switch(term_type)
+ {
+ case 1: /* curses */
+ redisplay_curses();
+ break;
+ default:
+ redraw_term(me, 0);
+ flush_term(me);
+ for(u = connect_list; u; u = u->next)
+ {
+ redraw_term(u, 0);
+ flush_term(u);
+ }
+ }
+ }
+
+ void
+ set_raw_term()
+ {
+ /* only some terminal systems need to do this */
+
+ switch(term_type)
+ {
+ case 1: /* curses */
+ set_raw_curses();
+ break;
+ }
+ }
+
+ void
+ set_cooked_term()
+ {
+ /* only some terminal systems need to do this */
+
+ switch(term_type)
+ {
+ case 1: /* curses */
+ set_cooked_curses();
+ break;
+ }
+ }
+
+ int
+ term_does_asides()
+ {
+ /* only some terminal systems can do this */
+
+ switch(term_type)
+ {
+ case 2: /* X11 */
+ return 1;
+ }
+ return 0;
}
*** 3.0.0/cwin.c Mon Aug 23 14:05:06 1993
--- cwin.c Tue Aug 24 11:31:34 1993
***************
*** 1,4 ****
! /* curses.c -- curses interface */
/* NOTICE
*
--- 1,4 ----
! /* cwin.c -- curses interface */
/* NOTICE
*
***************
*** 19,25 ****
#include "header.h"
#include <curses.h>
#include <sys/signal.h>
! #include "curses.h"
typedef struct _ywin {
struct _ywin *next; /* next ywin in linked list */
--- 19,25 ----
#include "header.h"
#include <curses.h>
#include <sys/signal.h>
! #include "cwin.h"
typedef struct _ywin {
struct _ywin *next; /* next ywin in linked list */
***************
*** 49,55 ****
bail(YTE_SUCCESS);
bail(YTE_ERROR);
}
! my_input(buf, rc);
}
static ywin *
--- 49,55 ----
bail(YTE_SUCCESS);
bail(YTE_ERROR);
}
! my_input(me, buf, rc);
}
static ywin *
***************
*** 188,194 ****
{
LINES = COLS = 0; /* so resizes will work */
initscr();
! raw();
crmode();
noecho();
clear();
--- 188,194 ----
{
LINES = COLS = 0; /* so resizes will work */
initscr();
! noraw();
crmode();
noecho();
clear();
***************
*** 382,387 ****
--- 382,394 ----
scrollok(w->win, TRUE);
scroll(w->win);
scrollok(w->win, FALSE);
+
+ /* Some curses won't leave the cursor in the same place, and some
+ * curses programs won't erase the bottom line properly.
+ */
+ wmove(w->win, user->t_rows - 1, 0);
+ wclrtoeol(w->win);
+ wmove(w->win, user->y, user->x);
}
void
***************
*** 392,395 ****
--- 399,436 ----
w = (ywin *)(user->term);
wrefresh(w->win);
+ }
+
+ /* Clear and redisplay.
+ */
+ void
+ redisplay_curses()
+ {
+ register ywin *w;
+
+ clear();
+ refresh();
+ for(w = head; w; w = w->next)
+ {
+ redraw_term(w->user, 0);
+ draw_title(w);
+ refresh();
+ wrefresh(w->win);
+ }
+ }
+
+ /* Set raw mode.
+ */
+ void
+ set_raw_curses()
+ {
+ raw();
+ }
+
+ /* Set cooked mode.
+ */
+ void
+ set_cooked_curses()
+ {
+ noraw();
}
*** 3.0.0/xwin.c Mon Aug 23 14:05:06 1993
--- xwin.c Tue Aug 24 14:47:49 1993
***************
*** 30,36 ****
static XFontStruct *text_font; /* font */
static GC textGC, /* text graphic context */
invertGC; /* graphic context for inverts */
! static u_long whitepix, /* white pixel */
blackpix; /* black pixel */
static int font_width, /* font width */
font_height, /* font height */
--- 30,36 ----
static XFontStruct *text_font; /* font */
static GC textGC, /* text graphic context */
invertGC; /* graphic context for inverts */
! static ylong whitepix, /* white pixel */
blackpix; /* black pixel */
static int font_width, /* font width */
font_height, /* font height */
***************
*** 88,97 ****
make_GC(gc, font, fgpixel, bgpixel, l_width, l_style, l_cap, l_join, gcfunc)
GC *gc;
XFontStruct *font;
! u_long fgpixel, bgpixel;
int l_width, l_style, l_cap, l_join, gcfunc;
{
! u_long mask = 0;
XGCValues values;
if(font != NULL)
--- 88,97 ----
make_GC(gc, font, fgpixel, bgpixel, l_width, l_style, l_cap, l_join, gcfunc)
GC *gc;
XFontStruct *font;
! ylong fgpixel, bgpixel;
int l_width, l_style, l_cap, l_join, gcfunc;
{
! ylong mask = 0;
XGCValues values;
if(font != NULL)
***************
*** 160,167 ****
}
break;
case KeyPress:
! n = XLookupString(&report, buf, 512, NULL, NULL);
! my_input(buf, n);
break;
}
}
--- 160,167 ----
}
break;
case KeyPress:
! n = XLookupString((XKeyEvent *) &report, buf, 512, NULL, NULL);
! my_input(win_user(report.xkeymap.window), buf, n);
break;
}
}
***************
*** 184,190 ****
void
init_xwin()
{
! extern char *getenv();
char *displayName;
char *rfn, str[256];
int xfd;
--- 184,190 ----
void
init_xwin()
{
! char *xrmstr;
char *displayName;
char *rfn, str[256];
int xfd;
***************
*** 203,218 ****
/* read all options */
! db = XrmGetStringDatabase(XResourceManagerString(display));
! if((rfn = getenv("HOME")) != NULL)
{
sprintf(str, "%s/.Xdefaults", rfn);
if(access(str, 0) == 0)
! XrmMergeDatabases(XrmGetFileDatabase(str), &db);
}
! if((rfn = getenv("XENVIRONMENT")) != NULL)
! if(access(rfn, 0) == 0)
! XrmMergeDatabases(XrmGetFileDatabase(rfn), &db);
if(getOption("YTalk.reverse"))
{
whitepix = BlackPixel(display, screen_num);
--- 203,223 ----
/* read all options */
! db = NULL;
! XrmInitialize();
! if((xrmstr = XResourceManagerString(display)) != NULL)
! db = XrmGetStringDatabase(xrmstr);
! else if((rfn = (char *)getenv("XENVIRONMENT")) != NULL
! && access(rfn, 0) == 0)
! db = XrmGetFileDatabase(rfn);
! else if((rfn = (char *)getenv("HOME")) != NULL)
{
sprintf(str, "%s/.Xdefaults", rfn);
if(access(str, 0) == 0)
! db = XrmGetFileDatabase(str);
}
! if(db == NULL)
! db = XrmGetStringDatabase("");
if(getOption("YTalk.reverse"))
{
whitepix = BlackPixel(display, screen_num);
***************
*** 279,285 ****
if(getOption("YTalk.geometry"))
{
XParseGeometry(getOption("YTalk.geometry"),
! &size.x, &size.y, &size.width, &size.height);
/* don't set USPosition -- it confuses tvtwm */
}
--- 284,290 ----
if(getOption("YTalk.geometry"))
{
XParseGeometry(getOption("YTalk.geometry"),
! &size.x, &size.y, (u_int *)&size.width, (u_int *)&size.height);
/* don't set USPosition -- it confuses tvtwm */
}