*** /old/src/etc/restor/restor.c	Mon Apr 30 09:22:05 1990
--- /usr/src/etc/restor/restor.c	Sat Apr 13 17:02:58 1991
***************
*** 107,113 ****
  extern  long lseek();
  
  main(argc, argv)
! char *argv[];
  {
  	register char *cp;
  	char command;
--- 107,113 ----
  extern  long lseek();
  
  main(argc, argv)
! register char *argv[];
  {
  	register char *cp;
  	char command;
***************
*** 179,185 ****
  	int	xtrfile(), skip(), null();
  #endif
  	int	rstrfile(), rstrskip();
! 	struct dinode *ip, *ip1;
  
  #ifndef STANDALONE
  	if ((mt = open(magtape, 0)) < 0) {
--- 179,185 ----
  	int	xtrfile(), skip(), null();
  #endif
  	int	rstrfile(), rstrskip();
! 	register struct dinode *ip, *ip1;
  
  #ifndef STANDALONE
  	if ((mt = open(magtape, 0)) < 0) {
***************
*** 633,639 ****
  char	*n;
  {
  	register char *cp, *cp1;
! 	char c;
  
  	ino = ROOTINO;
  	if (*(cp = n) == '/')
--- 633,639 ----
  char	*n;
  {
  	register char *cp, *cp1;
! 	register char c;
  
  	ino = ROOTINO;
  	if (*(cp = n) == '/')
***************
*** 863,869 ****
  daddr_t	bn;
  {
  	register i;
! 	int j, sh;
  	daddr_t nb, nnb;
  	daddr_t indir[NINDIR];
  
--- 863,869 ----
  daddr_t	bn;
  {
  	register i;
! 	register int j, sh;
  	daddr_t nb, nnb;
  	daddr_t indir[NINDIR];
  
***************
*** 1229,1235 ****
   * read a bit mask from the tape into m.
   */
  readbits(m)
! short	*m;
  {
  	register i;
  
--- 1229,1235 ----
   * read a bit mask from the tape into m.
   */
  readbits(m)
! register short	*m;
  {
  	register i;
  
*** /old/src/etc/rshd/rshd.c	Sat Oct  7 13:23:54 1989
--- /usr/src/etc/rshd/rshd.c	Mon May 18 05:09:33 1992
***************
*** 49,54 ****
--- 49,56 ----
  #include <pwd.h>
  #include <netdb.h>
  #include <syslog.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
  #include "pathnames.h"
  
  int	errno;
***************
*** 236,241 ****
--- 238,246 ----
  		if (check_all || local_domain(hp->h_name)) {
  			strncpy(remotehost, hp->h_name, sizeof(remotehost) - 1);
  			remotehost[sizeof(remotehost) - 1] = 0;
+ #ifdef	RES_DNSRCH
+ 			_res.options &= ~RES_DNSRCH;
+ #endif
  			hp = gethostbyname(remotehost);
  			if (hp == NULL) {
  				syslog(LOG_INFO,
*** /old/src/etc/swapon.c	Sun Feb 15 22:52:32 1987
--- /usr/src/etc/swapon.c	Fri Jan 10 15:25:43 1992
***************
*** 1,5 ****
  main()
  {
! 	puts("swapon hasn't been implemented under 2.10BSD.");
  	exit(-1);
  }
--- 1,5 ----
  main()
  {
! 	puts("swapon hasn't been implemented under 2.11BSD.");
  	exit(-1);
  }
*** /old/src/etc/tftpd/tftpd.c	Thu Jul 30 22:40:39 1987
--- /usr/src/etc/tftpd/tftpd.c	Wed May 15 21:37:45 1991
***************
*** 1,7 ****
  /*
   * Copyright (c) 1983 Regents of the University of California.
!  * All rights reserved.  The Berkeley software License Agreement
!  * specifies the terms and conditions for redistribution.
   */
  
  #ifndef lint
--- 1,20 ----
  /*
   * Copyright (c) 1983 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that: (1) source distributions retain this entire copyright
!  * notice and comment, and (2) distributions including binaries display
!  * the following acknowledgement:  ``This product includes software
!  * developed by the University of California, Berkeley and its contributors''
!  * in the documentation or other materials provided with the distribution
!  * and in all advertising materials mentioning features or use of this
!  * software. Neither the name of the University nor the names of its
!  * contributors may be used to endorse or promote products derived
!  * from this software without specific prior written permission.
!  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
!  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
!  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
   */
  
  #ifndef lint
***************
*** 8,18 ****
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
! #endif not lint
  
  #ifndef lint
! static char sccsid[] = "@(#)tftpd.c	5.6 (Berkeley) 5/13/86";
! #endif not lint
  
  #ifdef	BSD2_10
  #define	timeoutbuf	to_buf
--- 21,31 ----
  char copyright[] =
  "@(#) Copyright (c) 1983 Regents of the University of California.\n\
   All rights reserved.\n";
! #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)tftpd.c	5.12 (Berkeley) 6/1/90";
! #endif /* not lint */
  
  #ifdef	BSD2_10
  #define	timeoutbuf	to_buf
***************
*** 29,46 ****
  #include <sys/ioctl.h>
  #include <sys/wait.h>
  #include <sys/stat.h>
  
  #include <netinet/in.h>
  
  #include <arpa/tftp.h>
  
! #include <signal.h>
  #include <stdio.h>
  #include <errno.h>
  #include <ctype.h>
- #include <netdb.h>
- #include <setjmp.h>
  #include <syslog.h>
  
  #define	TIMEOUT		5
  
--- 42,60 ----
  #include <sys/ioctl.h>
  #include <sys/wait.h>
  #include <sys/stat.h>
+ #include <sys/signal.h>
  
  #include <netinet/in.h>
  
  #include <arpa/tftp.h>
  
! #include <netdb.h>
! #include <setjmp.h>
  #include <stdio.h>
  #include <errno.h>
  #include <ctype.h>
  #include <syslog.h>
+ #include <string.h>
  
  #define	TIMEOUT		5
  
***************
*** 56,67 ****
  struct	sockaddr_in from;
  int	fromlen;
  
! main()
  {
  	register struct tftphdr *tp;
! 	register int n;
  	int on = 1;
  
  	openlog("tftpd", LOG_PID, LOG_DAEMON);
  	if (ioctl(0, FIONBIO, &on) < 0) {
  		syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
--- 70,88 ----
  struct	sockaddr_in from;
  int	fromlen;
  
! #define MAXARG	4
! char	*dirs[MAXARG+1];
! 
! main(ac, av)
! 	char **av;
  {
  	register struct tftphdr *tp;
! 	register int n = 0;
  	int on = 1;
  
+ 	ac--; av++;
+ 	while (ac-- > 0 && n < MAXARG)
+ 		dirs[n++] = *av++;
  	openlog("tftpd", LOG_PID, LOG_DAEMON);
  	if (ioctl(0, FIONBIO, &on) < 0) {
  		syslog(LOG_ERR, "ioctl(FIONBIO): %m\n");
***************
*** 224,229 ****
--- 245,253 ----
   * have no uid or gid, for now require
   * file to exist and be publicly
   * readable/writable.
+  * If we were invoked with arguments
+  * from inetd then the file must also be
+  * in one of the given directory prefixes.
   * Note also, full path name must be
   * given as we have no login directory.
   */
***************
*** 233,241 ****
--- 257,277 ----
  {
  	struct stat stbuf;
  	int	fd;
+ 	char *cp, **dirp;
  
  	if (*filename != '/')
  		return (EACCESS);
+ 	/*
+ 	 * prevent tricksters from getting around the directory restrictions
+ 	 */
+ 	for (cp = filename + 1; *cp; cp++)
+ 		if(*cp == '.' && strncmp(cp-1, "/../", 4) == 0)
+ 			return(EACCESS);
+ 	for (dirp = dirs; *dirp; dirp++)
+ 		if (strncmp(filename, *dirp, strlen(*dirp)) == 0)
+ 			break;
+ 	if (*dirp==0 && dirp!=dirs)
+ 		return (EACCESS);
  	if (stat(filename, &stbuf) < 0)
  		return (errno == ENOENT ? ENOTFOUND : EACCESS);
  	if (mode == RRQ) {
***************
*** 437,443 ****
  	register struct tftphdr *tp;
  	int length;
  	register struct errmsg *pe;
- 	extern char *sys_errlist[];
  
  	tp = (struct tftphdr *)buf;
  	tp->th_opcode = htons((u_short)ERROR);
--- 473,478 ----
***************
*** 446,452 ****
  		if (pe->e_code == error)
  			break;
  	if (pe->e_code < 0) {
! 		pe->e_msg = sys_errlist[error - 100];
  		tp->th_code = EUNDEF;   /* set 'undef' errorcode */
  	}
  	strcpy(tp->th_msg, pe->e_msg);
--- 481,487 ----
  		if (pe->e_code == error)
  			break;
  	if (pe->e_code < 0) {
! 		pe->e_msg = strerror(error - 100);
  		tp->th_code = EUNDEF;   /* set 'undef' errorcode */
  	}
  	strcpy(tp->th_msg, pe->e_msg);
*** /old/src/etc/tunefs.c	Sun Feb 15 23:29:08 1987
--- /usr/src/etc/tunefs.c	Fri Jan 10 15:25:39 1992
***************
*** 1,5 ****
  main()
  {
! 	puts("tunefs hasn't been implemented under 2.10BSD.");
  	exit(-1);
  }
--- 1,5 ----
  main()
  {
! 	puts("tunefs hasn't been implemented under 2.11BSD.");
  	exit(-1);
  }
*** /old/src/games/backgammon/message.c	Tue Jun  5 17:34:19 1990
--- /usr/src/games/backgammon/message.c	Tue Dec 17 16:13:22 1991
***************
*** 10,15 ****
  #endif not lint
  
  char	*message[] = {
! 	"Last update on Tuesday, June 5, 1990.",
  	0
  };
--- 10,15 ----
  #endif not lint
  
  char	*message[] = {
! 	"Last update on Tuesday, December 17, 1991.",
  	0
  };
*** /old/src/games/warp/Makefile	Tue Jun  5 17:29:53 1990
--- /usr/src/games/warp/Makefile	Wed Dec 25 00:08:20 1991
***************
*** 12,22 ****
  #
  CC = cc
  bin = /usr/games
! mansrc = /usr/man/man6
! manext = 6
! CFLAGS =  -O
  LDFLAGS = 
! CHOWNER = daemon
  privlib = /usr/games/lib/warp
  NDIRC = 
  NDIRO = 
--- 12,22 ----
  #
  CC = cc
  bin = /usr/games
! mansrc = /tmp
! manext = 1
! CFLAGS = -O -O
  LDFLAGS = 
! CHOWNER = bin
  privlib = /usr/games/lib/warp
  NDIRC = 
  NDIRO = 
***************
*** 148,154 ****
  	cc sm.c $(SMALL) -o sm
  
  depend: makedepend
! 	makedepend
  
  clist:
  	echo $(c) | tr ' ' '\012' >.clist
--- 148,154 ----
  	cc sm.c $(SMALL) -o sm
  
  depend: makedepend
! 	./makedepend
  
  clist:
  	echo $(c) | tr ' ' '\012' >.clist
*** /old/src/games/warp/UU/filexp	Sat Aug 29 13:49:20 1987
--- /usr/src/games/warp/UU/filexp	Tue Dec 24 23:39:58 1991
***************
*** 2,8 ****
  : expand filename
  case "$1" in
   ~/*|~)
!     echo $1 | sed "s|~|${HOME-$LOGDIR}|"
      ;;
   ~*)
      if /bin/test -f /bin/csh; then
--- 2,8 ----
  : expand filename
  case "$1" in
   ~/*|~)
!     echo $1 | /bin/sed "s|~|${HOME-$LOGDIR}|"
      ;;
   ~*)
      if /bin/test -f /bin/csh; then
***************
*** 9,16 ****
  	/bin/csh -f -c "glob $1"
  	echo ""
      else
! 	name=`expr x$1 : '..\([^/]*\)'`
! 	dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
  	if /bin/test ! -d "$dir"; then
  	    me=`basename $0`
  	    echo "$me: can't locate home directory for: $name" >&2
--- 9,16 ----
  	/bin/csh -f -c "glob $1"
  	echo ""
      else
! 	name=`/bin/expr x$1 : '..\([^/]*\)'`
! 	dir=`/bin/sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
  	if /bin/test ! -d "$dir"; then
  	    me=`basename $0`
  	    echo "$me: can't locate home directory for: $name" >&2
***************
*** 18,24 ****
  	fi
  	case "$1" in
  	*/*)
! 	    echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
  	    ;;
  	*)
  	    echo $dir
--- 18,24 ----
  	fi
  	case "$1" in
  	*/*)
! 	    echo $dir/`/bin/expr x$1 : '..[^/]*/\(.*\)'`
  	    ;;
  	*)
  	    echo $dir
*** /old/src/games/warp/config.sh	Sat Aug 29 13:53:14 1987
--- /usr/src/games/warp/config.sh	Tue Dec 24 23:43:57 1991
***************
*** 19,37 ****
  uniq
  grep
  '
! expr='expr'
! sed='sed'
! echo='echo'
! cat='cat'
! rm='rm'
! mv='mv'
! cp='cp'
  tail=''
! tr='tr'
! mkdir='mkdir'
! sort='sort'
! uniq='uniq'
! grep='grep'
  trylist='
  test
  egrep
--- 19,37 ----
  uniq
  grep
  '
! expr='/bin/expr'
! sed='/bin/sed'
! echo='/bin/echo'
! cat='/bin/cat'
! rm='/bin/rm'
! mv='/bin/mv'
! cp='/bin/cp'
  tail=''
! tr='/usr/bin/tr'
! mkdir='/bin/mkdir'
! sort='/bin/sort'
! uniq='/usr/bin/uniq'
! grep='/usr/ucb/grep'
  trylist='
  test
  egrep
***************
*** 64,70 ****
  d_ioctl='define'
  d_normsig='define'
  jobslib=''
! d_portable='define'
  d_rdchk='/*undef'
  d_scorfl='/*undef'
  d_sgndchr='define'
--- 64,70 ----
  d_ioctl='define'
  d_normsig='define'
  jobslib=''
! d_portable='/*undef'
  d_rdchk='/*undef'
  d_scorfl='/*undef'
  d_sgndchr='define'
***************
*** 74,86 ****
  ndirc=''
  ndiro=''
  d_whoami='/*undef'
! hostname='kazoo'
  phostname='hostname'
! mydomain='.uucp'
  libc='/lib/libc.a'
  libnm='/usr/lib/libtermlib.a'
! mansrc='/usr/man/man6'
! manext='6'
  models='unsplit split'
  split='-i'
  small=''
--- 74,86 ----
  ndirc=''
  ndiro=''
  d_whoami='/*undef'
! hostname='sms'
  phostname='hostname'
! mydomain='.imsd.contel.com'
  libc='/lib/libc.a'
  libnm='/usr/lib/libtermlib.a'
! mansrc='/tmp'
! manext='1'
  models='unsplit split'
  split='-i'
  small=''
***************
*** 87,93 ****
  medium=''
  large=''
  huge=''
! ccflags=''
  ldflags=''
  n='-n'
  c=''
--- 87,93 ----
  medium=''
  large=''
  huge=''
! ccflags='-O'
  ldflags=''
  n='-n'
  c=''
***************
*** 123,128 ****
  startsh='#!/bin/sh'
  voidflags='7'
  bin='/usr/games'
! chowner='daemon'
  privlib='/usr/games/lib/warp'
  CONFIG=true
--- 123,128 ----
  startsh='#!/bin/sh'
  voidflags='7'
  bin='/usr/games'
! chowner='bin'
  privlib='/usr/games/lib/warp'
  CONFIG=true
*** /old/src/games/warp/filexp	Sat Aug 29 14:49:50 1987
--- /usr/src/games/warp/filexp	Tue Dec 24 23:39:59 1991
***************
*** 2,8 ****
  : expand filename
  case "$1" in
   ~/*|~)
!     echo $1 | sed "s|~|${HOME-$LOGDIR}|"
      ;;
   ~*)
      if /bin/test -f /bin/csh; then
--- 2,8 ----
  : expand filename
  case "$1" in
   ~/*|~)
!     echo $1 | /bin/sed "s|~|${HOME-$LOGDIR}|"
      ;;
   ~*)
      if /bin/test -f /bin/csh; then
***************
*** 9,16 ****
  	/bin/csh -f -c "glob $1"
  	echo ""
      else
! 	name=`expr x$1 : '..\([^/]*\)'`
! 	dir=`sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
  	if /bin/test ! -d "$dir"; then
  	    me=`basename $0`
  	    echo "$me: can't locate home directory for: $name" >&2
--- 9,16 ----
  	/bin/csh -f -c "glob $1"
  	echo ""
      else
! 	name=`/bin/expr x$1 : '..\([^/]*\)'`
! 	dir=`/bin/sed -n -e "/^${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e p -e q -e '}' </etc/passwd`
  	if /bin/test ! -d "$dir"; then
  	    me=`basename $0`
  	    echo "$me: can't locate home directory for: $name" >&2
***************
*** 18,24 ****
  	fi
  	case "$1" in
  	*/*)
! 	    echo $dir/`expr x$1 : '..[^/]*/\(.*\)'`
  	    ;;
  	*)
  	    echo $dir
--- 18,24 ----
  	fi
  	case "$1" in
  	*/*)
! 	    echo $dir/`/bin/expr x$1 : '..[^/]*/\(.*\)'`
  	    ;;
  	*)
  	    echo $dir
*** /old/src/games/warp/makedepend	Sat Aug 29 13:53:39 1987
--- /usr/src/games/warp/makedepend	Tue Dec 24 23:44:52 1991
***************
*** 17,35 ****
  
  export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  
! cat='cat'
! cp='cp'
  cpp='cc -E'
! echo='echo'
  egrep='/usr/bin/egrep'
! expr='expr'
! mv='mv'
! rm='rm'
! sed='sed'
! sort='sort'
  test='/bin/test'
! tr='tr'
! uniq='uniq'
  
  $cat /dev/null >.deptmp
  $echo "(Note: this is going to take a while.)"
--- 17,35 ----
  
  export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  
! cat='/bin/cat'
! cp='/bin/cp'
  cpp='cc -E'
! echo='/bin/echo'
  egrep='/usr/bin/egrep'
! expr='/bin/expr'
! mv='/bin/mv'
! rm='/bin/rm'
! sed='/bin/sed'
! sort='/bin/sort'
  test='/bin/test'
! tr='/usr/bin/tr'
! uniq='/usr/bin/uniq'
  
  $cat /dev/null >.deptmp
  $echo "(Note: this is going to take a while.)"
*** /old/src/games/warp/makedir	Sat Aug 29 13:53:43 1987
--- /usr/src/games/warp/makedir	Tue Dec 24 23:44:56 1991
***************
*** 16,22 ****
  
  case $# in
    0)
!     echo "makedir pathname filenameflag"
      exit 1
      ;;
  esac
--- 16,22 ----
  
  case $# in
    0)
!     /bin/echo "makedir pathname filenameflag"
      exit 1
      ;;
  esac
***************
*** 29,35 ****
  
  : strip last component if it is to be a filename
  case X$2 in
!   X1) set `echo $1 | sed 's:\(.*\)/[^/]*$:\1:'` ;;
    *)  set $1 ;;
  esac
  
--- 29,35 ----
  
  : strip last component if it is to be a filename
  case X$2 in
!   X1) set `/bin/echo $1 | /bin/sed 's:\(.*\)/[^/]*$:\1:'` ;;
    *)  set $1 ;;
  esac
  
***************
*** 43,49 ****
      case $1 in
      */*)
  	list="$1 $list"
! 	set `echo $1 | sed 's:\(.*\)/:\1 :'`
  	;;
      *)
  	break
--- 43,49 ----
      case $1 in
      */*)
  	list="$1 $list"
! 	set `echo $1 | /bin/sed 's:\(.*\)/:\1 :'`
  	;;
      *)
  	break
***************
*** 54,58 ****
  set $list
  
  for dir do
!     mkdir $dir >/dev/null 2>&1
  done
--- 54,58 ----
  set $list
  
  for dir do
!     /bin/mkdir $dir >/dev/null 2>&1
  done
*** /old/src/games/words/Makefile	Wed Jul  8 14:25:56 1987
--- /usr/src/games/words/Makefile	Tue Dec 17 21:58:53 1991
***************
*** 1,4 ****
- DESTDIR=/usr/games
  LIBDIR=/usr/games/lib
  
  all:	words1
--- 1,3 ----
***************
*** 8,14 ****
  
  install: words1 words.sh
  	install -s words1 ${LIBDIR}
! 	install -c words.sh ${DESTDIR}/words
  
  clean:
  	rm -f *.o words1
--- 7,13 ----
  
  install: words1 words.sh
  	install -s words1 ${LIBDIR}
! 	install -c words.sh ${DESTDIR}/usr/games/words
  
  clean:
  	rm -f *.o words1
*** /old/src/lib/c2/c2.h	Mon Oct 20 22:23:50 1986
--- /usr/src/lib/c2/c2.h	Tue Oct 29 14:08:45 1991
***************
*** 53,59 ****
  #define	CFCC	45
  #define	SOB	46
  #define	JSR	47
! #define	END	48
  
  #define	JEQ	0
  #define	JNE	1
--- 53,60 ----
  #define	CFCC	45
  #define	SOB	46
  #define	JSR	47
! #define	SWAB	48
! #define	END	49
  
  #define	JEQ	0
  #define	JNE	1
*** /old/src/lib/c2/c20.c	Mon Oct 20 22:23:50 1986
--- /usr/src/lib/c2/c20.c	Tue Oct 29 14:09:09 1991
***************
*** 37,42 ****
--- 37,43 ----
  	"bic",	BIC,
  	"bis",	BIS,
  	"mul",	MUL,
+ 	"div",	DIV,
  	"ash",	ASH,
  	"xor",	XOR,
  	".text",TEXT,
***************
*** 57,62 ****
--- 58,64 ----
  	"cfcc",	CFCC,
  	"sob",	SOB,
  	"jsr",	JSR,
+ 	"swab",	SWAB,
  	".end",	END,
  	0,	0};
  
***************
*** 92,106 ****
  			fprintf(stderr, "C2: can't find %s\n", argv[1]);
  			exit(1);
  		}
- 		setbuf(stdin,buf1);		/* sbrk problems */
  	}
  	if (argc>2) {
  		if (freopen(argv[2], "w", stdout) == NULL) {
  			fprintf(stderr, "C2: can't create %s\n", argv[2]);
  			exit(1);
  		}
- 		setbuf(stdout,buf2);		/* sbrk problems */
  	}
  	lasta = firstr = lastr = sbrk(sizeof(char *));
  	maxiter = 0;
  	opsetup();
--- 94,108 ----
  			fprintf(stderr, "C2: can't find %s\n", argv[1]);
  			exit(1);
  		}
  	}
