[net.sources] ispell update

george@rebel.UUCP (03/30/87)

These changes add improvements, no bug fixes.  See "Contents" for more
information.

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	Contents
#	config.h
#	ispell.c.diff
#	ispell.h.diff
#	term.c.diff
# This archive created: Sun Mar 29 23:31:59 1987
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'Contents'
then
	echo shar: "will not over-write existing file 'Contents'"
else
sed 's/^X//' << \SHAR_EOF > 'Contents'
XEnclosed in this shar are diffs to ispell.c, ispell.h, and term.c in
Xaddition to a replacement config.h for the recently release version of
Xispell as modified (most recently) by Geoff Kuenning.
X
XThis update greatly speeds up child process invocation by replacing
Xsystem() with direct fork()/exec() to the necessary process.  This
Xaffects the "L" command, "^Z" under System V (which now spawns a
Xsubshell), and the "!" shell escape command.  Since "!" does not
Xactually go to a shell, only one command may be entered (without the
Xusual shell syntax escapes).  If you really want a shell, you can (1)
X!sh, (2) ^Z, or (3) compile ispell.c with USESH defined.
X
XThis update also allows BAKEXT to be defined as an alternative to the
Xdefault ".bak" backup extension.  If defined (even as ".bak"), then the
Xfull extension will be used even if the filename has to be shortened.
X
XThis update will automatically use look(1) if it is available and the
Xlookup string doesn't contain wild card characters.  This allows
Xdistribution on System V systems upon which look availability may
Xvary.
X
XThis update allows a non-space to be entered to "---Type..." prompts
Xwhich will be used as the next command.
X
XFinally, this update includes an improved config.h and diff to ispell.h
Xwhich allow most #defines to be supplied on the compile command line.
XIf present, then the defaults in the *.h files will not be used.
X
XIf you have any comments on this update, please mail them to me at the
Xaddress below.  Note that I'll be on vacation until 4/20, so please
Xdon't expect a prompt reply!
X
XUUCP:	...ihnp4!akgua!rebel!george
X	...{hplabs,seismo}!gatech!rebel!george
XPhone:	(404) 662-1533
XSnail:	Tolerant Systems, 6961 Peachtree Industrial, Norcross, GA  30071
SHAR_EOF
fi
if test -f 'config.h'
then
	echo shar: "will not over-write existing file 'config.h'"
else
sed 's/^X//' << \SHAR_EOF > 'config.h'
X/*
X** library directory for hash table(s) / default hash table name
X** If you intend to use multiple dictionary files, I would suggest
X** LIBDIR be a directory which will contain nothing else, so sensible
X** names can be constructed for the -d option without conflict.
X*/
X#ifndef	LIBDIR
X#define LIBDIR "/usr/local/lib/ispell"
X#endif
X#ifndef	DEFHASH
X#define DEFHASH "ispell.hash"
X#endif
X
X/* default dictionary file */
X#ifndef	DEFDICT
X#define DEFDICT "dict.191"
X#endif
X
X/* default word list */
X#ifndef	DEFPICT
X#define DEFPDICT ".ispell.words"
X#endif
X
X/* path to egrep (use speeded up version if available) */
X#ifndef	EGREPCMD
X#ifdef	USG
X#define EGREPCMD "egrep"
X#else
X#define EGREPCMD "egrep -i"
X#endif
X#endif
X
X/* path to wordlist for Lookup command (typically /usr/dict/{words|web2} */
X#ifndef	WORDS
X#define WORDS	"/usr/dict/words"
X#endif
X
X/* environment variable for user's word list */
X#ifndef	PDICTVAR
X#define PDICTVAR "WORDLIST"
X#endif
X
X/* Approximate number of words in the full dictionary, after munching.
X** Err on the high side unless you are very short on memory, in which
X** case you might want to change the tables in tree.c and also increase
X** MAXPCT.
X**
X** (Note:  dict.191 is a bit over 15000 words.  dict.191 munched with
X** /usr/dict/words is a little over 28000).
X*/
X#ifndef BIG_DICT
X#define BIG_DICT	29000
X#endif
X
X/*
X** Maximum hash table fullness percentage.  Larger numbers trade space
X** for time.
X**/
X#ifndef MAXPCT
X#define MAXPCT	70		/* Expand table when 70% full */
X#endif
X
X/* buffer size to use for file names if not in sys/param.h */
X#ifndef MAXPATHLEN
X#define MAXPATHLEN 240
X#endif
X
X/* maximum filename length */
X#ifndef	MAXNAMLEN
X#define	MAXNAMLEN	14
X#endif
X
X/* extension for backup files */
X#ifndef	BAKEXT
X#define	BAKEXT	".bak"
X#endif
X
X/* mktemp template for temporary file - MUST contain 6 consecutive X's */
X#define TEMPNAME "/tmp/spellXXXXXX"
X
X/* word length allowed in dictionary by buildhash */
X#define WORDLEN 30
X
X/* hash table magic number */
X#define MAGIC 1
X
X/* define index for System V systems */
X#ifdef	USG
X#define	index	strchr
X#define	rindex	strrchr
X#endif
X
X/*
X** the isXXXX macros normally only check ASCII range.  These are used
X** instead for text characters, which we assume may be 8 bit.  The
X** NO8BIT ifdef	shuts off significance of 8 bit characters.  If you are
X** using this, and your ctype.h already masks, you can simplify.
X*/
X#ifdef	NO8BIT
X#define myupper(X) isupper((X)&0x7f)
X#define mylower(X) islower((X)&0x7f)
X#define myspace(X) isspace((X)&0x7f)
X#define myalpha(X) isalpha((X)&0x7f)
X#else
X#define myupper(X) (!((X)&0x80) && isupper(X))
X#define mylower(X) (!((X)&0x80) && islower(X))
X#define myspace(X) (!((X)&0x80) && isspace(X))
X#define myalpha(X) (!((X)&0x80) && isalpha(X))
X#endif
X
X/*
X** the NOPARITY mask is applied to user input characters from the terminal
X** in order to mask out the parity bit.
X*/
X#define NOPARITY 0x7f
SHAR_EOF
fi
if test -f 'ispell.c.diff'
then
	echo shar: "will not over-write existing file 'ispell.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'ispell.c.diff'
