v08i045: Unix support improvements for MicroEMACS 3.10

Brandon S. Allbery - comp.sources.misc allbery at uunet.UU.NET
Sun Sep 24 07:01:09 AEST 1989


Posting-number: Volume 8, Issue 45
Submitted-by: djm at wam.UMD.EDU (David J. MacKenzie)
Archive-name: ue310usp

[These are, of course, not official patches.  ++bsa]

Below I have integrated patches posted by several people to comp.emacs
which fix some bugs and make significant enhancements to MicroEMACS
3.10 when running under Unix.  Since comp.emacs is not normally
archived (to my knowledge) many people probably missed them, and the
changes made by some of the patches overlap, so I thought it would be a
good idea to merge them all together in one place and post them here.

David J. MacKenzie <djm at wam.umd.edu>


#! /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 <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  README patches optional
# Wrapped by dave at zedfdc on Tue Sep 19 12:10:13 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1974 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThe patches in the file `patches' are a merger of the work of the
Xpeople listed below; they are diffs to the virgin MicroEMACS 3.10
Xdistribution that improve its Unix support.  All of the patches except
Xmy Del key fixes were posted to comp.emacs; I have adapted some of them.
X
XThe file `optional' contains some additional patches that change the
Xfunction key support.  I didn't merge it in with the others because
Xit uses a nonportable timing loop and caused unreliable keyboard
Xresponse on my system, and I don't really care about using the function
Xkeys anyway.
X
X  --David MacKenzie
X
X
XMichael Arena <insyte!m2 at harvard.harvard.edu>
X	unix.c, input.c: Made filename completion much more efficient.
X
XLinwood Varney <linwood at b11.ingr.com>
X	display.c: If VARARGS is defined, use <varargs.h>, to support systems
X		that pass arguments in registers. 
X	ebind.h, efunc.h: Made job control conditional on JOBCTRL instead
X		of BSD, to support non-BSD systems with job control.
X	unix.c: Made job control conditional on JOBCTRL.
X		Fixed problem with "[End]" message.
X		Fixed filename completion in current directory.
X	input.c: Added ~ (home directory) and environment variable
X		expansion at the beginnings of filenames for ^X^F find-file,
X		et al.
X	edef.h: Changed default value for $ssave to FALSE because it
X		loses Unix files' permissions and ownership.
X	estruct.h: Added JOBCTRL and VARARGS defines.
X
XJohn Rupley <rupley at arizona.edu>
X	unix.c: Fixed bug in USG typeahead code (replaced a k with the
X		high bit set with &k).
X
XHoward Weiss <hsw at tycho.ncsc.mil>
X	tcap.c: Fixed SUN support.
X
XDavid MacKenzie <djm at wam.umd.edu>
X	bind.c: Allow ^? to be used for binding the Del key and in
X		displaying the key bindings.
X	estruct.h: Added DIRENT define.
X	unix.c: Use POSIX <dirent.h> if DIRENT is defined.
X		Fix signal handling for subshell spawning.
X		Implement ^X$ execute-program (run a program without
X		starting up a shell) for real (previously it was the
X		same as ^X! shell-command).
END_OF_FILE
if test 1974 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'patches' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches'\"
else
echo shar: Extracting \"'patches'\" \(25167 characters\)
sed "s/^X//" >'patches' <<'END_OF_FILE'
X*** bind.c.orig	Sat Sep 16 22:32:05 1989
X--- bind.c	Sun Sep 17 01:53:53 1989
X***************
X*** 785,790 ****
X--- 785,795 ----
X  		*ptr++ = '^';
X  	}
X  
X+ 	if ((c & 255) == 0x7F) {
X+ 		*ptr++ = '^';
X+ 		c = '?';
X+ 	}
X+ 
X  	c = c & 255;	/* strip the prefixes */
X  
X  	/* and output the final sequence */
X***************
X*** 910,916 ****
X  
X  	Meta and ^X prefix of lower case letters are converted to upper
X  	case.  Real control characters are automatically converted to
X! 	the ^A form.
X  */
X  
X  unsigned int PASCAL NEAR stock(keyname)
X--- 915,921 ----
X  
X  	Meta and ^X prefix of lower case letters are converted to upper
X  	case.  Real control characters are automatically converted to
X! 	the ^A form.  '^?' is converted to DEL (0x7F).
X  */
X  
X  unsigned int PASCAL NEAR stock(keyname)
X***************
X*** 963,969 ****
X  
X  	/* a control char?  (Always upper case) */
X  	if (*keyname == '^' && *(keyname+1) != 0) {
X! 		c |= CTRL;
X  		++keyname;
X  		uppercase(keyname);
X  	}
X--- 968,977 ----
X  
X  	/* a control char?  (Always upper case) */
X  	if (*keyname == '^' && *(keyname+1) != 0) {
X! 		if (keyname[1] == '?')
X! 			c |= 0x7F;
X! 		else
X! 			c |= CTRL;
X  		++keyname;
X  		uppercase(keyname);
X  	}
X***************
X*** 980,986 ****
X  		uppercase(keyname);		/* Then make sure it's upper case */
X  
X  	/* the final sequence... */
X! 	c |= *keyname;
X  	return(c);
X  }
X  
X--- 988,995 ----
X  		uppercase(keyname);		/* Then make sure it's upper case */
X  
X  	/* the final sequence... */
X! 	if ((c & 255) != 0x7f)
X! 		c |= *keyname;
X  	return(c);
X  }
X  
X*** display.c.orig	Sat Sep 16 23:15:39 1989
X--- display.c	Sat Sep 16 23:51:59 1989
X***************
X*** 11,16 ****
X--- 11,19 ----
X  #include	"etype.h"
X  #include	"edef.h"
X  #include	"elang.h"
X+ #if VARARGS
X+ #include	<varargs.h>
X+ #endif
X  
X  typedef struct	VIDEO {
X  	int	v_flag; 		/* Flags */
X***************
X*** 1091,1096 ****
X--- 1094,1106 ----
X  #define	ADJUST(ptr, dtype)	ptr += sizeof(dtype)
X  #endif
X  
X+ #if VARARGS
X+ CDECL NEAR mlwrite(va_alist)
X+ va_dcl
X+ {
X+ 	va_list ap;
X+ 	char *fmt;
X+ #else
X  CDECL NEAR mlwrite(fmt, arg)
X  
X  char *fmt;	/* format string for output */
X***************
X*** 1097,1104 ****
X  char *arg;	/* pointer to first argument to print */
X  
X  {
X- 	register int c; 	/* current char in format string */
X  	register char *ap;	/* ptr to current data field */
X  
X  	/* if we are not currently echoing on the command line, abort this */
X  	if (discmd == FALSE)
X--- 1107,1115 ----
X  char *arg;	/* pointer to first argument to print */
X  
X  {
X  	register char *ap;	/* ptr to current data field */
X+ #endif
X+ 	register int c; 	/* current char in format string */
X  
X  	/* if we are not currently echoing on the command line, abort this */
X  	if (discmd == FALSE)
X***************
X*** 1116,1124 ****
X--- 1127,1141 ----
X  		TTflush();
X  	}
X  
X+ #if VARARGS
X+ 	va_start(ap);
X+ 	fmt = va_arg(ap, char *);
X+ #endif
X  	movecursor(term.t_nrow, 0);
X   	lastptr = &lastmesg[0];		/* setup to record message */
X+ #if !VARARGS
X  	ap = (char *) &arg;
X+ #endif
X  	while ((c = *fmt++) != 0) {
X  		if (c != '%') {
X  			mlout(c);
X***************
X*** 1127,1159 ****
X--- 1144,1200 ----
X  			c = *fmt++;
X  			switch (c) {
X  				case 'd':
X+ #if VARARGS
X+ 					mlputi(va_arg(ap, int), 10);
X+ #else
X  					mlputi(*(int *)ap, 10);
X  			                ADJUST(ap, int);
X+ #endif
X  					break;
X  
X  				case 'o':
X+ #if VARARGS
X+ 					mlputi(va_arg(ap, int), 8);
X+ #else
X  					mlputi(*(int *)ap,  8);
X  					ADJUST(ap, int);
X+ #endif
X  					break;
X  
X  				case 'x':
X+ #if VARARGS
X+ 					mlputi(va_arg(ap, int), 16);
X+ #else
X  					mlputi(*(int *)ap, 16);
X  					ADJUST(ap, int);
X+ #endif
X  					break;
X  
X  				case 'D':
X+ #if VARARGS
X+ 					mlputli(va_arg(ap, long), 10);
X+ #else
X  					mlputli(*(long *)ap, 10);
X  					ADJUST(ap, long);
X+ #endif
X  					break;
X  
X  				case 's':
X+ #if VARARGS
X+ 					mlputs(va_arg(ap, char *));
X+ #else
X  					mlputs(*(char **)ap);
X  					ADJUST(ap, char *);
X+ #endif
X  					break;
X  
X  				case 'f':
X+ #if VARARGS
X+ 					mlputf(va_arg(ap, int));
X+ #else
X  					mlputf(*(int *)ap);
X  					ADJUST(ap, int);
X+ #endif
X  					break;
X  
X  				default:
X*** ebind.h.orig	Sat Sep 16 23:37:51 1989
X--- ebind.h	Sat Sep 16 23:38:17 1989
X***************
X*** 78,84 ****
X  	{CTLX|'A',		BINDFNC,	setvar},
X  	{CTLX|'B',		BINDFNC,	usebuffer},
X  	{CTLX|'C',		BINDFNC,	spawncli},
X! #if	BSD
X  	{CTLX|'D',		BINDFNC,	bktoshell},
X  #endif
X  	{CTLX|'E',		BINDFNC,	ctlxe},
X--- 78,84 ----
X  	{CTLX|'A',		BINDFNC,	setvar},
X  	{CTLX|'B',		BINDFNC,	usebuffer},
X  	{CTLX|'C',		BINDFNC,	spawncli},
X! #if	JOBCTRL
X  	{CTLX|'D',		BINDFNC,	bktoshell},
X  #endif
X  	{CTLX|'E',		BINDFNC,	ctlxe},
X*** edef.h.orig	Thu Jun 15 14:13:52 1989
X--- edef.h	Thu Jun 15 14:10:28 1989
X***************
X*** 41,47 ****
X  NOSHARE int DNEAR sscroll = FALSE;	/* smooth scrolling enabled flag*/
X  NOSHARE int DNEAR hscroll = TRUE;	/* horizontal scrolling flag	*/
X  NOSHARE int DNEAR hjump = 1;		/* horizontal jump size 	*/
X! NOSHARE int DNEAR ssave = TRUE; 	/* safe save flag		*/
X  NOSHARE struct BUFFER *bstore = NULL;	/* buffer to store macro text to*/
X  NOSHARE int DNEAR vtrow = 0;		/* Row location of SW cursor	*/
X  NOSHARE int DNEAR vtcol = 0;		/* Column location of SW cursor */
X--- 41,47 ----
X  NOSHARE int DNEAR sscroll = FALSE;	/* smooth scrolling enabled flag*/
X  NOSHARE int DNEAR hscroll = TRUE;	/* horizontal scrolling flag	*/
X  NOSHARE int DNEAR hjump = 1;		/* horizontal jump size 	*/
X! NOSHARE int DNEAR ssave = FALSE; 	/* safe save flag		*/
X  NOSHARE struct BUFFER *bstore = NULL;	/* buffer to store macro text to*/
X  NOSHARE int DNEAR vtrow = 0;		/* Row location of SW cursor	*/
X  NOSHARE int DNEAR vtcol = 0;		/* Column location of SW cursor */
X*** efunc.h.orig	Sat Sep 16 23:38:37 1989
X--- efunc.h	Sat Sep 16 23:39:07 1989
X***************
X*** 229,235 ****
X  #if	PROC
X  	{"store-procedure",		storeproc},
X  #endif
X! #if	BSD
X  	{"suspend-emacs",		bktoshell},
X  #endif
X  	{"transpose-characters",	twiddle},
X--- 229,235 ----
X  #if	PROC
X  	{"store-procedure",		storeproc},
X  #endif
X! #if	JOBCTRL
X  	{"suspend-emacs",		bktoshell},
X  #endif
X  	{"transpose-characters",	twiddle},
X*** input.c.orig	Thu Jun 15 14:05:11 1989
X--- input.c	Mon Aug 14 13:20:59 1989
X***************
X*** 46,51 ****
X--- 46,59 ----
X  #include	"edef.h"
X  #include	"elang.h"
X  
X+ #if USG | BSD | V7
X+ #include	<pwd.h>
X+ extern	struct passwd *getpwnam();
X+ #if USG
X+ #define	index	strchr
X+ #endif
X+ #endif
X+ 
X  /*
X   * Ask a yes or no question in the message line. Return either TRUE, FALSE, or
X   * ABORT. The ABORT status is returned if the user bumps out of the question
X***************
X*** 209,214 ****
X--- 217,227 ----
X  	register int c;		/* current input character */
X  	int cpos;		/* current column on screen output */
X  	static char buf[NSTRING];/* buffer to hold tentative name */
X+ #if USG | BSD | V7
X+ 	char *home;
X+ 	struct passwd *pwd;
X+ #endif
X+ 
X  #if	COMPLET == 0
X  	int status;
X  #endif
X***************
X*** 306,313 ****
X  			TTflush();
X  			if (buf[cpos - 1] == 0)
X  				return(buf);
X  		} else {
X! 			if (cpos < maxlen && c > ' ') {
X  				buf[cpos++] = c;
X  				mlout(c);
X  				++ttcol;
X--- 319,394 ----
X  			TTflush();
X  			if (buf[cpos - 1] == 0)
X  				return(buf);
X+ #if USG | BSD | V7
X+ 		} else if (c == '/' && type == CMP_FILENAME && buf[0] == '~') {
X+ 			int i;
X+ 
X+ 			if (cpos == 1) {
X+ 				if (home = (char *)getenv("HOME")) {
X+ 
X+ 					mlout('\b');	/* backup over ~ */
X+ 					mlout(' ');
X+ 					mlout('\b');
X+ 					ttcol--;
X+ 					TTflush();
X+ 					strcpy(buf, home);
X+ 					cpos = strlen(buf);
X+ 					buf[cpos++] = '/';
X+ 					for (i = 0; i < cpos; i++) {
X+ 						mlout(buf[i]);
X+ 						ttcol++;
X+ 					}
X+ 					TTflush();
X+ 				} else
X+ 					goto nextc;
X+ 			} else {
X+ 				buf[cpos] = '\0';
X+ 				if (pwd = getpwnam(&buf[1])) {
X+ 					while (cpos != 0) {	/* kill	*/
X+ 						mlout('\b');	/* line	*/
X+ 						mlout(' ');
X+ 						mlout('\b');
X+ 						--cpos;
X+ 						--ttcol;
X+ 					}
X+ 					TTflush();
X+ 					strcpy(buf, pwd->pw_dir);
X+ 					cpos = strlen(buf);
X+ 					buf[cpos++] = '/';
X+ 					for (i = 0; i < cpos; i++) {
X+  					mlout(buf[i]);
X+ 						ttcol++;
X+ 					}
X+ 					TTflush();
X+ 				} else
X+ 					goto nextc;
X+ 			}
X+ 		} else if (c == '/' && type == CMP_FILENAME && buf[0] == '$') {
X+ 			int i;
X+ 
X+ 			buf[cpos] = '\0';
X+ 			if (home = (char *)getenv(&buf[1])) {
X+ 				while (cpos != 0) {	/* kill	*/
X+ 					mlout('\b');	/* line	*/
X+ 					mlout(' ');
X+ 					mlout('\b');
X+ 					--cpos;
X+ 					--ttcol;
X+ 				}
X+ 				TTflush();
X+ 				strcpy(buf, home);
X+ 				cpos = strlen(buf);
X+ 				buf[cpos++] = '/';
X+ 				for (i = 0; i < cpos; i++) {
X+ 					mlout(buf[i]);
X+ 					ttcol++;
X+ 				}
X+ 				TTflush();
X+ 			} else
X+ 				goto nextc;
X+ #endif
X  		} else {
X! nextc:			if (cpos < maxlen && c > ' ') {
X  				buf[cpos++] = c;
X  				mlout(c);
X  				++ttcol;
X***************
X*** 476,542 ****
X  {
X  	register char *fname;	/* trial file to complete */
X  	register int index;	/* index into strings to compare */
X! 	register char *match;	/* last file that matches string */
X! 	register int matchflag;	/* did this file name match? */
X! 	register int comflag;	/* was there a completion at all? */
X! 
X! 	/* start attempting completions, one character at a time */
X! 	comflag = FALSE;
X! 	while (*cpos < NBUFN) {
X! 
X! 		/* first, we start at the first file and scan the list */
X! 		match = NULL;
X! 		name[*cpos] = 0;
X! 		fname = getffile(name);
X! 		while (fname) {
X! 
X! 			/* is this a match? */
X! 			matchflag = TRUE;
X! 			for (index = 0; index < *cpos; index++)
X! 				if (name[index] != fname[index]) {
X! 					matchflag = FALSE;
X! 					break;
X! 				}
X! 
X! 			/* if it is a match */
X! 			if (matchflag && index) {
X! 
X! 				/* if this is the first match, simply record it */
X! 				if (match == NULL) {
X! 					match = fname;
X! 					name[*cpos] = fname[*cpos];
X! 				} else {
X! 					/* if there's a difference, stop here */
X! 					if (name[*cpos] != fname[*cpos])
X! 						return;
X! 				}
X! 			}
X! 
X! 			/* on to the next file */
X! 			fname = getnfile();
X! 		}
X! 
X! 		/* with no match, we are done */
X! 		if (match == NULL) {
X! 			/* beep if we never matched */
X! 			if (comflag == FALSE)
X! 				TTbeep();
X! 			return;
X! 		}
X  
X! 		/* if we have completed all the way... go back */
X! 		if (name[*cpos] == 0) {
X! 			(*cpos)++;
X! 			return;
X! 		}
X  
X! 		/* remember we matched, and complete one character */
X! 		comflag = TRUE;
X! 		TTputc(name[(*cpos)++]);
X! 		TTflush();
X! 	}
X  
X- 	/* don't allow a completion past the end of the max file name length */
X  	return;
X  }
X  #endif
X--- 557,627 ----
X  {
X  	register char *fname;	/* trial file to complete */
X  	register int index;	/* index into strings to compare */
X! 	register int matches;	/* number of matches for name */
X! 	char longestmatch[NSTRING]; /* temp buffer for longest match */
X! 	int longestlen;		/* length of longest match (always > *cpos) */
X  
X! 	/* everything (or nothing) matches an empty string */
X! 	if (*cpos == 0)
X! 		return;
X! 
X! 	/* first, we start at the first file and scan the list */
X! 	matches = 0;
X! 	name[*cpos] = 0;
X! 	fname = getffile(name);
X! 	while (fname) {
X! 
X! 		/* is this a match? */
X! 		if (strncmp(name,fname,*cpos) == 0) {
X! 
X! 			/* count the number of matches */
X! 			matches++;
X! 
X! 			/* if this is the first match, simply record it */
X! 			if (matches == 1) {
X! 				strcpy(longestmatch,fname);
X! 				longestlen = strlen(longestmatch);
X! 			} else {
X! 				
X! 				/* if there's a difference, stop here */
X! 				if (longestmatch[*cpos] != fname[*cpos])
X! 					return;
X! 
X! 				for (index = (*cpos) + 1; index < longestlen; index++)
X! 					if (longestmatch[index] != fname[index]) {
X! 						longestlen = index;
X! 						longestmatch[longestlen] = 0;
X! 					}
X! 			}
X! 		}
X! 
X! 		/* on to the next file */
X! 		fname = getnfile();
X! 	}
X! 
X! 	/* beep if we never matched */
X! 	if (matches == 0) {
X! 		TTbeep();
X! 		return;
X! 	}
X! 
X! 	/* the longestmatch array contains the longest match so copy and print it */
X! 	for ( ; (*cpos < (NSTRING-1)) && (*cpos < longestlen); (*cpos)++) {
X! 		name[*cpos] = longestmatch[*cpos];
X! 		TTputc(name[*cpos]);
X! 	}
X! 
X! 	name[*cpos] = 0;
X! 
X! 	/* if only one file matched then increment cpos to signal complete() */
X! 	/* that this was a complete match.  If a directory was matched then */
X! 	/* last character will be the DIRSEPCHAR.  In this case we do NOT *
X! 	/* want to signal a complete match. */
X! 	if ((matches == 1) && (name[(*cpos)-1] != DIRSEPCHAR))
X! 		(*cpos)++;
X  
X! 	TTflush();
X  
X  	return;
X  }
X  #endif
X*** tcap.c.orig	Sat Sep 16 22:25:59 1989
X--- tcap.c	Sat Sep 16 22:26:18 1989
X***************
X*** 413,419 ****
X  	register int c;
X  	register int index;	/* index into termcap binding table */
X  	char *sp;
X! #if	BSD | V7 | HPUX
X  	int fdset;
X  	struct timeval timeout;
X  #endif
X--- 413,419 ----
X  	register int c;
X  	register int index;	/* index into termcap binding table */
X  	char *sp;
X! #if	BSD | V7 | HPUX | SUN
X  	int fdset;
X  	struct timeval timeout;
X  #endif
X***************
X*** 427,433 ****
X  
X  	/* process a possible escape sequence */
X  	/* set up to check the keyboard for input */
X! #if	BSD | V7 | HPUX
X  	fdset = 1;
X  	timeout.tv_sec = 0;
X  	timeout.tv_usec = 35000L;
X--- 427,433 ----
X  
X  	/* process a possible escape sequence */
X  	/* set up to check the keyboard for input */
X! #if	BSD | V7 | HPUX | SUN
X  	fdset = 1;
X  	timeout.tv_sec = 0;
X  	timeout.tv_usec = 35000L;
X***************
X*** 438,444 ****
X  		return(CTRL | '[');
X  #endif
X  
X! #if XENIX | SUNOS
X  	if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
X  		nap(35000L);
X  		if (rdchk(0) <= 0)
X--- 438,444 ----
X  		return(CTRL | '[');
X  #endif
X  
X! #if XENIX
X  	if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
X  		nap(35000L);
X  		if (rdchk(0) <= 0)
X*** unix.c.orig	Thu May 11 13:09:36 1989
X--- unix.c	Sun Sep 17 00:06:10 1989
X***************
X*** 15,21 ****
X--- 15,28 ----
X  #include	<signal.h>
X  #include	<termio.h>
X  #include	<fcntl.h>
X+ #include	<sys/types.h>
X+ #include	<sys/stat.h>
X+ #if	DIRENT
X+ #include	<dirent.h>
X+ #define direct dirent
X+ #else
X  #include	<ndir.h>
X+ #endif
X  int kbdflgs;			/* saved keyboard fd flags	*/
X  int kbdpoll;			/* in O_NDELAY mode			*/
X  int kbdqp;			/* there is a char in kbdq	*/
X***************
X*** 42,55 ****
X  
X  #if BSD
X  #include <sys/ioctl.h>		/* to get at the typeahead */
X- extern	int rtfrmshell();	/* return from suspended shell */
X  #define	TBUFSIZ	128
X  char tobuf[TBUFSIZ];		/* terminal output buffer */
X  #endif
X  #endif
X  
X  #if     V7 | USG | HPUX | SUN | XENIX | BSD
X- #include        <signal.h>
X  extern int vttidy();
X  #endif
X  
X--- 49,64 ----
X  
X  #if BSD
X  #include <sys/ioctl.h>		/* to get at the typeahead */
X  #define	TBUFSIZ	128
X  char tobuf[TBUFSIZ];		/* terminal output buffer */
X  #endif
X  #endif
X  
X+ #if JOBCTRL
X+ extern	int rtfrmshell();	/* return from suspended shell */
X+ #endif
X+ 
X  #if     V7 | USG | HPUX | SUN | XENIX | BSD
X  extern int vttidy();
X  #endif
X  
X***************
X*** 75,80 ****
X--- 84,94 ----
X  	kbdpoll = FALSE;
X  #endif
X  
X+ #if	JOBCTRL
X+ 	signal(SIGTSTP,SIG_DFL);	/* set signals so that we can */
X+ 	signal(SIGCONT,rtfrmshell);	/* suspend & restart emacs */
X+ #endif
X+ 
X  #if     V7 | BSD
X          gtty(0, &ostate);                       /* save old state */
X          gtty(0, &nstate);                       /* get base of new state */
X***************
X*** 87,96 ****
X  	/* provide a smaller terminal output buffer so that
X  	   the type ahead detection works better (more often) */
X  	setbuffer(stdout, &tobuf[0], TBUFSIZ);
X- 	signal(SIGTSTP,SIG_DFL);	/* set signals so that we can */
X- 	signal(SIGCONT,rtfrmshell);	/* suspend & restart emacs */
X  #endif
X  #endif
X  	/* on all screens we are not sure of the initial position
X  	   of the cursor					*/
X  	ttrow = 999;
X--- 101,112 ----
X  	/* provide a smaller terminal output buffer so that
X  	   the type ahead detection works better (more often) */
X  	setbuffer(stdout, &tobuf[0], TBUFSIZ);
X  #endif
X  #endif
X+ 	/* if we spawn a subshell we don't want to die if the user hits
X+ 	   the interrupt or quit keys */
X+ 	signal(SIGINT, SIG_IGN);
X+ 	signal(SIGQUIT, SIG_IGN);
X  	/* on all screens we are not sure of the initial position
X  	   of the cursor					*/
X  	ttrow = 999;
X***************
X*** 217,223 ****
X  		if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
X  			return(FALSE);
X  		kbdpoll = TRUE;
X! 		kbdqp = (1 == read(0, kbdq, 1));
X  	}
X  	return(kbdqp);
X  #endif
X--- 233,239 ----
X  		if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
X  			return(FALSE);
X  		kbdpoll = TRUE;
X! 		kbdqp = (1 == read(0, &kbdq, 1));
X  	}
X  	return(kbdqp);
X  #endif
X***************
X*** 259,265 ****
X          return(TRUE);
X  }
X  
X! #if	BSD
X  
X  bktoshell()		/* suspend MicroEMACS and wait to wake up */
X  {
X--- 275,281 ----
X          return(TRUE);
X  }
X  
X! #if	JOBCTRL
X  
X  bktoshell()		/* suspend MicroEMACS and wait to wake up */
X  {
X***************
X*** 299,311 ****
X          TTclose();                              /* stty to old modes    */
X          system(line);
X          TTopen();
X!         TTflush();
X  	/* if we are interactive, pause here */
X  	if (clexec == FALSE) {
X  	        mlputs(TEXT6);
X  /*                     "\r\n\n[End]" */
X          	tgetc();
X          }
X          sgarbf = TRUE;
X          return(TRUE);
X  }
X--- 315,329 ----
X          TTclose();                              /* stty to old modes    */
X          system(line);
X          TTopen();
X!         movecursor(term.t_nrow, 0);             /* Seek to last line.   */
X  	/* if we are interactive, pause here */
X  	if (clexec == FALSE) {
X  	        mlputs(TEXT6);
X  /*                     "\r\n\n[End]" */
X+ 	        TTflush();
X          	tgetc();
X          }
X+ 	TTflush();
X          sgarbf = TRUE;
X          return(TRUE);
X  }
X***************
X*** 317,323 ****
X   */
X  
X  execprg(f, n)
X- 
X  {
X          register int    s;
X          char            line[NLINE];
X--- 335,340 ----
X***************
X*** 326,348 ****
X  	if (restflag)
X  		return(resterr());
X  
X!         if ((s=mlreply("!", line, NLINE)) != TRUE)
X                  return(s);
X          TTputc('\n');                /* Already have '\r'    */
X          TTflush();
X          TTclose();                              /* stty to old modes    */
X!         system(line);
X          TTopen();
X!         mlputs(TEXT188);                        /* Pause.               */
X! /*             "[End]" */
X!         TTflush();
X!         while ((s = tgetc()) != '\r' && s != ' ')
X!                 ;
X          sgarbf = TRUE;
X          return(TRUE);
X  }
X  
X  /*
X   * Pipe a one line command into a window
X   * Bound to ^X @
X   */
X--- 343,502 ----
X  	if (restflag)
X  		return(resterr());
X  
X!         if ((s=mlreply("$", line, NLINE)) != TRUE)
X                  return(s);
X          TTputc('\n');                /* Already have '\r'    */
X          TTflush();
X          TTclose();                              /* stty to old modes    */
X!         execpr(line);
X          TTopen();
X!         movecursor(term.t_nrow, 0);             /* Seek to last line.   */
X! 	/* if we are interactive, pause here */
X! 	if (clexec == FALSE) {
X! 	        mlputs(TEXT188);
X! /*                     "[End]" */
X! 	        TTflush();
X!         	tgetc();
X!         }
X! 	TTflush();
X          sgarbf = TRUE;
X          return(TRUE);
X  }
X  
X  /*
X+  * Run a program with arguments without using a shell.
X+  * Line is a string containing a program name and arguments, separated
X+  * by whitespace.  Shell metacharacters have no special meaning.
X+  */
X+ 
X+ execpr(line)
X+ 	char           *line;
X+ {
X+ 	char          **stov();
X+ 	char          **argv;
X+ 	char           *cp;	/* A copy of the line in case it's $SHELL. */
X+ 	int             pid;
X+ 
X+ 	if (line == 0 || *line == 0)
X+ 		return;
X+ 
X+ 	cp = malloc(strlen(line) + 1);
X+ 	strcpy(cp, line);
X+ 	argv = stov(cp);
X+ 
X+ 	pid = fork();
X+ 	switch (pid) {
X+ 	case -1:
X+ 		break;
X+ 	case 0:		/* Child. */
X+ 		signal(SIGINT, SIG_DFL);
X+ 		signal(SIGQUIT, SIG_DFL);
X+ 		execvp(argv[0], argv);
X+ 		/* Might want to print "argv[0]: Command not found.\n". */
X+ 		exit(0);
X+ 	default:		/* Parent. */
X+ 		while (wait((int *) 0) != pid)
X+ 			 /* Do nothing. */ ;
X+ 		break;
X+ 	}
X+ 	free(argv);
X+ 	free(cp);
X+ }
X+ 
X+ /* Number of arguments between realloc's. */
X+ #define ALLOC_BLOCK 10
X+ 
X+ /*
X+  * Make an argv-like vector (string array) from a string (such as an
X+  * environment variable).  The last element of the vector is null.
X+  * Scatters nulls throughout s.
X+  */
X+ 
X+ char **
X+ stov(s)
X+ 	char           *s;	/* The string to vectorize. */
X+ {
X+ 	char           *malloc(), *realloc(), *strtok();
X+ 	int             argc;
X+ 	char          **argv;
X+ 
X+ 	argc = 0;
X+ 	argv = (char **) malloc((unsigned) (sizeof(char *) * ALLOC_BLOCK));
X+ 
X+ 	for (s = strtok(s, " \t\n\r"); s;
X+ 		s = strtok((char *) NULL, " \t\n\r")) {
X+ 		if (argc > 0 && argc % ALLOC_BLOCK == 0)
X+ 			argv = (char **) realloc((char *) argv, (unsigned)
X+ 				(sizeof(char *) * (argc + ALLOC_BLOCK)));
X+ 		argv[argc++] = s;
X+ 	}
X+ 	argv = (char **) realloc((char *) argv,
X+ 		(unsigned) (sizeof(char *) * (argc + 1)));
X+ 	argv[argc] = NULL;
X+ 	return argv;
X+ }
X+ 
X+ #if V7 | BSD
X+ /* Return the next token in string, delimited by one or more members of
X+    the set separators.  If string is NULL, use the same string as in the
X+    last call.  */
X+ 
X+ char *
X+ strtok(string, separators)
X+ 	char           *string;
X+ 	char           *separators;
X+ {
X+ 	static char    *pos = NULL;	/* Current location in the string. */
X+ 	register int    token_length;
X+ 
X+ 	if (string)
X+ 		pos = string;
X+ 	pos += strspn(pos, separators);	/* Skip initial separators. */
X+ 	token_length = strcspn(pos, separators);	/* Find token length. */
X+ 	if (token_length == 0)
X+ 		return NULL;	/* No more tokens; pos is on a 0. */
X+ 	separators = pos;	/* Re-use separators to save start of token. */
X+ 	pos += token_length;	/* Move onto the 0. */
X+ 	if (*pos)		/* If not the last token, */
X+ 		*pos++ = 0;	/* null terminate the token. */
X+ 	return separators;
X+ }
X+ 
X+ /* Return the length of the span of characters at the start of string
X+    that are members of class.  */
X+ 
X+ strspn(string, class)
X+ 	char           *string;
X+ 	char           *class;
X+ {
X+ 	char           *index();
X+ 	register int    count;
X+ 
X+ 	for (count = 0; string[count]; ++count)
X+ 		if (!index(class, string[count]))
X+ 			break;
X+ 	return count;
X+ }
X+ 
X+ /* Return the length of the span of characters at the start of string
X+    that are non-members of class.  */
X+ 
X+ strcspn(string, class)
X+ 	char           *string;
X+ 	char           *class;
X+ {
X+ 	char           *index();
X+ 	register int    count;
X+ 
X+ 	for (count = 0; string[count]; ++count)
X+ 		if (index(class, string[count]))
X+ 			break;
X+ 	return count;
X+ }
X+ 
X+ #endif
X+ 
X+ /*
X   * Pipe a one line command into a window
X   * Bound to ^X @
X   */
X***************
X*** 529,534 ****
X--- 683,689 ----
X  	register int index;		/* index into various strings */
X  	register int point;		/* index into other strings */
X  	register int extflag;		/* does the file have an extention? */
X+ 	int currentdir = FALSE;
X  
X  	/* first parse the file path off the file spec */
X  	strcpy(path, fspec);
X***************
X*** 537,542 ****
X--- 692,704 ----
X  				path[index] != '\\' && path[index] != ':'))
X  		--index;
X  	path[index+1] = 0;
X+ #if HPUX
X+ 	if (index < 0) {
X+ 		strcpy(path,"./");
X+ 		index = 1;
X+ 		currentdir = TRUE;
X+ 	}
X+ #endif
X  
X  	/* check for an extension */
X  	point = strlen(fspec) - 1;
X***************
X*** 554,563 ****
X  		closedir(dirptr);
X  		dirptr = NULL;
X  	}
X! 	dirptr = opendir(path);
X  	if (dirptr == NULL)
X  		return(NULL);
X  
X  	strcpy(rbuf, path);
X  	nameptr = &rbuf[strlen(rbuf)];
X  
X--- 716,733 ----
X  		closedir(dirptr);
X  		dirptr = NULL;
X  	}
X! 	if (path[0])
X! 		dirptr = opendir(path);
X! 	else
X! 		dirptr = opendir(".");
X  	if (dirptr == NULL)
X  		return(NULL);
X  
X+ #if HPUX
X+ 	if (currentdir == TRUE)
X+ 		path[0] = '\0';
X+ #endif
X+ 
X  	strcpy(rbuf, path);
X  	nameptr = &rbuf[strlen(rbuf)];
X  
X***************
X*** 580,591 ****
X  	/* check to make sure we skip directory entries */
X  	strcpy(nameptr, dp->d_name);
X  	stat(rbuf, &fstat);
X! 	if ((fstat.st_mode & S_IFMT) != S_IFREG)
X  		goto nxtdir;
X  
X  	/* return the next file name! */
X  	return(rbuf);
X  }
X  #else
X  char *PASCAL NEAR getffile(fspec)
X  
X--- 750,766 ----
X  	/* check to make sure we skip directory entries */
X  	strcpy(nameptr, dp->d_name);
X  	stat(rbuf, &fstat);
X! 	if (((fstat.st_mode & S_IFMT) != S_IFREG) &&
X! 	    ((fstat.st_mode & S_IFMT) != S_IFDIR))
X  		goto nxtdir;
X  
X+ 	if ((fstat.st_mode & S_IFMT) == S_IFDIR)
X+ 		strcat(rbuf,"/");
X+ 
X  	/* return the next file name! */
X  	return(rbuf);
X  }
X+ 
X  #else
X  char *PASCAL NEAR getffile(fspec)
X  
X*** estruct.h.orig	Tue Sep 19 11:44:15 1989
X--- estruct.h	Tue Sep 19 11:45:37 1989
X***************
X*** 52,57 ****
X--- 52,62 ----
X  #define WMCS	0			/* Wicat's MCS			*/
X  #define	AOSVS	0			/* Data General AOS/VS		*/
X  
X+ /* Additional settings for Unix systems		*/
X+ #define DIRENT  1			/* has POSIX <dirent.h> library	*/
X+ #define JOBCTRL	0			/* has BSD job control		*/
X+ #define VARARGS	1			/* has Unix <varargs.h>		*/
X+ 
X  /*	Compiler definitions			*/
X  /*	[Set one of these!!]			*/
X  #define UNIX	0	/* a random UNIX compiler */
END_OF_FILE
echo shar: 1 control character may be missing from \"'patches'\"
if test 25167 -ne `wc -c <'patches'`; then
    echo shar: \"'patches'\" unpacked with wrong size!
fi
# end of 'patches'
fi
if test -f 'optional' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'optional'\"
else
echo shar: Extracting \"'optional'\" \(10811 characters\)
sed "s/^X//" >'optional' <<'END_OF_FILE'
XArticle 5159 of comp.emacs:
XPath: rocky8!cmcl2!rutgers!tut.cis.ohio-state.edu!ucbvax!agate!bionet!ig!arizona!rupley
XFrom: rupley at arizona.edu (John Rupley)
XNewsgroups: comp.emacs
XSubject: Microemacs 3.10 - patch for tcap.c
XMessage-ID: <11487 at megaron.arizona.edu>
XDate: 9 Jun 89 01:17:52 GMT
XOrganization: U of Arizona CS Dept, Tucson
XLines: 276
XKeywords: function key timeout loop for USG; revised ttable[]
X
X
Xcontext diff patch for tcap.c:
X
X1) added timeout loop in get1key(), for USG option; without it, one
Xcannot use the function keys under sys5; it could be made more portable
Xby #defining the processor speed, or building in a test for it;
Xcommented-out code gives an alternative solution, without a timeout
Xloop.
X
X2) modified ttable[], to allow shifted function keys and some other stuff.
X
X3) sample terminfo, consistent with (2), included in comment.
X
X
XJohn Rupley
X    uucp: ..{uunet | ucbvax | cmcl2 | hao!ncar!noao}!arizona!rupley!local
X    internet: rupley!local at megaron.arizona.edu
X    (H) 30 Calle Belleza, Tucson AZ  85716 - (602) 325-4533
X    (O) Dept. Biochemistry, Univ. Arizona, Tucson AZ 85721 - (602) 621-3929
X------------------------------------------------------------------------
X*** tcap.c	Mon May 22 16:21:08 1989
X--- ../tcap.c	Fri May 26 13:47:56 1989
X***************
X*** 70,75
X                      
X  */
X  
X  #define termdef 1			/* don't define "term" external */
X  
X  #include <stdio.h>
X
X--- 70,135 -----
X                      
X  */
X  
X+ /*
X+  * a non-portable but generally usable USG option for get1key() is suggested;
X+  * it allows use of the function keys needed to handle menus, specifically
X+  * those of .emacsrc and the *.cmd files; 
X+  *
X+  * it assumes typeahead() is enabled;
X+  *
X+  * the ttable[] bindings include shifted function and keypad keys;
X+  *
X+  * following is a sample ansi terminfo file, which has strings for the 
X+  * normal and shifted keys, and which adheres more-or-less to the 
X+  * ansi standard;
X+  *
X+  * a user without write permission on the system terminfo files likely
X+  * will have to set up a local TERMINFO environment by use of .profile,
X+  * and perhaps reprogram the function and keypad strings of the terminal;
X+  *
X+  * j.a. rupley, tucson, az  - rupley!local at megaron.arizona.edu
X+  */
X+ 
X+ /*-
X+ ansi|modified terminfo description 
X+ # DELETE #...# COMMENTS #...# BEFORE #...# TIC'ING #
X+ # standard stuff #
X+ 	am, xon, cols#80, lines#24, bel=^G, cr=\r, clear=\E[H\E[J, 
X+ 	el=\E[K, ed=\E[J, cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, 
X+ 	cub1=\b, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[M, blink=\E[5m, 
X+ 	bold=\E[1m, smir=\E[4h, invis=\E[8m, rev=\E[7m, smso=\E[7m, 
X+ 	smul=\E[4m, sgr0=\E[m, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, 
X+ 	is2=\E[=h, ich1=\E[@, il1=\E[L, 
X+ 	dl=\E[%p1%dM, cud=\E[%p1%dB, 
X+ 	ich=\E[%p1%d@, il=\E[%p1%dL, cub=\E[%p1%dD, cuf=\E[%p1%dC, 
X+ 	cuu=\E[%p1%dA, ind=\n, ht=\t, 
X+ # function keys - kf0=kf10 #
X+ 	kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, 
X+ 	kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, 
X+ 	kf0=\EOl, kf10=\EOl, 
X+ # shifted function keys - lf0=lf10 #
X+ # tricky - store and recover strings as labels #
X+ 	lf1=\EOC, lf2=\EOD, lf3=\EOE, lf4=\EOF, 
X+ 	lf5=\EOG, lf6=\EOH, lf7=\EOI, lf8=\EOJ, lf9=\EOK, 
X+ 	lf0=\EOL, lf10=\EOL, 
X+ # keypad keys #
X+ 	khome=\E[H,	kcuu1=\E[A,	kpp=\E[U, 
X+ 	kcub1=\E[D, 			kcuf1=\E[C, 
X+ 	kll=\E[E, 	kcud1=\E[B, 	knp=\E[V, 
X+ # ins #
X+ 	kich1=\E[@, 
X+ # shifted keypad keys #
X+ 	ka1=\E[!H,	kri=\E[S,	ka3=\E[!U, 
X+ 	kclr=\E[!@,			kel=\E[!A, 
X+ 	kc1=\E[!E,	kind=\E[T,	kc3=\E[!V,
X+ # shifted ins and shifted del #
X+ 	kil1=\E[L,			kdch1=\E[P,
X+ # miscellaneous #
X+ 	kdl1=\E[M, 
X+ 	cbt=\E[Z, 
X+ 	kbs=\b, 
X+ */
X+ 
X  #define termdef 1			/* don't define "term" external */
X  
X  #include <stdio.h>
X***************
X*** 103,136
X  } TBIND;
X  
X  TBIND ttable[] = {
X! 	"bt",	SHFT | CTRL | 'i',	"",	/* backtab */
X! 	"k1",	SPEC | '1',		"",	/* function key 1 */
X! 	"k2",	SPEC | '2',		"",	/* function key 2 */
X! 	"k3",	SPEC | '3',		"",	/* function key 3 */
X! 	"k4",	SPEC | '4',		"",	/* function key 4 */
X! 	"k5",	SPEC | '5',		"",	/* function key 5 */
X! 	"k6",	SPEC | '6',		"",	/* function key 6 */
X! 	"k7",	SPEC | '7',		"",	/* function key 7 */
X! 	"k8",	SPEC | '8',		"",	/* function key 8 */
X! 	"k9",	SPEC | '9',		"",	/* function key 9 */
X! 	"k0",	SPEC | '0',		"",	/* function key 10 */
X! 	"kA",	CTRL | 'O',		"",	/* insert line */
X! 	"kb",	CTRL | 'H',		"",	/* backspace */
X! 	"kC",	CTRL | 'L',		"",	/* clear screen */
X! 	"kD",	SPEC | 'D',		"",	/* delete character */
X! 	"kd",	SPEC | 'N',		"",	/* down cursor */
X! 	"kE",	CTRL | 'K',		"",	/* clear to end of line */
X! 	"kF",	CTRL | 'V',		"",	/* scroll down */
X! 	"kH",	SPEC | '>',		"",	/* home down [END?] key */
X! 	"kh",	SPEC | '<',		"",	/* home */
X! 	"kI",	SPEC | 'C',		"",	/* insert character */
X! 	"kL",	CTRL | 'K',		"",	/* delete line */
X! 	"kl",	SPEC | 'B',		"",	/* left cursor */
X! 	"kN",	SPEC | 'V',		"",	/* next page */
X! 	"kP",	SPEC | 'Z',		"",	/* previous page */
X! 	"kR",	CTRL | 'Z',		"",	/* scroll down */
X! 	"kr",	SPEC | 'F',		"",	/* right cursor */
X! 	"ku",	SPEC | 'P',		"",	/* up cursor */
X  };
X  
X  #define	NTBINDS	sizeof(ttable)/sizeof(TBIND)
X
X--- 163,232 -----
X  } TBIND;
X  
X  TBIND ttable[] = {
X! 	"k1",	SPEC | '1',		"",	/* kf1 /* function key 1 */
X! 	"k2",	SPEC | '2',		"",	/* kf2 /* function key 2 */
X! 	"k3",	SPEC | '3',		"",	/* kf3 /* function key 3 */
X! 	"k4",	SPEC | '4',		"",	/* kf4 /* function key 4 */
X! 	"k5",	SPEC | '5',		"",	/* kf5 /* function key 5 */
X! 	"k6",	SPEC | '6',		"",	/* kf6 /* function key 6 */
X! 	"k7",	SPEC | '7',		"",	/* kf7 /* function key 7 */
X! 	"k8",	SPEC | '8',		"",	/* kf8 /* function key 8 */
X! 	"k9",	SPEC | '9',		"",	/* kf9 /* function key 9 */
X! 	"k0",	SPEC | '0',		"",	/* kf0 /* function key 10 */
X! 	"l1",	SPEC | SHFT | '1',	"",	/* kl1 /* shftd func key 1 */
X! 	"l2",	SPEC | SHFT | '2',	"",	/* kl2 /* shftd func key 2 */
X! 	"l3",	SPEC | SHFT | '3',	"",	/* kl3 /* shftd func key 3 */
X! 	"l4",	SPEC | SHFT | '4',	"",	/* kl4 /* shftd func key 4 */
X! 	"l5",	SPEC | SHFT | '5',	"",	/* kl5 /* shftd func key 5 */
X! 	"l6",	SPEC | SHFT | '6',	"",	/* kl6 /* shftd func key 6 */
X! 	"l7",	SPEC | SHFT | '7',	"",	/* kl7 /* shftd func key 7 */
X! 	"l8",	SPEC | SHFT | '8',	"",	/* kl8 /* shftd func key 8 */
X! 	"l9",	SPEC | SHFT | '9',	"",	/* kl9 /* shftd func key 9 */
X! 	"l0",	SPEC | SHFT | '0',	"",	/* kl0 /* shftd func key 10 */
X! /* the following key-pad keys and their bindings are obvious */
X! 	"kh",	SPEC | '<',		"",	/* khome /* home */
X! 	"ku",	SPEC | 'P',		"",	/* kcuu1 /* up cursor */
X! 	"kP",	SPEC | 'Z',		"",	/* kpp /* previous page */
X! 	"kl",	SPEC | 'B',		"",	/* kcub1 /* left cursor */
X! 	"kr",	SPEC | 'F',		"",	/* kcuf1 /* right cursor */
X! 	"kH",	SPEC | '>',		"",	/* kll /* home down [END] */
X! 	"kd",	SPEC | 'N',		"",	/* kcud1 /* down cursor */
X! 	"kN",	SPEC | 'V',		"",	/* knp /* next page */
X! /* the following are less obvious */
X! /* ins		# kI kich1  insert character */	/* bound to insspace */
X! 	"kI",	SPEC | 'C',		"",	/* kich1 /* insert character */
X! /* shift del	# kD kdch1  delete character */	/* bound to forwdel */
X! 	"kD",	SPEC | 'D',		"",	/* kdch1 /* delete character */
X! /* shift ins	# kA kil1  insert line */ 	/* bound to openline */
X! 	"kA",	CTRL | 'O',		"",	/* kil1 /* insert line */
X! /* shift up	# kR kri  scroll up */		/* bound to backpage */
X! 	"kR",	CTRL | 'Z',		"",	/* kri /* scroll up */
X! /* shift down	# kF kind  scroll down */	/* bound to forwpage */
X! 	"kF",	CTRL | 'V',		"",	/* kind /* scroll down */
X! /* shift left	# kC kclr  clear screen */	/* bound to backword */
X! /*	"kC",	META | 'B',		"",	/* kclr /* clear screen */
X! 	"kC",	SPEC | CTRL | 'B',	"",	/* kclr /* clear screen */
X! /* shift right	# kE kel  clear to eol */	/* bound to forwword */
X! /*	"kE",	META | 'F',		"",	/* kel /* clear to eol */
X! 	"kE",	SPEC | CTRL | 'F',	"",	/* kel /* clear to eol */
X! /* shift pgup	# K3 ka3  pad upper right */	/* bound to gotobop */
X! /*	"K3",	META | 'P',		"",	/* ka3 /* pad upper right */
X! 	"K3",	SPEC | CTRL | 'Z',	"",	/* ka3 /* pad upper right */
X! /* shift pgdn	# K5 kc3  pad lower right */	/* bound to gotoeop */
X! /*	"K5",	META | 'N',		"",	/* kc3 /* pad lower right */
X! 	"K5",	SPEC | CTRL | 'V',	"",	/* kc3 /* pad lower right */
X! /* shift home	# K1 ka1  pad upper left */	/* unbound key */
X! 	"K1",	SPEC | CTRL | '<',	"",	/* ka1 /* pad upper left */
X! /* shift end	# K4 kc1  pad lower left */	/* unbound key */
X! 	"K4",	SPEC | CTRL | '>',	"",	/* kc1 /* pad lower left */
X! /* shift tab 	# bt cbt backtab		/* unbound key */
X! 	"bt",	SHFT | CTRL | 'i',	"",	/* cbt /* backtab */
X! /* and let's forget the following */
X! /* alt del	# kL kdl1  delete line */
X! /*	"kL",	CTRL | 'K',		"",	/* kdl1 /* delete line */
X! /*	"kb",	CTRL | 'H',		"",	/* kbs /* backspace */
X! /*	"kC",	CTRL | 'L',		"",	/* kclr /* clear screen */
X! /*	"kE",	CTRL | 'K',		"",	/* kel /* clear to eol */
X  };
X  
X  #define	NTBINDS	sizeof(ttable)/sizeof(TBIND)
X***************
X*** 450,457
X  	/* we don't know how to do this check for a pending char within
X  	   1/30th of a second machine independantly in the general System V
X  	   case.... so we don't */
X! 	if (kbdmode != PLAY)
X! 		return(CTRL | '[');
X  #endif
X  
X  	/* a key is pending within 1/30 of a sec... its an escape sequence */
X
X--- 546,586 -----
X  	/* we don't know how to do this check for a pending char within
X  	   1/30th of a second machine independantly in the general System V
X  	   case.... so we don't */
X! 	/*
X! 	 * or... maybe we try it;
X! 	 * very non-portable solution;
X! 	 * hardware-dependent timing loop;
X! 	 * set upper-limit on loop by testing hardware, to get 30 ms;
X! 	 * use typahead() to check for waiting input on exit from loop;
X! 	 */
X! 	{	int i;
X! 		if (kbdmode != PLAY && typahead() <= 0) {
X! 			/* loop limit set by hardware test */
X! 			/* for 30 ms or a bit less */
X! 			for (i = 0; i < 1500; i++)
X! 				;
X! 			if (typahead() <= 0)
X! 				return(CTRL | '[');
X! 		}
X! 	}
X! 	/*-
X! 	 * another way -- using blocking read;
X! 	 * problem... when <esc> used as terminator, as in setup for
X! 	 * searches, need to give it twice, or whatever;
X! 	 * non-portable... assumes ansi standard for function keys and
X! 	 * keypad;
X! 	 */
X! 	/*
X! 	{
X! 		extern char kbdq;
X! 		extern int kbdqp;
X! 
X! 		kbdq = ttgetc();
X! 		kbdqp = 1;
X! 		if ((kbdq & 255) != '[' && (kbdq & 255) != 'O')
X! 			return(CTRL | '[');
X! 	}
X! 	*/
X  #endif
X  
X  	/* a key is pending within 1/30 of a sec... its an escape sequence */
X***************
X*** 457,462
X  	/* a key is pending within 1/30 of a sec... its an escape sequence */
X  	cseq[0] = 27;
X  	sp = &cseq[1];
X  	while (sp < &cseq[6]) {
X  		c = ttgetc();
X  		*sp++ = c;
X
X--- 586,592 -----
X  	/* a key is pending within 1/30 of a sec... its an escape sequence */
X  	cseq[0] = 27;
X  	sp = &cseq[1];
X+ 	*sp = 0;
X  	while (sp < &cseq[6]) {
X  		c = ttgetc();
X  		*sp++ = c;
X
X
END_OF_FILE
if test 10811 -ne `wc -c <'optional'`; then
    echo shar: \"'optional'\" unpacked with wrong size!
fi
# end of 'optional'
fi
echo shar: End of shell archive.
exit 0



More information about the Comp.sources.misc mailing list