+ 	setbuf(stdin,buf1);		/* sbrk problems */
  	if (argc>2) {
  		if (freopen(argv[2], "w", stdout) == NULL) {
  			fprintf(stderr, "C2: can't create %s\n", argv[2]);
  			exit(1);
  		}
  	}
+ 	setbuf(stdout,buf2);		/* sbrk problems */
  	lasta = firstr = lastr = sbrk(sizeof(char *));
  	maxiter = 0;
  	opsetup();
*** /old/src/lib/c2/c21.c	Mon Oct 20 22:23:50 1986
--- /usr/src/lib/c2/c21.c	Wed Mar 18 02:56:08 1992
***************
*** 31,36 ****
--- 31,37 ----
  				p->forw->back = p->back;
  				p->back->forw = p->forw;
  				redunm++;
+ 				nchange++;
  				continue;
  			}
  		}
***************
*** 39,44 ****
--- 40,46 ----
  			strcpy(regs[RT1], regs[RT2]);
  			regs[RT2][0] = 0;
  			p->code = copy(1, regs[RT1]);
+ 			nchange++;
  			goto sngl;
  		}
  		repladdr(p, 0, flt);
***************
*** 80,85 ****
--- 82,88 ----
  			strcpy(regs[RT1], regs[RT2]);
  			regs[RT2][0] = 0;
  			p->code = copy(1, regs[RT1]);