X*** ispell.c_orig	Tue Mar 24 23:50:33 1987
X--- ispell.c	Sun Mar 29 17:12:13 1987
X***************
X*** 17,22
X   *	-c option for creating suffix suggestions from raw words
X   *	suffixes in personal dictionary file
X   *	hashed personal dictionary file
X   */
X  
X  #include <stdio.h>
X
X--- 17,25 -----
X   *	-c option for creating suffix suggestions from raw words
X   *	suffixes in personal dictionary file
X   *	hashed personal dictionary file
X+  * 1987, George Sipe, added:
X+  *	fast shellescape() handling, flexible .bak handling, improved
X+  *	config.h, automatic use of look
X   */
X  
X  #include <stdio.h>
X***************
X*** 51,56
X  
X  givehelp ()
X  {
X  	erase ();
X  	printf ("Whenever a word is found that is not in the dictionary,\r\n");
X  	printf ("it is printed on the first line of the screen.  If the dictionary\r\n");
X
X--- 54,61 -----
X  
X  givehelp ()
X  {
X+ 	char ch;
X+ 
X  	erase ();
X  	printf ("Whenever a word is found that is not in the dictionary,\r\n");
X  	printf ("it is printed on the first line of the screen.  If the dictionary\r\n");
X***************
X*** 60,66
X  	printf ("\r\n");
X  	printf ("Commands are:\r\n\r\n");
X  	printf ("R       Replace the misspelled word completely.\r\n");
X! 	printf ("Space   Accept the word this time only\r\n");
X  	printf ("A       Accept the word for the rest of this file.\r\n");
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X
X--- 65,71 -----
X  	printf ("\r\n");
X  	printf ("Commands are:\r\n\r\n");
X  	printf ("R       Replace the misspelled word completely.\r\n");
X! 	printf ("Space   Accept the word this time only.\r\n");
X  	printf ("A       Accept the word for the rest of this file.\r\n");
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X***************
X*** 65,71
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X  	printf ("L       Look up words in system dictionary.\r\n");
X! 	printf ("Q       Write the rest of this file, ignoring misspellings, ");
X  	printf (         "and start next file.\r\n");
X  	printf ("X       Exit immediately.  Asks for confirmation.  ");
X  	printf (         "Leaves file unchanged.\r\n");
X
X--- 70,76 -----
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X  	printf ("L       Look up words in system dictionary.\r\n");
X! 	printf ("Q       Write rest of this file, ignoring misspellings, ");
X  	printf (         "and start next file.\r\n");
X  	printf ("X       Exit immediately.  Asks for confirmation.  ");
X  	printf (         "Leaves file unchanged.\r\n");
X***************
X*** 71,76
X  	printf (         "Leaves file unchanged.\r\n");
X  	printf ("!       Shell escape.\r\n");
X  	printf ("^L      Redraw screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X  	fflush (stdout);
X
X--- 76,83 -----
X  	printf (         "Leaves file unchanged.\r\n");
X  	printf ("!       Shell escape.\r\n");
X  	printf ("^L      Redraw screen.\r\n");
X+ 	printf ("^Z      Suspend program.\r\n");
X+ 	printf ("?       Show this help screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X  	ch = getchar ();
X***************
X*** 73,80
X  	printf ("^L      Redraw screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X! 	fflush (stdout);
X! 	getchar ();
X  }
X  
X  
X
X--- 80,87 -----
X  	printf ("?       Show this help screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X! 	ch = getchar ();
X! 	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X  
X  
X***************
X*** 274,280
X  char *filename;
X  {
X  	int c;
X! 	char	bakfile[256];
X  
X  	currentfile = filename;
X  
X
X--- 281,287 -----
X  char *filename;
X  {
X  	int c;
X! 	char	bakfile[MAXPATHLEN];
X  
X  	currentfile = filename;
X  
X***************
X*** 314,319
X  		return;
X  	}
X  
X  	sprintf(bakfile, "%s.bak", filename);
X  	if(link(filename, bakfile) == 0)
X  		unlink(filename);
X
X--- 321,327 -----
X  		return;
X  	}
X  
X+ #ifndef	BAKEXT
X  	sprintf(bakfile, "%s.bak", filename);
X  #else
X  	strcpy(bakfile, filename);
X***************
X*** 315,322
X  	}
X  
X  	sprintf(bakfile, "%s.bak", filename);
X! 	if(link(filename, bakfile) == 0)
X! 		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X
X--- 323,333 -----
X  
X  #ifndef	BAKEXT
X  	sprintf(bakfile, "%s.bak", filename);
X! #else
X! 	strcpy(bakfile, filename);
X! 	if (strcmp(BAKEXT, filename + strlen(filename) - strlen(BAKEXT)) != 0) {
X! 		register char *top;
X! 		register int maxlen;
X  
X  		maxlen = MAXNAMLEN - strlen(BAKEXT);
X  		top = (char *) rindex(bakfile, '/');
X***************
X*** 318,323
X  	if(link(filename, bakfile) == 0)
X  		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X
X--- 329,343 -----
X  		register char *top;
X  		register int maxlen;
X  
X+ 		maxlen = MAXNAMLEN - strlen(BAKEXT);
X+ 		top = (char *) rindex(bakfile, '/');
X+ 		top = top ? top + 1 : bakfile;
X+ 		if (strlen(top) > maxlen)
X+ 			*(top + maxlen) = '\000';
X+ 		strcat(bakfile, BAKEXT);
X+ 	}
X+ #endif
X+ 
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if (link (filename, bakfile) == 0) unlink (filename);
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X***************
X*** 319,324
X  		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X  		sleep (2);
X
X--- 339,345 -----
X  #endif
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X+ 	if (link (filename, bakfile) == 0) unlink (filename);
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X  		sleep (2);
X***************
X*** 480,486
X  
X  	while (1) {
X  		switch (c = (getchar () & NOPARITY)) {
X- #ifndef USG
X  		case 'Z' & 037:
X  			stop ();
X  			erase ();
X
X--- 501,506 -----
X  
X  	while (1) {
X  		switch (c = (getchar () & NOPARITY)) {
X  		case 'Z' & 037:
X  			stop ();
X  			erase ();
X***************
X*** 485,491
X  			stop ();
X  			erase ();
X  			goto checkagain;
X- #endif
X  		case ' ':
X  			erase ();
X  			return;
X
X--- 505,510 -----
X  			stop ();
X  			erase ();
X  			goto checkagain;
X  		case ' ':
X  			erase ();
X  			return;
X***************
X*** 490,496
X  			erase ();
X  			return;
X  		case 'x': case 'X':
X! 			printf ("Are you sure you want to throw away your changes? ");
X  			c = (getchar () & NOPARITY);
X  			if (c == 'y' || c == 'Y') {
X  				erase ();
X
X--- 509,515 -----
X  			erase ();
X  			return;
X  		case 'x': case 'X':
X! 			printf ("\nAre you sure you want to throw away your changes? ");
X  			c = (getchar () & NOPARITY);
X  			if (c == 'y' || c == 'Y') {
X  				erase ();
X***************
X*** 522,527
X  					goto checkagain;
X  				}
X  				printf ("\r\n");
X  				shellescape (buf);
X  				erase ();
X  				goto checkagain;
X
X--- 541,549 -----
X  					goto checkagain;
X  				}
X  				printf ("\r\n");
X+ #ifdef	USESH
X+ 				shescape (buf);
X+ #else
X  				shellescape (buf);
X  #endif
X  				erase ();
X***************
X*** 523,528
X  				}
X  				printf ("\r\n");
X  				shellescape (buf);
X  				erase ();
X  				goto checkagain;
X  			}
X
X--- 545,551 -----
X  				shescape (buf);
X  #else
X  				shellescape (buf);
X+ #endif
X  				erase ();
X  				goto checkagain;
X  			}
X***************
X*** 867,872
X  	char cmd[150];
X  	char *g, *s, grepstr[100];
X  	int wild = 0;
X  
X  	g = grepstr;
X  	for (s = string; *s != '\0'; s++)
X
X--- 890,896 -----
X  	char cmd[150];
X  	char *g, *s, grepstr[100];
X  	int wild = 0;
X+ 	static int look = -1;
X  
X  	g = grepstr;
X  	for (s = string; *s != '\0'; s++)
X***************
X*** 878,893
X  			*g++ = *s;
X  	*g = '\0';
X  	if (grepstr[0]) {
X! #ifdef LOOK
X! 		if (wild)
X! 			/* string has wild card characters */
X! 			sprintf (cmd, "%s '^%s$' %s", EGREPCMD, grepstr, WORDS);
X! 		else
X! 			/* no wild, use look(1) */
X! 			sprintf (cmd, "/usr/bin/look -df %s %s", grepstr, WORDS);
X! #else
X! 		sprintf (cmd, "%s '^%s$' %s", EGREPCMD, grepstr, WORDS);
X! #endif
X  		shellescape (cmd);
X  	}
X  }
X
X--- 902,916 -----
X  			*g++ = *s;
X  	*g = '\0';
X  	if (grepstr[0]) {
X! 		if (!wild && look) {
X! 			/* no wild and look(1) is possibly available */
X! 			sprintf (cmd, "look -df %s %s", grepstr, WORDS);
X! 			if (shellescape (cmd)) return;
X! 			else look = 0;
X! 		}
X! 		/* string has wild card chars or look not avail */
X! 		if (!wild) strcat(grepstr, ".*");	/* work like look */
X! 		sprintf (cmd, "%s ^%s$ %s", EGREPCMD, grepstr, WORDS);
X  		shellescape (cmd);
X  	}
X  }
SHAR_EOF
fi
if test -f 'ispell.h.diff'
then
	echo shar: "will not over-write existing file 'ispell.h.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'ispell.h.diff'
X*** ispell.h_orig	Tue Mar 24 23:50:40 1987
X--- ispell.h	Sun Mar 29 16:08:49 1987
X***************
X*** 1,6
X  /* -*- Mode: Text -*- */
X  
X! #define LIBDIR "/tmp2/lib"
X  
X  struct dent {
X  	struct dent *next;
X
X--- 1,8 -----
X  /* -*- Mode: Text -*- */
X  
X! #ifndef	LIBDIR
X! #define LIBDIR "/usr/local/lib"
X! #endif
X  
X  struct dent {
X  	struct dent *next;
SHAR_EOF
fi
if test -f 'term.c.diff'
then
	echo shar: "will not over-write existing file 'term.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'term.c.diff'
X*** term.c_orig	Tue Mar 24 23:50:52 1987
X--- term.c	Sun Mar 29 17:56:15 1987
X***************
X*** 177,182
X  	signal(signo, onstop);
X  	ioctl (0, TIOCSETP, &sbuf);
X  }
X  
X  stop ()
X  {
X
X--- 177,183 -----
X  	signal(signo, onstop);
X  	ioctl (0, TIOCSETP, &sbuf);
X  }
X+ #endif
X  
X  stop ()
X  {
X***************
X*** 180,185
X  
X  stop ()
X  {
X  	onstop (SIGTSTP);
X  }
X  #endif
X
X--- 181,187 -----
X  
X  stop ()
X  {
X+ #ifndef USG
X  	onstop (SIGTSTP);
X  #else
X  	move (18, 0);
X***************
X*** 181,187
X  stop ()
X  {
X  	onstop (SIGTSTP);
X! }
X  #endif
X  
X  shellescape (buf)
X
X--- 183,192 -----
X  {
X  #ifndef USG
X  	onstop (SIGTSTP);
X! #else
X! 	move (18, 0);
X! 	fflush(stdout);
X! 	shellescape (getenv("SHELL"));
X  #endif
X  }
X  
X***************
X*** 183,188
X  	onstop (SIGTSTP);
X  }
X  #endif
X  
X  shellescape (buf)
X  char *buf;
X
X--- 188,194 -----
X  	fflush(stdout);
X  	shellescape (getenv("SHELL"));
X  #endif
X+ }
X  
X  int shellescape(buf)
X  char *buf;
X***************
X*** 184,190
X  }
X  #endif
X  
X! shellescape (buf)
X  char *buf;
X  {
X  #ifdef USG
X
X--- 190,196 -----
X  #endif
X  }
X  
X! int shellescape(buf)
X  char *buf;
X  {
X  	char *argv[100];
X***************
X*** 187,192
X  shellescape (buf)
X  char *buf;
X  {
X  #ifdef USG
X  	ioctl (0, TCSETAW, &osbuf);
X  	signal (SIGINT, SIG_IGN);
X
X--- 193,212 -----
X  int shellescape(buf)
X  char *buf;
X  {
X+ 	char *argv[100];
X+ 	char *cp = buf;
X+ 	int i = 0;
X+ 	int termstat;
X+ 
X+ 	/* parse buf to args, destroying it in the process */
X+ 	while (*cp != (char) 0) {
X+ 		while (*cp == ' ' || *cp == '\t') ++cp;
X+ 		if (*cp == (char) 0) break;
X+ 		argv[i++] = cp;
X+ 		while (*cp != ' ' && *cp != '\t' && *cp != (char) 0) ++cp;
X+ 		if (*cp != (char) 0) *cp++ = (char) 0;
X+ 	}
X+ 	argv[i] = (char *) 0;
X  #ifdef USG
X  	ioctl (0, TCSETAW, &osbuf);
X  	signal (SIGINT, SIG_IGN);
X***************
X*** 199,204
X  	signal(SIGTTOU, SIG_DFL);
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X  
X  	system (buf);
X  
X
X--- 219,238 -----
X  	signal(SIGTTOU, SIG_DFL);
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X+ 	if ((i = fork()) == 0) {
X+ 		execvp(argv[0], argv);
X+ 		exit(123);
X+ 	} else if (i > 0) {
X+ 		while (wait(&termstat) != i);
X+ 		termstat = termstat == (123 << 8) ? 0 : -1;
X+ 	} else termstat = -1;
X+ #ifndef USG
X+ 	signal(SIGTTIN, onstop);
X+ 	signal(SIGTTOU, onstop);
X+ 	signal(SIGTSTP, onstop);
X+ #endif
X+ 	signal (SIGINT, done);
X+ 	signal (SIGQUIT, SIG_DFL);
X  
X  #ifdef USG
X  	ioctl (0, TCSETAW, &sbuf);
X***************
X*** 200,206
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X  
X! 	system (buf);
X  
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X
X--- 234,251 -----
X  	signal (SIGINT, done);
X  	signal (SIGQUIT, SIG_DFL);
X  
X! #ifdef USG
X! 	ioctl (0, TCSETAW, &sbuf);
X! #else
X! 	ioctl (0, TIOCSETP, &sbuf);
X! #endif
X! 	if (termstat) {
X! 		printf ("\n-- Type space to continue --");
X! 		i = getchar ();
X! 		if (i != ' ' && i != '\n' && i != '\r') ungetc(i, stdin);
X! 	}
X! 	return (termstat);
X! }
X  
X  #ifdef	USESH
X  shescape (buf)
X***************
X*** 202,207
X  
X  	system (buf);
X  
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X  	signal(SIGTTOU, onstop);
X
X--- 247,271 -----
X  	return (termstat);
X  }
X  
X+ #ifdef	USESH
X+ shescape (buf)
X+ char *buf;
X+ {
X+ 	char ch;
X+ 
X+ #ifdef USG
X+ 	ioctl (0, TCSETAW, &osbuf);
X+ 	signal (SIGINT, SIG_IGN);
X+ 	signal (SIGQUIT, SIG_IGN);
X+ #else
X+ 	ioctl (0, TIOCSETP, &osbuf);
X+ 	signal (SIGINT, 1);
X+ 	signal (SIGQUIT, 1);
X+ 	signal(SIGTTIN, SIG_DFL);
X+ 	signal(SIGTTOU, SIG_DFL);
X+ 	signal(SIGTSTP, SIG_DFL);
X+ #endif
X+ 	system (buf);
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X  	signal(SIGTTOU, onstop);
X***************
X*** 216,220
X  	ioctl (0, TIOCSETP, &sbuf);
X  #endif
X  	printf ("\n-- Type space to continue --");
X! 	getchar ();
X  }
X
X--- 280,286 -----
X  	ioctl (0, TIOCSETP, &sbuf);
X  #endif
X  	printf ("\n-- Type space to continue --");
X! 	ch = getchar ();
X! 	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X  #endif
X***************
X*** 218,220
X  	printf ("\n-- Type space to continue --");
X  	getchar ();
X  }
X
X--- 283,286 -----
X  	ch = getchar ();
X  	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X+ #endif
SHAR_EOF
fi
exit 0
#	End of shell archive

george@rebel.UUCP (George M. Sipe) (04/17/87)

These changes add improvements, no bug fixes.  See "Contents" for more
information.  Note that this is a reposting from my March 30 original
(it is very possible that the original posting didn't make it to most
sites).

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	Contents
#	config.h
#	ispell.c.diff
#	ispell.h.diff
#	term.c.diff
# This archive created: Sun Mar 29 23:31:59 1987
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'Contents'
then
	echo shar: "will not over-write existing file 'Contents'"
else
sed 's/^X//' << \SHAR_EOF > 'Contents'
XEnclosed in this shar are diffs to ispell.c, ispell.h, and term.c in
Xaddition to a replacement config.h for the recently release version of
Xispell as modified (most recently) by Geoff Kuenning.
X
XThis update greatly speeds up child process invocation by replacing
Xsystem() with direct fork()/exec() to the necessary process.  This
Xaffects the "L" command, "^Z" under System V (which now spawns a
Xsubshell), and the "!" shell escape command.  Since "!" does not
Xactually go to a shell, only one command may be entered (without the
Xusual shell syntax escapes).  If you really want a shell, you can (1)
X!sh, (2) ^Z, or (3) compile ispell.c with USESH defined.
X
XThis update also allows BAKEXT to be defined as an alternative to the
Xdefault ".bak" backup extension.  If defined (even as ".bak"), then the
Xfull extension will be used even if the filename has to be shortened.
X
XThis update will automatically use look(1) if it is available and the
Xlookup string doesn't contain wild card characters.  This allows
Xdistribution on System V systems upon which look availability may
Xvary.
X
XThis update allows a non-space to be entered to "---Type..." prompts
Xwhich will be used as the next command.
X
XFinally, this update includes an improved config.h and diff to ispell.h
Xwhich allow most #defines to be supplied on the compile command line.
XIf present, then the defaults in the *.h files will not be used.
X
XIf you have any comments on this update, please mail them to me at the
Xaddress below.  Note that I'll be on vacation until 4/20, so please
Xdon't expect a prompt reply!
X
XUUCP:	...ihnp4!akgua!rebel!george
X	...{hplabs,seismo}!gatech!rebel!george
XPhone:	(404) 662-1533
XSnail:	Tolerant Systems, 6961 Peachtree Industrial, Norcross, GA  30071
SHAR_EOF
fi
if test -f 'config.h'
then
	echo shar: "will not over-write existing file 'config.h'"
else
sed 's/^X//' << \SHAR_EOF > 'config.h'
X/*
X** library directory for hash table(s) / default hash table name
X** If you intend to use multiple dictionary files, I would suggest
X** LIBDIR be a directory which will contain nothing else, so sensible
X** names can be constructed for the -d option without conflict.
X*/
X#ifndef	LIBDIR
X#define LIBDIR "/usr/local/lib/ispell"
X#endif
X#ifndef	DEFHASH
X#define DEFHASH "ispell.hash"
X#endif
X
X/* default dictionary file */
X#ifndef	DEFDICT
X#define DEFDICT "dict.191"
X#endif
X
X/* default word list */
X#ifndef	DEFPICT
X#define DEFPDICT ".ispell.words"
X#endif
X
X/* path to egrep (use speeded up version if available) */
X#ifndef	EGREPCMD
X#ifdef	USG
X#define EGREPCMD "egrep"
X#else
X#define EGREPCMD "egrep -i"
X#endif
X#endif
X
X/* path to wordlist for Lookup command (typically /usr/dict/{words|web2} */
X#ifndef	WORDS
X#define WORDS	"/usr/dict/words"
X#endif
X
X/* environment variable for user's word list */
X#ifndef	PDICTVAR
X#define PDICTVAR "WORDLIST"
X#endif
X
X/* Approximate number of words in the full dictionary, after munching.
X** Err on the high side unless you are very short on memory, in which
X** case you might want to change the tables in tree.c and also increase
X** MAXPCT.
X**
X** (Note:  dict.191 is a bit over 15000 words.  dict.191 munched with
X** /usr/dict/words is a little over 28000).
X*/
X#ifndef BIG_DICT
X#define BIG_DICT	29000
X#endif
X
X/*
X** Maximum hash table fullness percentage.  Larger numbers trade space
X** for time.
X**/
X#ifndef MAXPCT
X#define MAXPCT	70		/* Expand table when 70% full */
X#endif
X
X/* buffer size to use for file names if not in sys/param.h */
X#ifndef MAXPATHLEN
X#define MAXPATHLEN 240
X#endif
X
X/* maximum filename length */
X#ifndef	MAXNAMLEN
X#define	MAXNAMLEN	14
X#endif
X
X/* extension for backup files */
X#ifndef	BAKEXT
X#define	BAKEXT	".bak"
X#endif
X
X/* mktemp template for temporary file - MUST contain 6 consecutive X's */
X#define TEMPNAME "/tmp/spellXXXXXX"
X
X/* word length allowed in dictionary by buildhash */
X#define WORDLEN 30
X
X/* hash table magic number */
X#define MAGIC 1
X
X/* define index for System V systems */
X#ifdef	USG
X#define	index	strchr
X#define	rindex	strrchr
X#endif
X
X/*
X** the isXXXX macros normally only check ASCII range.  These are used
X** instead for text characters, which we assume may be 8 bit.  The
X** NO8BIT ifdef	shuts off significance of 8 bit characters.  If you are
X** using this, and your ctype.h already masks, you can simplify.
X*/
X#ifdef	NO8BIT
X#define myupper(X) isupper((X)&0x7f)
X#define mylower(X) islower((X)&0x7f)
X#define myspace(X) isspace((X)&0x7f)
X#define myalpha(X) isalpha((X)&0x7f)
X#else
X#define myupper(X) (!((X)&0x80) && isupper(X))
X#define mylower(X) (!((X)&0x80) && islower(X))
X#define myspace(X) (!((X)&0x80) && isspace(X))
X#define myalpha(X) (!((X)&0x80) && isalpha(X))
X#endif
X
X/*
X** the NOPARITY mask is applied to user input characters from the terminal
X** in order to mask out the parity bit.
X*/
X#define NOPARITY 0x7f
SHAR_EOF
fi
if test -f 'ispell.c.diff'
then
	echo shar: "will not over-write existing file 'ispell.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'ispell.c.diff'
X*** ispell.c_orig	Tue Mar 24 23:50:33 1987
X--- ispell.c	Sun Mar 29 17:12:13 1987
X***************
X*** 17,22
X   *	-c option for creating suffix suggestions from raw words
X   *	suffixes in personal dictionary file
X   *	hashed personal dictionary file
X   */
X  
X  #include <stdio.h>
X
X--- 17,25 -----
X   *	-c option for creating suffix suggestions from raw words
X   *	suffixes in personal dictionary file
X   *	hashed personal dictionary file
X+  * 1987, George Sipe, added:
X+  *	fast shellescape() handling, flexible .bak handling, improved
X+  *	config.h, automatic use of look
X   */
X  
X  #include <stdio.h>
X***************
X*** 51,56
X  
X  givehelp ()
X  {
X  	erase ();
X  	printf ("Whenever a word is found that is not in the dictionary,\r\n");
X  	printf ("it is printed on the first line of the screen.  If the dictionary\r\n");
X
X--- 54,61 -----
X  
X  givehelp ()
X  {
X+ 	char ch;
X+ 
X  	erase ();
X  	printf ("Whenever a word is found that is not in the dictionary,\r\n");
X  	printf ("it is printed on the first line of the screen.  If the dictionary\r\n");
X***************
X*** 60,66
X  	printf ("\r\n");
X  	printf ("Commands are:\r\n\r\n");
X  	printf ("R       Replace the misspelled word completely.\r\n");
X! 	printf ("Space   Accept the word this time only\r\n");
X  	printf ("A       Accept the word for the rest of this file.\r\n");
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X
X--- 65,71 -----
X  	printf ("\r\n");
X  	printf ("Commands are:\r\n\r\n");
X  	printf ("R       Replace the misspelled word completely.\r\n");
X! 	printf ("Space   Accept the word this time only.\r\n");
X  	printf ("A       Accept the word for the rest of this file.\r\n");
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X***************
X*** 65,71
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X  	printf ("L       Look up words in system dictionary.\r\n");
X! 	printf ("Q       Write the rest of this file, ignoring misspellings, ");
X  	printf (         "and start next file.\r\n");
X  	printf ("X       Exit immediately.  Asks for confirmation.  ");
X  	printf (         "Leaves file unchanged.\r\n");
X
X--- 70,76 -----
X  	printf ("I       Accept the word, and put it in your private dictionary.\r\n");
X  	printf ("0-9     Replace with one of the suggested words.\r\n");
X  	printf ("L       Look up words in system dictionary.\r\n");
X! 	printf ("Q       Write rest of this file, ignoring misspellings, ");
X  	printf (         "and start next file.\r\n");
X  	printf ("X       Exit immediately.  Asks for confirmation.  ");
X  	printf (         "Leaves file unchanged.\r\n");
X***************
X*** 71,76
X  	printf (         "Leaves file unchanged.\r\n");
X  	printf ("!       Shell escape.\r\n");
X  	printf ("^L      Redraw screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X  	fflush (stdout);
X
X--- 76,83 -----
X  	printf (         "Leaves file unchanged.\r\n");
X  	printf ("!       Shell escape.\r\n");
X  	printf ("^L      Redraw screen.\r\n");
X+ 	printf ("^Z      Suspend program.\r\n");
X+ 	printf ("?       Show this help screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X  	ch = getchar ();
X***************
X*** 73,80
X  	printf ("^L      Redraw screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X! 	fflush (stdout);
X! 	getchar ();
X  }
X  
X  
X
X--- 80,87 -----
X  	printf ("?       Show this help screen.\r\n");
X  	printf ("\r\n\r\n");
X  	printf ("-- Type space to continue --");
X! 	ch = getchar ();
X! 	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X  
X  
X***************
X*** 274,280
X  char *filename;
X  {
X  	int c;
X! 	char	bakfile[256];
X  
X  	currentfile = filename;
X  
X
X--- 281,287 -----
X  char *filename;
X  {
X  	int c;
X! 	char	bakfile[MAXPATHLEN];
X  
X  	currentfile = filename;
X  
X***************
X*** 314,319
X  		return;
X  	}
X  
X  	sprintf(bakfile, "%s.bak", filename);
X  	if(link(filename, bakfile) == 0)
X  		unlink(filename);
X
X--- 321,327 -----
X  		return;
X  	}
X  
X+ #ifndef	BAKEXT
X  	sprintf(bakfile, "%s.bak", filename);
X  #else
X  	strcpy(bakfile, filename);
X***************
X*** 315,322
X  	}
X  
X  	sprintf(bakfile, "%s.bak", filename);
X! 	if(link(filename, bakfile) == 0)
X! 		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X
X--- 323,333 -----
X  
X  #ifndef	BAKEXT
X  	sprintf(bakfile, "%s.bak", filename);
X! #else
X! 	strcpy(bakfile, filename);
X! 	if (strcmp(BAKEXT, filename + strlen(filename) - strlen(BAKEXT)) != 0) {
X! 		register char *top;
X! 		register int maxlen;
X  
X  		maxlen = MAXNAMLEN - strlen(BAKEXT);
X  		top = (char *) rindex(bakfile, '/');
X***************
X*** 318,323
X  	if(link(filename, bakfile) == 0)
X  		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X
X--- 329,343 -----
X  		register char *top;
X  		register int maxlen;
X  
X+ 		maxlen = MAXNAMLEN - strlen(BAKEXT);
X+ 		top = (char *) rindex(bakfile, '/');
X+ 		top = top ? top + 1 : bakfile;
X+ 		if (strlen(top) > maxlen)
X+ 			*(top + maxlen) = '\000';
X+ 		strcat(bakfile, BAKEXT);
X+ 	}
X+ #endif
X+ 
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if (link (filename, bakfile) == 0) unlink (filename);
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X***************
X*** 319,324
X  		unlink(filename);
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X  		sleep (2);
X
X--- 339,345 -----
X  #endif
X  
X  	/* if we can't write new, preserve .bak regardless of xflag */
X+ 	if (link (filename, bakfile) == 0) unlink (filename);
X  	if ((outfile = fopen (filename, "w")) == NULL) {
X  		fprintf (stderr, "can't create %s\r\n", filename);
X  		sleep (2);
X***************
X*** 480,486
X  
X  	while (1) {
X  		switch (c = (getchar () & NOPARITY)) {
X- #ifndef USG
X  		case 'Z' & 037:
X  			stop ();
X  			erase ();
X
X--- 501,506 -----
X  
X  	while (1) {
X  		switch (c = (getchar () & NOPARITY)) {
X  		case 'Z' & 037:
X  			stop ();
X  			erase ();
X***************
X*** 485,491
X  			stop ();
X  			erase ();
X  			goto checkagain;
X- #endif
X  		case ' ':
X  			erase ();
X  			return;
X
X--- 505,510 -----
X  			stop ();
X  			erase ();
X  			goto checkagain;
X  		case ' ':
X  			erase ();
X  			return;
X***************
X*** 490,496
X  			erase ();
X  			return;
X  		case 'x': case 'X':
X! 			printf ("Are you sure you want to throw away your changes? ");
X  			c = (getchar () & NOPARITY);
X  			if (c == 'y' || c == 'Y') {
X  				erase ();
X
X--- 509,515 -----
X  			erase ();
X  			return;
X  		case 'x': case 'X':
X! 			printf ("\nAre you sure you want to throw away your changes? ");
X  			c = (getchar () & NOPARITY);
X  			if (c == 'y' || c == 'Y') {
X  				erase ();
X***************
X*** 522,527
X  					goto checkagain;
X  				}
X  				printf ("\r\n");
X  				shellescape (buf);
X  				erase ();
X  				goto checkagain;
X
X--- 541,549 -----
X  					goto checkagain;
X  				}
X  				printf ("\r\n");
X+ #ifdef	USESH
X+ 				shescape (buf);
X+ #else
X  				shellescape (buf);
X  #endif
X  				erase ();
X***************
X*** 523,528
X  				}
X  				printf ("\r\n");
X  				shellescape (buf);
X  				erase ();
X  				goto checkagain;
X  			}
X
X--- 545,551 -----
X  				shescape (buf);
X  #else
X  				shellescape (buf);
X+ #endif
X  				erase ();
X  				goto checkagain;
X  			}
X***************
X*** 867,872
X  	char cmd[150];
X  	char *g, *s, grepstr[100];
X  	int wild = 0;
X  
X  	g = grepstr;
X  	for (s = string; *s != '\0'; s++)
X
X--- 890,896 -----
X  	char cmd[150];
X  	char *g, *s, grepstr[100];
X  	int wild = 0;
X+ 	static int look = -1;
X  
X  	g = grepstr;
X  	for (s = string; *s != '\0'; s++)
X***************
X*** 878,893
X  			*g++ = *s;
X  	*g = '\0';
X  	if (grepstr[0]) {
X! #ifdef LOOK
X! 		if (wild)
X! 			/* string has wild card characters */
X! 			sprintf (cmd, "%s '^%s$' %s", EGREPCMD, grepstr, WORDS);
X! 		else
X! 			/* no wild, use look(1) */
X! 			sprintf (cmd, "/usr/bin/look -df %s %s", grepstr, WORDS);
X! #else
X! 		sprintf (cmd, "%s '^%s$' %s", EGREPCMD, grepstr, WORDS);
X! #endif
X  		shellescape (cmd);
X  	}
X  }
X
X--- 902,916 -----
X  			*g++ = *s;
X  	*g = '\0';
X  	if (grepstr[0]) {
X! 		if (!wild && look) {
X! 			/* no wild and look(1) is possibly available */
X! 			sprintf (cmd, "look -df %s %s", grepstr, WORDS);
X! 			if (shellescape (cmd)) return;
X! 			else look = 0;
X! 		}
X! 		/* string has wild card chars or look not avail */
X! 		if (!wild) strcat(grepstr, ".*");	/* work like look */
X! 		sprintf (cmd, "%s ^%s$ %s", EGREPCMD, grepstr, WORDS);
X  		shellescape (cmd);
X  	}
X  }
SHAR_EOF
fi
if test -f 'ispell.h.diff'
then
	echo shar: "will not over-write existing file 'ispell.h.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'ispell.h.diff'
X*** ispell.h_orig	Tue Mar 24 23:50:40 1987
X--- ispell.h	Sun Mar 29 16:08:49 1987
X***************
X*** 1,6
X  /* -*- Mode: Text -*- */
X  
X! #define LIBDIR "/tmp2/lib"
X  
X  struct dent {
X  	struct dent *next;
X
X--- 1,8 -----
X  /* -*- Mode: Text -*- */
X  
X! #ifndef	LIBDIR
X! #define LIBDIR "/usr/local/lib"
X! #endif
X  
X  struct dent {
X  	struct dent *next;
SHAR_EOF
fi
if test -f 'term.c.diff'
then
	echo shar: "will not over-write existing file 'term.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'term.c.diff'
X*** term.c_orig	Tue Mar 24 23:50:52 1987
X--- term.c	Sun Mar 29 17:56:15 1987
X***************
X*** 177,182
X  	signal(signo, onstop);
X  	ioctl (0, TIOCSETP, &sbuf);
X  }
X  
X  stop ()
X  {
X
X--- 177,183 -----
X  	signal(signo, onstop);
X  	ioctl (0, TIOCSETP, &sbuf);
X  }
X+ #endif
X  
X  stop ()
X  {
X***************
X*** 180,185
X  
X  stop ()
X  {
X  	onstop (SIGTSTP);
X  }
X  #endif
X
X--- 181,187 -----
X  
X  stop ()
X  {
X+ #ifndef USG
X  	onstop (SIGTSTP);
X  #else
X  	move (18, 0);
X***************
X*** 181,187
X  stop ()
X  {
X  	onstop (SIGTSTP);
X! }
X  #endif
X  
X  shellescape (buf)
X
X--- 183,192 -----
X  {
X  #ifndef USG
X  	onstop (SIGTSTP);
X! #else
X! 	move (18, 0);
X! 	fflush(stdout);
X! 	shellescape (getenv("SHELL"));
X  #endif
X  }
X  
X***************
X*** 183,188
X  	onstop (SIGTSTP);
X  }
X  #endif
X  
X  shellescape (buf)
X  char *buf;
X
X--- 188,194 -----
X  	fflush(stdout);
X  	shellescape (getenv("SHELL"));
X  #endif
X+ }
X  
X  int shellescape(buf)
X  char *buf;
X***************
X*** 184,190
X  }
X  #endif
X  
X! shellescape (buf)
X  char *buf;
X  {
X  #ifdef USG
X
X--- 190,196 -----
X  #endif
X  }
X  
X! int shellescape(buf)
X  char *buf;
X  {
X  	char *argv[100];
X***************
X*** 187,192
X  shellescape (buf)
X  char *buf;
X  {
X  #ifdef USG
X  	ioctl (0, TCSETAW, &osbuf);
X  	signal (SIGINT, SIG_IGN);
X
X--- 193,212 -----
X  int shellescape(buf)
X  char *buf;
X  {
X+ 	char *argv[100];
X+ 	char *cp = buf;
X+ 	int i = 0;
X+ 	int termstat;
X+ 
X+ 	/* parse buf to args, destroying it in the process */
X+ 	while (*cp != (char) 0) {
X+ 		while (*cp == ' ' || *cp == '\t') ++cp;
X+ 		if (*cp == (char) 0) break;
X+ 		argv[i++] = cp;
X+ 		while (*cp != ' ' && *cp != '\t' && *cp != (char) 0) ++cp;
X+ 		if (*cp != (char) 0) *cp++ = (char) 0;
X+ 	}
X+ 	argv[i] = (char *) 0;
X  #ifdef USG
X  	ioctl (0, TCSETAW, &osbuf);
X  	signal (SIGINT, SIG_IGN);
X***************
X*** 199,204
X  	signal(SIGTTOU, SIG_DFL);
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X  
X  	system (buf);
X  
X
X--- 219,238 -----
X  	signal(SIGTTOU, SIG_DFL);
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X+ 	if ((i = fork()) == 0) {
X+ 		execvp(argv[0], argv);
X+ 		exit(123);
X+ 	} else if (i > 0) {
X+ 		while (wait(&termstat) != i);
X+ 		termstat = termstat == (123 << 8) ? 0 : -1;
X+ 	} else termstat = -1;
X+ #ifndef USG
X+ 	signal(SIGTTIN, onstop);
X+ 	signal(SIGTTOU, onstop);
X+ 	signal(SIGTSTP, onstop);
X+ #endif
X+ 	signal (SIGINT, done);
X+ 	signal (SIGQUIT, SIG_DFL);
X  
X  #ifdef USG
X  	ioctl (0, TCSETAW, &sbuf);
X***************
X*** 200,206
X  	signal(SIGTSTP, SIG_DFL);
X  #endif
X  
X! 	system (buf);
X  
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X
X--- 234,251 -----
X  	signal (SIGINT, done);
X  	signal (SIGQUIT, SIG_DFL);
X  
X! #ifdef USG
X! 	ioctl (0, TCSETAW, &sbuf);
X! #else
X! 	ioctl (0, TIOCSETP, &sbuf);
X! #endif
X! 	if (termstat) {
X! 		printf ("\n-- Type space to continue --");
X! 		i = getchar ();
X! 		if (i != ' ' && i != '\n' && i != '\r') ungetc(i, stdin);
X! 	}
X! 	return (termstat);
X! }
X  
X  #ifdef	USESH
X  shescape (buf)
X***************
X*** 202,207
X  
X  	system (buf);
X  
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X  	signal(SIGTTOU, onstop);
X
X--- 247,271 -----
X  	return (termstat);
X  }
X  
X+ #ifdef	USESH
X+ shescape (buf)
X+ char *buf;
X+ {
X+ 	char ch;
X+ 
X+ #ifdef USG
X+ 	ioctl (0, TCSETAW, &osbuf);
X+ 	signal (SIGINT, SIG_IGN);
X+ 	signal (SIGQUIT, SIG_IGN);
X+ #else
X+ 	ioctl (0, TIOCSETP, &osbuf);
X+ 	signal (SIGINT, 1);
X+ 	signal (SIGQUIT, 1);
X+ 	signal(SIGTTIN, SIG_DFL);
X+ 	signal(SIGTTOU, SIG_DFL);
X+ 	signal(SIGTSTP, SIG_DFL);
X+ #endif
X+ 	system (buf);
X  #ifndef USG
X  	signal(SIGTTIN, onstop);
X  	signal(SIGTTOU, onstop);
X***************
X*** 216,220
X  	ioctl (0, TIOCSETP, &sbuf);
X  #endif
X  	printf ("\n-- Type space to continue --");
X! 	getchar ();
X  }
X
X--- 280,286 -----
X  	ioctl (0, TIOCSETP, &sbuf);
X  #endif
X  	printf ("\n-- Type space to continue --");
X! 	ch = getchar ();
X! 	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X  #endif
X***************
X*** 218,220
X  	printf ("\n-- Type space to continue --");
X  	getchar ();
X  }
X
X--- 283,286 -----
X  	ch = getchar ();
X  	if (ch != ' ' && ch != '\n' && ch != '\r') ungetc(ch, stdin);
X  }
X+ #endif
SHAR_EOF
fi
exit 0
#	End of shell archive