[comp.os.minix] Patches for BSD more for ST-Minix 1.1

poole@forty2.UUCP (Simon Poole) (01/08/89)

The following shar archive contains nearly (see the README) everything
you need to get the recent posting of BSD more running with ST-Minix 1.1.
You will need something like 300kB of space on /tmp to apply the patch
to more.c with `patch'.

--------------------- cut here --------------------------------
echo x - README
gres '^X' '' > README << '/'
X
XBSD more for ST-Minix
X=====================
X
XS.Poole 7.1.88
X
XThe changes I made to the BSD more posting to get it running on
XST-Minix using the ACK compiler fall into two categories:
X
X	- ATARI-ST specific changes (all #ifdef'd with ATARI_ST)
X	  I changed everything with respect to ST-Minix 1.1
X	  and not to my own version (I'm busy bringing it up to 
X	  PC 1.3 standard and fixing a LOT of bugs on the way),
X	  even so it will not run on a stock ST-Minix 1.1 distribution
X	  due to two problems:
X		- `more' reads from file descriptor 2 (stderr), but
X		  the standard ST-Minix `init' opens stdout and stdin 
X                  only for writing:
X		  Fix: change the modes in the open calls in
X                       /usr/src/sttools/init.c to 2.
X		- the `execv' libary call doesn't pass the enviroment
X                  of the current process to `execve' (this breaks the
X                  `v' and `!' commands):
X		  Fix: use the 1.3 (PC) /usr/src/lib/exec.c or fix
X		  the standard one.
X
X	- other bugs, mainly generous int - pointer confusion
X          on the behalf of the original authors 
X
X
X		Have fun....
X			Simon
X
XPS: and thanks to Bruce D. Szablak for the ST-Minix debugger!
X
/
echo x - Makefile.cdiff
gres '^X' '' > Makefile.cdiff << '/'
X*** /usr/tmp/Makefile	Thu Jan  7 17:31:40 1989
X--- Makefile	Thu Jan  7 18:12:46 1989
X***************
X*** 16,31 ****
X  #
X  #	@(#)Makefile	5.5 (Berkeley) 6/29/88
X  #
X! CFLAGS= -DMINIX
X! LIBC=	/usr/lib/libc.a
X! SRCS=	more.c regcompat.c tcvars.c
X! OBJS=	more.s regcompat.s tcvars.s
X  
X  all: more
X  
X  more:	${OBJS} ${LIBC}
X! 	${CC} -o $@ ${CFLAGS} ${OBJS} -ltermcap
X! 	chmem =4096 $@
X  
X  clean: FRC
X  	rm -f ${OBJS} core more
X--- 16,31 ----
X  #
X  #	@(#)Makefile	5.5 (Berkeley) 6/29/88
X  #
X! CFLAGS= -O -DATARI_ST -DACK -DMINIX
X! LIBC=	/usr/lib/libc.a
X! SRCS=	more.c regcompat.c tcvars.c
X! OBJS=	more.o regcompat.o tcvars.o
X  
X  all: more
X  
X  more:	${OBJS} ${LIBC}
X! 	${CC} -o $@ ${CFLAGS} ${OBJS}
X! 	chmem =5000 $@
X  
X  clean: FRC
X  	rm -f ${OBJS} core more
X***************
X*** 33,43 ****
X  depend: FRC
X  	mkdep ${CFLAGS} ${SRCS}
X  
X! install: FRC
X! 	install -s -o bin -g bin -m 755 more ${DESTDIR}/usr/ucb/more
X! 	rm -f ${DESTDIR}/usr/ucb/page
X! 	ln ${DESTDIR}/usr/ucb/more ${DESTDIR}/usr/ucb/page
X! 	install -c -o bin -g bin -m 644 more.help ${DESTDIR}/usr/lib/more.help
X  
X  lint: FRC
X  	lint ${CFLAGS} ${SRCS}
X--- 33,43 ----
X  depend: FRC
X  	mkdep ${CFLAGS} ${SRCS}
X  
X! #install: FRC
X! #	install -s -o bin -g bin -m 755 more ${DESTDIR}/usr/ucb/more
X! #	rm -f ${DESTDIR}/usr/ucb/page
X! #	ln ${DESTDIR}/usr/ucb/more ${DESTDIR}/usr/ucb/page
X! #	install -c -o bin -g bin -m 644 more.help ${DESTDIR}/usr/lib/more.help
X  
X  lint: FRC
X  	lint ${CFLAGS} ${SRCS}
X***************
X*** 50,56 ****
X  # DO NOT DELETE THIS LINE -- mkdep uses it.
X  # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
X  
X- more.s: /usr/include/a.out.h
X  more.s: /usr/include/ctype.h
X  more.s: /usr/include/errno.h
X  more.s: /usr/include/limits.h
X--- 50,55 ----
/
echo x - more.cdiff
gres '^X' '' > more.cdiff << '/'
X*** /usr/tmp/more.c	Thu Jan  7 17:31:52 1989
X--- more.c	Thu Jan  7 17:37:25 1989
X***************
X*** 45,51 ****
X  #include <sys/param.h>
X  #include <sys/file.h>
X  #endif
X! #include <a.out.h>
X  #include <varargs.h>
X  
X  #ifdef MINIX
X--- 45,56 ----
X  #include <sys/param.h>
X  #include <sys/file.h>
X  #endif
X! #ifndef ATARI_ST
X! /* currently ST-Minix doesn't come with a.out.h, but
X!    since the check for magic numbers is disabled any-
X!    way, we don't need it */
X! #include <a.out.h>
X! #endif
X  #include <varargs.h>
X  
X  #ifdef MINIX
X***************
X*** 69,76 ****
X  #endif
X  
X  #define MBIT	CBREAK
X! #define stty(fd,argp)	ioctl(fd,TIOCSETN,argp)
X! 
X  #define TBUFSIZ	1024
X  #define LINSIZ	256
X  #define ctrl(letter)	(letter & 077)
X--- 74,83 ----
X  #endif
X  
X  #define MBIT	CBREAK
X! #ifndef ATARI_ST
X! /* ST-Minix doesn't have TIOCSETN (yet) */
X! #define stty(fd,argp)	ioctl(fd,TIOCSETN,argp)
X! #endif
X  #define TBUFSIZ	1024
X  #define LINSIZ	256
X  #define ctrl(letter)	(letter & 077)
X***************
X*** 120,125 ****
X--- 127,133 ----
X  char		cursorhome[40];	/* contains cursor movement to home */
X  char		*EodClr;	/* clear rest of screen */
X  char		*tgetstr();
X+ char		*tgoto();
X  int		Mcol = 80;	/* number of columns */
X  int		Wrap = 1;	/* set if automargins */
X  int		soglitch;	/* terminal has standout mode glitch */
X***************
X*** 504,510 ****
X  	Ungetc (c, f);
X  	setjmp (restore);
X  	Pause = 0; startup = 0;
X! 	if ((num_lines = command (NULL, f)) == 0)
X  	    return;
X  	if (hard && promptlen > 0)
X  		erase (0);
X--- 512,518 ----
X  	Ungetc (c, f);
X  	setjmp (restore);
X  	Pause = 0; startup = 0;
X! 	if ((num_lines = command ((char *)NULL, f)) == 0)
X  	    return;
X  	if (hard && promptlen > 0)
X  		erase (0);
X***************
X*** 588,594 ****
X      }
X      else
X  	write (2, "\n", 1);
X!     _exit(0);
X  }
X  
X  copy_file(f)
X--- 596,606 ----
X      }
X      else
X  	write (2, "\n", 1);
X! #ifndef ATARI_ST
X!     _exit(0);
X! #else
X!     exit(0);
X! #endif
X  }
X  
X  copy_file(f)
X***************
X*** 1150,1156 ****
X  	    fflush (stdout);
X  	    if (lastp) {
X  		write (2,"\r", 1);
X! 		search (NULL, f, nlines);	/* Use previous r.e. */
X  	    }
X  	    else {
X  		ttyin (cmdbuf, 78, '/');
X--- 1162,1168 ----
X  	    fflush (stdout);
X  	    if (lastp) {
X  		write (2,"\r", 1);
X! 		search ((char *)NULL, f, nlines);/* Use previous r.e. */
X  	    }
X  	    else {
X  		ttyin (cmdbuf, 78, '/');
X***************
X*** 1177,1183 ****
X  		scanstr (Currline - dlines < 0 ? 0
X  				: Currline - (dlines + 1) / 2, &cmdbuf[1]);
X  		pr ("vi "); pr (cmdbuf); putchar (' '); pr (fnames[fnum]);
X! 		execute (filename, VI, "vi", cmdbuf, fnames[fnum], 0);
X  		break;
X  	    }
X  	default:
X--- 1189,1195 ----
X  		scanstr (Currline - dlines < 0 ? 0
X  				: Currline - (dlines + 1) / 2, &cmdbuf[1]);
X  		pr ("vi "); pr (cmdbuf); putchar (' '); pr (fnames[fnum]);
X! 		execute (filename, VI, "vi", cmdbuf, fnames[fnum], (char *)0);
X  		break;
X  	    }
X  	default:
X***************
X*** 1316,1322 ****
X  	write (2, "\n", 1);
X  	promptlen = 0;
X  	shellp = 1;
X! 	execute (filename, shell, shell, "-c", shell_line, 0);
X  }
X  
X  /*
X--- 1328,1334 ----
X  	write (2, "\n", 1);
X  	promptlen = 0;
X  	shellp = 1;
X! 	execute (filename, shell, shell, "-c", shell_line, (char *)0);
X  }
X  
X  /*
X***************
X*** 1618,1624 ****
X      gtty(fileno(stderr), &otty);
X      savetty = otty;
X      ospeed = otty.sg_ospeed;
X!     slow_tty = ospeed < B1200;
X      hardtabs = (otty.sg_flags & TBDELAY) != XTABS;
X      if (!no_tty) {
X  	otty.sg_flags &= ~ECHO;
X--- 1630,1640 ----
X      gtty(fileno(stderr), &otty);
X      savetty = otty;
X      ospeed = otty.sg_ospeed;
X! #ifndef ATARI_ST
X!     slow_tty = ospeed < B1200;
X! #else
X!     slow_tty = 0; /* FALSE */
X! #endif
X      hardtabs = (otty.sg_flags & TBDELAY) != XTABS;
X      if (!no_tty) {
X  	otty.sg_flags &= ~ECHO;
/
-- 
----------------------------------------------------------------------------
UUCP:   ...mcvax!cernvax!forty2!poole			Simon Poole
BITNET: K538915@CZHRZU1A
----------------------------------------------------------------------------