+ 			nchange++;
  			goto sngl;
  		}
  		if ((p->op==BIC || p->op==BIS) && equstr(regs[RT1], "$0")) {
***************
*** 86,102 ****
  			if (p->forw->op!=CBR) {
  				p->back->forw = p->forw;
  				p->forw->back = p->back;
  				continue;
  			}
  		}
  		repladdr(p, 0, flt);
  		source(regs[RT1]);
  		dest(regs[RT2], flt);
! 		if (p->op==DIV && (r = isreg(regs[RT2])>=0))
! 			regs[r+1][0] = 0;
! 		ccloc[0] = 0;
  		continue;
  
  	case CLRF:
  	case NEGF:
  		flt = NREG;
--- 89,199 ----
  			if (p->forw->op!=CBR) {
  				p->back->forw = p->forw;
  				p->forw->back = p->back;
+ 				nchange++;
  				continue;
  			}
  		}
+ /*
+  * the next block of code looks for the sequences (which extract the
+  * high byte of a word or the low byte respectively):
+  *	ash $-10,r
+  *	bic $-400,r
+  * or 
+  *	mov natural,r
+  *	bic $-400,r
+  * and transforms them into:
+  *	clrb r
+  *	swab r
+  * or
+  *	clr r
+  *	bisb natural,r
+  * These constructs occur often enough in the kernel (dealing with major/minor 
+  * device numbers, etc) it's worth a little extra work at compile time.
+ */
+ 		if (p->op == BIC && (equstr(regs[RT1],"$-400") || 
+ 			 equstr(regs[RT1],"$-177400"))) {
+ 			if (p->back->op == ASH) {
+ 				r = isreg(regs[RT2]);
+ 				dualop(p->back);
+ 				if ((equstr(regs[RT1], "$-10") || 
+ 				     equstr(regs[RT1], "$177770")) && 
+ 				    r == isreg(regs[RT2])) {
+ 					strcpy(regs[RT1], regs[RT2]);
+ 					regs[RT2][0] = 0;
+ 					p->back->op = CLR;
+ 					p->back->subop = BYTE;
+ 					p->back->code = copy(1, regs[RT1]);
+ 					p->op = SWAB;
+ 					p->code = copy(1, regs[RT1]);
+ 					nchange++;
+ 					goto sngl;
+ 				}
+ 			}
+ 			else if (p->back->op == MOV && p->forw->op != CBR) {
+ 				char temp[50];
+ 
+ 				r = isreg(regs[RT2]);
+ 				if (r < 0 && !xnatural(regs[RT2]))
+ 					goto out;
+ 				strcpy(temp, regs[RT2]);
+ 				dualop(p->back);
+ 				if (isreg(regs[RT2]) == r && natural(regs[RT1])) {
+ 			 	    if (r < 0 && (!xnatural(regs[RT2]) || !equstr(temp, regs[RT2])))
+ 					goto out;
+ /*
+  * XXX - the sequence "movb rN,rN; bic $-400,rN" can not be transformed
+  * because the 'clr' would lose all information about 'rN'.  The best that can 
+  * be done is to remove the 'movb' instruction and leave the 'bic'.
+ */
+ 				    if (isreg(regs[RT1]) == r && r >= 0) {
+ 					    p = p->back;
+ 					    p->forw->back = p->back;
+ 					    p->back->forw = p->forw;
+ 					    nchange++;
+ 					    continue;
+ 				    }
+ 				    dest(regs[RT1], flt);
+ 				    p->back->op = CLR;
+ 				    p->back->subop = 0;
+ 				    p->back->code = copy(1, regs[RT2]);
+ 				    p->op = BIS;
+ 				    p->subop = BYTE;
+ 				    strcat(regs[RT1], ",");
+ 				    p->code = copy(2, regs[RT1], regs[RT2]);
+ 				    nchange++;
+ 				}
+ 			}
+ out:		dualop(p);	/* restore banged up parsed operands */
+ 		}
  		repladdr(p, 0, flt);
  		source(regs[RT1]);
  		dest(regs[RT2], flt);
! 		if (p->op==DIV && (r = isreg(regs[RT2]))>=0)
! 			regs[r|1][0] = 0;
! 		switch	(p->op)
! 			{
! 			case	ADD:
! 			case	SUB:
! 			case	BIC:
! 			case	BIS:
! 			case	ASH:
! 				setcc(regs[RT2]);
! 				break;
! 			default:
! 				ccloc[0] = 0;
! 			}
  		continue;
  
+ 	case SXT:
+ 		singop(p);
+ 		if (p->forw->op == CLR && p->forw->subop != BYTE &&
+ 			xnatural(regs[RT1]) && !strcmp(p->code, p->forw->code)){
+ 			p->forw->back = p->back;
+ 			p->back->forw = p->forw;
+ 			nchange++;
+ 			continue;
+ 		}
+ 		goto sngl;
  	case CLRF:
  	case NEGF:
  		flt = NREG;
***************
*** 108,123 ****
  	case NEG:
  	case ASR:
  	case ASL:
! 	case SXT:
  		singop(p);
  	sngl:
  		dest(regs[RT1], flt);
  		if (p->op==CLR && flt==0)
  			if ((r = isreg(regs[RT1])) >= 0)
  				savereg(r, "$0");
  			else
  				setcon("$0", regs[RT1]);
! 		ccloc[0] = 0;
  		continue;
  
  	case TSTF:
--- 205,224 ----
  	case NEG:
  	case ASR:
  	case ASL:
! 	case SWAB:
  		singop(p);
  	sngl:
  		dest(regs[RT1], flt);
  		if (p->op==CLR && flt==0)
+ 			{
  			if ((r = isreg(regs[RT1])) >= 0)
  				savereg(r, "$0");
  			else
  				setcon("$0", regs[RT1]);
! 			ccloc[0] = 0;
! 			}
! 		else
! 			setcc(regs[RT1]);
  		continue;
  
  	case TSTF:
***************
*** 127,133 ****
  		singop(p);
  		repladdr(p, 0, flt);
  		source(regs[RT1]);
! 		if (equstr(regs[RT1], ccloc)) {
  			p->back->forw = p->forw;
  			p->forw->back = p->back;
  			p = p->back;
--- 228,256 ----
  		singop(p);
  		repladdr(p, 0, flt);
  		source(regs[RT1]);
! 		if (p->back->op == TST && !flt && not_sp(regs[RT1])) {
! 			char rt1[20];
! 			strcpy(rt1, regs[RT1]);
! 			singop(p->back);
! 			if (!strcmp("(sp)+", regs[RT1])) {
! 				p->back->subop = p->subop;
! 				p->back->forw = p->forw;
! 				p->forw->back = p->back;
! 				p = p->back;
! 				p->op = MOV;
! 				p->code = copy(2, rt1, ",(sp)+");
! 				nrtst++;
! 				nchange++;
! 				continue;
! 			}
! 		singop(p);
! 		}
! 		if (p->back->op == MOV && p->back->subop == BYTE) {
! 			dualop(p->back);
! 			setcc(regs[RT2]);
! 			singop(p);
! 		}
! 		if (equstr(regs[RT1], ccloc) && p->subop == p->back->subop) {
  			p->back->forw = p->forw;
  			p->forw->back = p->back;
  			p = p->back;
***************
*** 134,139 ****
--- 257,264 ----
  			nrtst++;
  			nchange++;
  		}
+ 		else
+ 			setcc(regs[RT1]); /* XXX - double TST in a row */
  		continue;
  
  	case CMPF:
***************
*** 212,222 ****
--- 337,377 ----
  				p = p->back;
  				nchange++;
  			}
+ /*
+  * If the instruction prior to the conditional branch was a 'tst' then
+  * save the condition code status.  The C construct:
+  * 		if (x) 
+  *		   if (x > 0)
+  * generates "tst _x; jeq ...; tst _x; jmi ...;jeq ...".  The code below removes
+  * the second "tst _x", leaving "tst _x; jeq ...;jmi ...; jeq ...".
+ */
+ 			if (p->back->op == TST) {
+ 				singop(p->back);
+ 				setcc(regs[RT1]);
+ 				break;
+ 			}
  		}
+ /*
+  * If the previous instruction was also a conditional branch then
+  * attempt to merge the two into a single branch.
+ */
+ 		if (p->back->op == CBR)
+ 			fixupbr(p);
  	case CFCC:
  		ccloc[0] = 0;
  		continue;
  
+ /*
+  * Unrecognized (unparsed) instructions, assignments (~foo=r2), and
+  * data arrive here.  In order to prevent throwing away information
+  * about register contents just because a local assignment is done
+  * we check for the first character being a tilde.
+ */
+ 	case 0:
+ 		if (p->code[0] != '~')
+ 			clearreg();
+ 		continue;
+ 
  	case JBR:
  		redunbr(p);
  
***************
*** 226,231 ****
--- 381,436 ----
  	}
  }
  
+ /*
+  * This table is used to convert two branches to the same label after a 
+  * 'tst' (which clears the C and V condition codes) into a single branch.
+  * Entries which translate to JBR could eventually cause the 'tst' instruction 
+  * to be eliminated as well, but that can wait for now.  There are unused or
+  * impossible combinations ('tst' followed by 'jlo' for example.  since
+  * 'tst' clears C it makes little sense to 'jlo/bcs') in the table, it 
+  * would have cost more in code to remove them than the entries themselves.
+  *
+  * Example:  "tst _x; jmi L3; jeq L3".  Find the row for 'jmi', then look
+  * at the column for 'jeq', the resulting "opcode" is 'jle'.
+ */
+ 	char	brtable[12][12] = {
+ 	/* jeq  jne  jle  jge  jlt  jgt  jlo  jhi  jlos jhis jpl  jmi */
+ /* jeq */ {JEQ ,JBR ,JLE ,JGE ,JLE ,JGE ,JEQ ,JBR ,JEQ ,JBR ,JGE ,JLE},
+ /* jne */ {JBR ,JNE ,JBR ,JBR ,JNE ,JNE ,JNE ,JNE ,JBR ,JBR ,JBR ,JNE},
+ /* jle */ {JLE ,JBR ,JLE ,JBR ,JLE ,JBR ,JLE ,JBR ,JLE ,JBR ,JBR ,JLE},
+ /* jge */ {JGE ,JBR ,JBR ,JGE ,JBR ,JGE ,JGE ,JBR ,JGE ,JBR ,JGE ,JBR},
+ /* jlt */ {JLE ,JNE ,JLE ,JBR ,JLT ,JNE ,JLT ,JBR ,JLE ,JBR ,JBR ,JLT},
+ /* jgt */ {JGE ,JNE ,JBR ,JGE ,JNE ,JGT ,JGT ,JGT ,JBR ,JGE ,JGE ,JNE},
+ /* jlo */ {JEQ ,JNE ,JLE ,JGE ,JLT ,JGT ,JLO ,JHI ,JLOS,JHIS,JPL ,JMI},
+ /* jhi */ {JBR ,JNE ,JBR ,JBR ,JNE ,JNE ,JNE ,JNE ,JBR ,JBR ,JBR ,JNE},
+ /* jlos*/ {JEQ ,JBR ,JLE ,JGE ,JLE ,JGE ,JLE ,JBR ,JEQ ,JBR ,JGE ,JLE},
+ /* jhis*/ {JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR ,JBR},
+ /* jpl */ {JGE ,JBR ,JBR ,JGE ,JBR ,JGE ,JGE ,JBR ,JGE ,JBR ,JGE ,JBR},
+ /* jmi */ {JLE ,JNE ,JLE ,JBR ,JLT ,JNE ,JLT ,JNE ,JLE ,JLT ,JBR ,JLT}
+ 	  };
+ 
+ fixupbr(p)
+ 	register struct node *p;
+ {
+ 	register struct node *p1, *p2;
+ 	int op;
+ 
+ 	p1 = p->back;
+ 	p2 = p1->back;
+ 	if (p->labno != p1->labno)
+ 		return;
+ 	if (p2->op != TST) {
+ 		if (p2->op == CBR && p2->back->op == TST)
+ 			goto ok;
+ 		return;
+ 	}
+ ok:	p->subop = brtable[p->subop][p1->subop];
+ 	nchange++;
+ 	nredunj++;
+ 	p2->forw = p;
+ 	p->back = p1->back;
+ 	}
+ 
  jumpsw()
  {
  	register struct node *p, *p1;
***************
*** 328,333 ****
--- 533,539 ----
  }
  
  abs(x)
+ register int x;
  {
  	return(x<0? -x: x);
  }
***************
*** 367,373 ****
  
  struct node *
  nonlab(p)
! struct node *p;
  {
  	CHECK(10);
  	while (p && p->op==LABEL)
--- 573,579 ----
  
  struct node *
  nonlab(p)
! register struct node *p;
  {
  	CHECK(10);
  	while (p && p->op==LABEL)
***************
*** 589,594 ****
--- 795,801 ----
  			rt1[1] = r + '0';
  			rt1[2] = 0;
  			nsaddr++;
+ 			nchange++;
  		}
  		if (r1>=0) {
  			rt2[1] = 'r';
***************
*** 595,600 ****
--- 802,808 ----
  			rt2[2] = r1 + '0';
  			rt2[3] = 0;
  			nsaddr++;
+ 			nchange++;
  		}
  		p->code = copy(2, rt1, rt2);
  	}
***************
*** 782,788 ****
  equstr(ap1, ap2)
  char *ap1, *ap2;
  {
! 	char *p1, *p2;
  
  	p1 = ap1;
  	p2 = ap2;
--- 990,996 ----
  equstr(ap1, ap2)
  char *ap1, *ap2;
  {
! 	register char *p1, *p2;
  
  	p1 = ap1;
  	p2 = ap2;
***************
*** 819,823 ****
--- 1027,1049 ----
  	p--;
  	if (*--p == '+' || *p ==')' && *--p != '5')
  		return(0);
+ 	return(1);
+ }
+ 
+ xnatural(ap)
+ 	char *ap;
+ {
+ 	if (natural(ap))
+ 		return(1);
+ 	return(equstr("(sp)", ap));
+ }
+ 
+ not_sp(ap)
+ 	register char *ap;
+ {
+ 	char c;
+ 
+ 	while (c = *ap++)
+ 		if (c == '(') return(*ap == 's' && ap[1] == 'p');
  	return(1);
  }
*** /old/src/lib/ccom/c10.c	Sun Feb 15 19:24:15 1987
--- /usr/src/lib/ccom/c10.c	Wed Oct  9 14:13:50 1991
***************
*** 508,513 ****
--- 508,531 ----
  	 && (tree->t.tr1->t.type==CHAR || tree->t.tr1->t.type==UNCHAR)
  	 && tree->t.tr2->t.type!=CHAR && tree->t.tr2->t.type!=UNCHAR)
  		tree->t.tr2 = tnode(LOAD, tree->t.tr2->t.type, tree->t.tr2, TNULL);
+ 	/*
+ 	 * Another peculiarity of the PDP11 table manifested itself when
+ 	 * amplifying the move3: table.  The same case which optimizes
+ 	 * u_char to char moves is used to move a u_char to a register. This
+ 	 * is wrong, leading to sign extension.  Rather than lose the ability
+ 	 * to generate better code when moving a u_char to a char, a check 
+ 	 * is made here to prevent sign extension.
+ 	 *
+ 	 * If the opcode is assign, the destination is a register and the
+ 	 * source is u_char then do a conversion.
+ 	 *
+ 	 * u_char handling in the compiler is a bit awkward, it would be nice
+ 	 * if %aub in the tables had a more unique meaning.
+ 	*/
+ 	if (tree->t.tr2 && tree->t.tr1->t.op == NAME
+ 	 && tree->t.tr1->n.class == REG && tree->t.op == ASSIGN
+ 	 && tree->t.tr2->t.type == UNCHAR)
+ 		tree->t.tr2 = tnode(LOAD, UNSIGN, tree->t.tr2, TNULL);
  	if (table==cregtab)
  		table = regtab;
  	/*
***************
*** 527,533 ****
  	 */
  	r = nreg - reg + areg - reg1 + 1;
  	if (table!=cctab || c==INCAFT || c==DECAFT || tree->t.type==LONG
! 	 || c==ASRSH || c==ASLSH || c==ASULSH || tree->t.tr1->t.type==UNCHAR
  	 || (opt = match(tree, efftab, r, 0)) == 0)
  		if ((opt=match(tree, table, r, 0))==0)
  			return(-1);
--- 545,552 ----
  	 */
  	r = nreg - reg + areg - reg1 + 1;
  	if (table!=cctab || c==INCAFT || c==DECAFT || tree->t.type==LONG
! /*	 || c==ASRSH || c==ASLSH || c==ASULSH || tree->t.tr1->t.type==UNCHAR */
! 	 || c==ASRSH || c==ASLSH || c==ASULSH
  	 || (opt = match(tree, efftab, r, 0)) == 0)
  		if ((opt=match(tree, table, r, 0))==0)
  			return(-1);
***************
*** 1001,1007 ****
  	p = *treep;
  	if ((p->t.op==INCAFT||p->t.op==DECAFT)
  	 && p->t.tr1->t.op==NAME) {
! 		return(1+rcexpr(paint(p->t.tr1, p->t.type), table, reg));
  	}
  	p1 = 0;
  /*
--- 1020,1031 ----
  	p = *treep;
  	if ((p->t.op==INCAFT||p->t.op==DECAFT)
  	 && p->t.tr1->t.op==NAME) {
! 		r = p->t.tr1->n.class;
! 		if (r == EXTERN || r == OFFS || r == STATIC &&
! 				p->t.tr1->t.type == UNCHAR)
! 			return(1+rcexpr(p->t.tr1, table, reg));
! 		else
! 			return(1+rcexpr(paint(p->t.tr1, p->t.type), table,reg));
  	}
  	p1 = 0;
  /*
*** /old/src/lib/ccom/optable	Fri Oct  7 14:12:25 1988
--- /usr/src/lib/ccom/optable	Tue Jul 28 09:35:00 1992
***************
*** 32,39 ****
  	{74,cr74},
  	{75,cr75},
  	{76,cr72},
! 	{78,cr70},
! 	{85,cr70},
  	{79,cr79},
  	{102,cr102},
  	{51,cr51},
--- 32,39 ----
  	{74,cr74},
  	{75,cr75},
  	{76,cr72},
! 	{78,cr78},	/* |= */
! 	{85,cr78},	/* &= */
  	{79,cr79},
  	{102,cr102},
  	{51,cr51},
***************
*** 255,262 ****
  	F*
  	S1
  	movB1	R1,#1(R)
! 	mov	R1,R
! 	bic	$!377,R
  
  %ed*,nf
  	S
--- 255,262 ----
  	F*
  	S1
  	movB1	R1,#1(R)
! 	clr	R
! 	bisb	R1,R
  
  %ed*,nf
  	S
***************
*** 486,492 ****
  	F!
  	div	A2,R
  
! /* =+, =-, =|, =&~ */
  cr70:
  %[addq1:]
  %aw,aw
--- 486,492 ----
  	F!
  	div	A2,R
  
! /* =+, =- */
  cr70:
  %[addq1:]
  %aw,aw
***************
*** 607,617 ****
--- 607,619 ----
  	movfo	R1,#1(R)
  	movf	R1,R
  
+ %[addq11:]
  %al,c
  	I	A2,A1+
  	V	A1
  	F
  
+ %[addq12:]
  %al,al
  	I	A2+,A1+
  	V	A1
***************
*** 618,623 ****
--- 620,626 ----
  	I	A2,A1
  	F
  
+ %[addq13:]
  %al,nl
  	S
  	I	R+,A1+
***************
*** 625,630 ****
--- 628,634 ----
  	I	R,A1
  	F
  
+ %[addq14:]
  %nl*,c
  	F*
  	I	A2,#1+2(R)
***************
*** 632,637 ****
--- 636,642 ----
  	mov	#1+2(R),R+
  	mov	#1(R),R
  
+ %[addq15:]
  %nl*,al
  	F*
  	I	A2+,#1+2(R)
***************
*** 640,645 ****
--- 645,651 ----
  	mov	#1+2(R),R+
  	mov	#1(R),R
  
+ %[addq16:]
  %nl*,nl
  	SS
  	F*
***************
*** 815,826 ****
  
  %aub,n
  	SS
! 	clr	R
! 	bisb	A1',R
  	xor	R,(sp)
! 	mov	(sp)+,R
  	movb	R,A1''
- 	bic	$!377,R
  
  %n*,n
  	FS*
--- 821,831 ----
  
  %aub,n
  	SS
! 	movb	A1',R
  	xor	R,(sp)
! 	clr	R
! 	bisb	(sp)+,R
  	movb	R,A1''
  
  %n*,n
  	FS*
***************
*** 851,856 ****
--- 856,941 ----
  	asrB1	#1(R)
  	movB1	#1(R),R
  
+ /* =|, =&~ */
+ cr78:
+ %aw,aw
+ %	[addq1]
+ 
+ %aub,a
+ 	IBE	A2,A1'
+ 	clr	R
+ 	bisb	A1'',R
+ 
+ %a,aw
+ %ad,ad
+ %	[addq1a]
+ 
+ %aw,nw*
+ %	[addq2]
+ 
+ %aw,n
+ %	[addq3]
+ 
+ %aub,n
+ 	SS
+ 	IBE	(sp)+,A1'
+ 	clr	R
+ 	bisb	A1'',R
+ 
+ %ew*,nw*
+ %	[addq4]
+ 
+ %ad,ef
+ %	[addq4a]
+ 
+ %a,n
+ %ad,nf
+ %	[addq5]
+ 
+ %af,nf
+ %	[addq6]
+ 
+ %ew*,n
+ %	[addq7]
+ 
+ %nw*,n
+ %	[addq8]
+ 
+ %n*,n
+ %	[addq9]
+ 
+ %nub*,n
+ 	FS*
+ 	SS
+ 	IBE	(sp),*2(sp)
+ 	tst	(sp)+
+ 	clr	R
+ 	bisb	*(sp)+,R
+ 
+ %nd*,nf
+ %	[addq9a]
+ 
+ %nf*,nf
+ %	[addq10]
+ 
+ %al,c
+ %	[addq11]
+ 
+ %al,al
+ %	[addq12]
+ 
+ %al,nl
+ %	[addq13]
+ 
+ %nl*,c
+ %	[addq14]
+ 
+ %nl*,al
+ %	[addq15]
+ 
+ %nl*,nl
+ %	[addq16]
+ 
  /* << for longs */
  cr91:
  %nl,aw
***************
*** 996,1002 ****
  	S1!
  	jsr	pc,I
  	movb	R,A1''
- 	bic	$!377,R
  
  %aw,n
  %ab,n
--- 1081,1086 ----
***************
*** 1022,1028 ****
  	mov	(sp)+,R1
  	jsr	pc,I
  	movB1	R,A1''
- 	bic	$!377,R
  
  %nub*,n
  	FS*
--- 1106,1111 ----
***************
*** 1032,1038 ****
  	bisb	*(sp),R
  	jsr	pc,I
  	movB1	R,*(sp)+
- 	bic	$!377,R
  
  /* (int *) - (int *) */
  cr107:
--- 1115,1120 ----
***************
*** 1083,1089 ****
--- 1165,1173 ----
  %[move3:]
  %a,aw
  %ab,a
+ %ab,aub
  %aub,a
+ %aub,ab
  	IBE	A2,A1
  
  %[move4:]
***************
*** 1254,1264 ****
  
  /* =| and =& ~ */
  ci78:
! %a,aw
  %ab,a
  %aub,ab
  %	[move3]
  
  %a,n
  %	[move5]
  
--- 1338,1358 ----
  
  /* =| and =& ~ */
  ci78:
! %a,a
! %a,ab
! %a,aub
  %ab,a
+ %ab,ab
+ %ab,aub
+ %aub,a
  %aub,ab
+ %aub,aub
  %	[move3]
  
+ %aub,n
+ 	S
+ 	IBE	R,A1
+ 
  %a,n
  %	[move5]
  
***************
*** 1335,1340 ****
--- 1429,1435 ----
  ci70:
  %n*,z
  %a,z
+ %ab,1
  %aub,1
  %a,1
  	I'B1	A1
***************
*** 1561,1584 ****
  cc60:
  %a,z
  %ad,zf
  %	[move1]
  
- %aub,z
- 	movb	A1,R
- 	bic	$!377,R
- 
  %af,z
  	movof	A1,R
  
  %n*,z
  %nd*,zf
  %	[move2]
  
- %nub*,z
- 	F*
- 	movB1	#1(R),R
- 	bic	$!377,R
- 
  %nf*,z
  	F*
  	movof	#1(R),R
--- 1656,1672 ----
  cc60:
  %a,z
  %ad,zf
+ %aub,z
  %	[move1]
  
  %af,z
  	movof	A1,R
  
  %n*,z
  %nd*,zf
+ %nub*,z
  %	[move2]
  
  %nf*,z
  	F*
  	movof	#1(R),R
***************
*** 1589,1594 ****
--- 1677,1683 ----
  
  %aw,aw
  %ab,ab
+ %aub,a
  %aub,aub
  %	[move3]
  
***************
*** 1728,1736 ****
--- 1817,1846 ----
  /* & as in "if ((a&b) ==0)" */
  cc81:
  %a,a
+ %a,ab
+ %a,aub
+ %ab,a
+ %ab,ab
+ %ab,aub
+ %aub,a
+ %aub,ab
+ %aub,aub
  %	[move3]
  
+ /*
+    special case. apparently "u_char b; [u_]char a; if (b & a)..." was
+    too complicated.  the resulting code was horrid.  this cuts the
+    waste by 33%
+ */
+    
+ %a,e
+ %aub,e
+ 	S
+ 	IBE	R,A1
+ 
  %n*,a
+ %nu*,a
+ %nub*,a
  %	[move6]
  
  %n,a
*** /old/src/lib/cpp/Makefile	Mon Dec 26 14:17:04 1988
--- /usr/src/lib/cpp/Makefile	Wed Aug  7 05:21:56 1991
***************
*** 21,27 ****
  cpy.c : cpy.y
  	yacc cpy.y
  	../pcc/:yyfix yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef
! 	mv y.tab.c cpy.c
  
  cpy.o :	cpy.c yylex.c
  
--- 21,28 ----
  cpy.c : cpy.y
  	yacc cpy.y
  	../pcc/:yyfix yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef
! 	fgrep -v "static char yaccpar_sccsid" y.tab.c >cpy.c
! 	rm -f y.tab.c
  
  cpy.o :	cpy.c yylex.c
  
