release 3.2, Jan 4, 1980
authorMark Horton <mark@ucbvax.Berkeley.EDU>
Fri, 1 Aug 1980 14:22:42 +0000 (06:22 -0800)
committerMark Horton <mark@ucbvax.Berkeley.EDU>
Fri, 1 Aug 1980 14:22:42 +0000 (06:22 -0800)
SCCS-vsn: usr.bin/ex/ex.c 2.1
SCCS-vsn: usr.bin/ex/ex.h 2.1
SCCS-vsn: usr.bin/ex/ex_addr.c 2.1
SCCS-vsn: usr.bin/ex/ex_argv.h 2.1
SCCS-vsn: usr.bin/ex/ex_cmds.c 2.1
SCCS-vsn: usr.bin/ex/ex_cmds2.c 2.1
SCCS-vsn: usr.bin/ex/ex_cmdsub.c 2.1
SCCS-vsn: usr.bin/ex/ex_data.c 2.1
SCCS-vsn: usr.bin/ex/ex_get.c 2.1
SCCS-vsn: usr.bin/ex/ex_io.c 2.1
SCCS-vsn: usr.bin/ex/ex_put.c 2.1
SCCS-vsn: usr.bin/ex/ex_re.c 2.1
SCCS-vsn: usr.bin/ex/ex_re.h 2.1
SCCS-vsn: usr.bin/ex/ex_set.c 2.1
SCCS-vsn: usr.bin/ex/ex_subr.c 2.1
SCCS-vsn: usr.bin/ex/ex_temp.c 2.1
SCCS-vsn: usr.bin/ex/ex_temp.h 2.1
SCCS-vsn: usr.bin/ex/ex_tty.c 2.1
SCCS-vsn: usr.bin/ex/ex_tty.h 2.1
SCCS-vsn: usr.bin/ex/ex_tune.h 2.1
SCCS-vsn: usr.bin/ex/ex_v.c 2.1
SCCS-vsn: usr.bin/ex/ex_vadj.c 2.1
SCCS-vsn: usr.bin/ex/ex_vars.h 2.1
SCCS-vsn: usr.bin/ex/ex_vget.c 2.1
SCCS-vsn: usr.bin/ex/ex_vis.h 2.1
SCCS-vsn: usr.bin/ex/ex_vmain.c 2.1
SCCS-vsn: usr.bin/ex/ex_voper.c 2.1
SCCS-vsn: usr.bin/ex/ex_vops.c 2.1
SCCS-vsn: usr.bin/ex/ex_vops2.c 2.1
SCCS-vsn: usr.bin/ex/ex_vops3.c 2.1
SCCS-vsn: usr.bin/ex/ex_vput.c 2.1
SCCS-vsn: usr.bin/ex/ex_vwind.c 2.1
SCCS-vsn: usr.bin/ex/ex3.7preserve/ex3.7preserve.c 2.1
SCCS-vsn: usr.bin/ex/ex3.7recover/ex3.7recover.c 2.1
SCCS-vsn: usr.bin/ex/Makefile 2.1
SCCS-vsn: usr.bin/ex/OTHER/makefile.70 2.1
SCCS-vsn: usr.bin/ex/makeoptions 2.1
SCCS-vsn: usr.bin/ex/printf.c 2.1

21 files changed:
usr/src/usr.bin/ex/Makefile
usr/src/usr.bin/ex/OTHER/makefile.70
usr/src/usr.bin/ex/ex.c
usr/src/usr.bin/ex/ex.h
usr/src/usr.bin/ex/ex3.7preserve/ex3.7preserve.c
usr/src/usr.bin/ex/ex3.7recover/ex3.7recover.c
usr/src/usr.bin/ex/ex_argv.h
usr/src/usr.bin/ex/ex_cmds.c
usr/src/usr.bin/ex/ex_cmdsub.c
usr/src/usr.bin/ex/ex_data.c
usr/src/usr.bin/ex/ex_io.c
usr/src/usr.bin/ex/ex_re.c
usr/src/usr.bin/ex/ex_subr.c
usr/src/usr.bin/ex/ex_temp.c
usr/src/usr.bin/ex/ex_temp.h
usr/src/usr.bin/ex/ex_tune.h
usr/src/usr.bin/ex/ex_vars.h
usr/src/usr.bin/ex/ex_vget.c
usr/src/usr.bin/ex/ex_vis.h
usr/src/usr.bin/ex/ex_vmain.c
usr/src/usr.bin/ex/ex_vops2.c

index 09953ec..c62b9d7 100644 (file)
@@ -1,34 +1,43 @@
-VERSION=3.1
+VERSION=3.2
 #
 #
-# Ex skeletal makefile for Version 7
+# Ex skeletal makefile for version 7
 #
 # NB: This makefile doesn't indicate any dependencies on header files.
 #
 #
 # NB: This makefile doesn't indicate any dependencies on header files.
 #
-# Compiles in the LISPCODE code within the editor;
-# take this out of CFLAGS to make some
-# breathing room in the text space if necessary.  If you take out -DLISPCODE
-# you should move ex_vars.nolisp to ex_vars.h
+# Ex is very large - it may not fit on PDP-11's depending on the operating
+# system and the cflags you turn on. Things that can be turned off to save
+# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
+# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
+# chdir command.)
+#
+# Don't define VFORK unless your system has the VFORK system call,
+# which is like fork but the two processes have only one data space until the
+# child execs. This speeds up ex by saving the memory copy.
+# -DVMUNIX makes an ex which can edit very large files (eg the w2a dictionary)
+# this allows 200000 lines and about 16M byte temp files.
 #
 # If your system expands tabs to 4 spaces you should -DTABS=4 below
 #
 #
 # If your system expands tabs to 4 spaces you should -DTABS=4 below
 #
-# Ex wants stdio only to get the doprnt.o routine; if other stdio stuff
-# gets dragged in that is a mistake.
+# Ex is likely to overflow the symbol table in your C compiler.
+# It can use -t0 which is (purportedly) a C compiler with a larger
+# symbol table.  The -t1 flag to the C compiler is for a C compiler
+# which puts switch code in I space, increasing the text space size
+# to the benefit of per-user data space.  If you don't have this it
+# doesn't matter much. Another method, which works on v7 pdp-11's,
+# is to use pcc for ex_io.c instead of cc.
 #
 #
-.c.o:
-       ${MKSTR} - ex${VERSION}strings x $*.c
-       ${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
-       rm -f x$*.c
-       ${CC} ${CFLAGS} -O -c x.c 
-       mv x.o $*.o
-BINDIR=        /usr/bin
+BINDIR=        /usr/ucb
+NBINDIR=/usr/new
 LIBDIR=        /usr/lib
 LIBDIR=        /usr/lib
-FOLD=  /usr/bin/fold
-CTAGS= /usr/ucb/ctags
-AS=    -as
-XSTR=  /usr/ucb/xstr
-CFLAGS=        -DTABS=8 -DLISPCODE
-MKSTR= /usr/ucb/mkstr
-CXREF= /usr/ucb/cxref
+FOLD=  ${BINDIR}/fold
+CTAGS= ${BINDIR}/ctags
+XSTR=  ${BINDIR}/xstr
+DEBUGFLAGS=    -DTRACE
+NONDEBUGFLAGS= -O
+CFLAGS=        -DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL -DMACROS -DVFORK -DVMUNIX ${NONDEBUGFLAGS}
+TERMLIB=       -ltermlib
+MKSTR= ${BINDIR}/mkstr
+CXREF= ${BINDIR}/cxref
 INCLUDE=/usr/include
 PR=    pr
 OBJS=  ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
 INCLUDE=/usr/include
 PR=    pr
 OBJS=  ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
@@ -37,48 +46,74 @@ OBJS=       ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
        ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
        printf.o strings.o
 
        ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
        printf.o strings.o
 
-all: a.out expreserve exrecover
+all:   a.out exrecover expreserve tags
+
+.c.o:
+#      ${MKSTR} - ex${VERSION}strings x $*.c
+       ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
+#      rm -f x$*.c
+       ${CC} ${CFLAGS} -c x.c 
+       mv x.o $*.o
 
 
-a.out: ${OBJS} tags
-       ${CC} -i ${OBJS} -ltermlib
+a.out: ${OBJS}
+       cc -i ${OBJS} ${TERMLIB}
 
 tags:
 
 tags:
-       ../bin/csh ${CTAGS} ex.c ex_*.c
+       ${CTAGS} -w *.h *.c
+
+${OBJS}: ex_vars.h
+
+ex_vars.h:
+       csh makeoptions ${CFLAGS}
 
 strings.o: strings
        ${XSTR}
 
 strings.o: strings
        ${XSTR}
-       ${CC} -c xs.c
-       mv xs.o strings.o
+       ${CC} -c -S xs.c
+       ed - <:rofix xs.s
+       as -o strings.o xs.s
+       rm xs.s
        
 exrecover: exrecover.o
        
 exrecover: exrecover.o
-       ${CC} -o exrecover exrecover.o
+       ${CC} ${CFLAGS} exrecover.o -o exrecover
 
 
-exrecover.o:
+exrecover.o: exrecover.c
        ${CC} ${CFLAGS} -c -O exrecover.c
 
        ${CC} ${CFLAGS} -c -O exrecover.c
 
-expreserve: expreserve.o popen.c
-       ${CC} -o expreserve expreserve.o
+expreserve: expreserve.o
+       ${CC} expreserve.o -o expreserve
 
 expreserve.o:
 
 expreserve.o:
-       ${CC} ${CFLAGS} -c expreserve.c
+       ${CC} ${CFLAGS} -c -O expreserve.c
 
 clean:
 
 clean:
-       -rm a.out exrecover expreserve ex${VERSION}strings strings errs core trace
-       -rm *.o x*.[cs]
+#      If we dont have ex we cant make it so dont rm ex_vars.h
+       -rm -f a.out exrecover expreserve ex${VERSION}strings strings core trace tags
+       -rm -f *.o x*.[cs]
 
 
-install: a.out installutil
-       -chmod 755 ${BINDIR}/ex
-       -${BINDIR}/ex </dev/null
-       -rm -f ${BINDIR}/ex ${BINDIR}/edit /${BINDIR}/vi
-       cp a.out ${BINDIR}/ex
-       ln ${BINDIR}/ex ${BINDIR}/edit
-       ln ${BINDIR}/ex ${BINDIR}/vi
-       cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
-       chmod 1755 ${BINDIR}/ex
+ninstall: a.out
+       -rm -f ${NBINDIR}/ex ${NBINDIR}/vi
+       cp a.out ${NBINDIR}/ex
+#      -cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
+       ln ${NBINDIR}/ex ${NBINDIR}/vi
+       chmod 1755 ${NBINDIR}/ex
 
 
-installutil: exrecover expreserve
-       cp exrecover ${LIBDIR}/ex${VERSION}recover
-       cp expreserve ${LIBDIR}/ex${VERSION}preserve
+install: a.out exrecover expreserve
+       -rm -f ${DESTDIR}${BINDIR}/ex
+       -rm -f ${DESTDIR}${BINDIR}/vi
+       -rm -f ${DESTDIR}${BINDIR}/edit
+       -rm -f ${DESTDIR}${BINDIR}/e
+       -rm -f ${DESTDIR}/usr/bin/ex
+       cp a.out ${DESTDIR}${BINDIR}/ex
+#      cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
+       chmod 1755 ${DESTDIR}${BINDIR}/ex
+       cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
+       cp expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
+       chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
+       mkdir ${DESTDIR}/usr/preserve
 
 lint:
        lint ex.c ex_?*.c
 
 lint:
        lint ex.c ex_?*.c
@@ -86,17 +121,14 @@ lint:
        lint expreserve.c
 
 print:
        lint expreserve.c
 
 print:
-       @-rm x.c xs.c >/dev/null
        @${PR} READ* BUGS
        @${PR} READ* BUGS
-       @${PR} make*
+       @${PR} makefile*
+       @${PR} /etc/termcap
        @(size -l a.out ; size *.o) | ${PR} -h sizes
        @(size -l a.out ; size *.o) | ${PR} -h sizes
-       @${PR} termcap
        @${PR} -h errno.h ${INCLUDE}/errno.h
        @${PR} -h errno.h ${INCLUDE}/errno.h
-       @${PR} -h pwd.h ${INCLUDE}/pwd.h
        @${PR} -h setjmp.h ${INCLUDE}/setjmp.h
        @${PR} -h sgtty.h ${INCLUDE}/sgtty.h
        @${PR} -h signal.h ${INCLUDE}/signal.h
        @${PR} -h setjmp.h ${INCLUDE}/setjmp.h
        @${PR} -h sgtty.h ${INCLUDE}/sgtty.h
        @${PR} -h signal.h ${INCLUDE}/signal.h
-       @${PR} -h sys/dir.h ${INCLUDE}/sys/dir.h
        @${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
        @${PR} -h sys/types.h ${INCLUDE}/sys/types.h
        @ls -ls | ${PR}
        @${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
        @${PR} -h sys/types.h ${INCLUDE}/sys/types.h
        @ls -ls | ${PR}
index 09953ec..c62b9d7 100644 (file)
@@ -1,34 +1,43 @@
-VERSION=3.1
+VERSION=3.2
 #
 #
-# Ex skeletal makefile for Version 7
+# Ex skeletal makefile for version 7
 #
 # NB: This makefile doesn't indicate any dependencies on header files.
 #
 #
 # NB: This makefile doesn't indicate any dependencies on header files.
 #
-# Compiles in the LISPCODE code within the editor;
-# take this out of CFLAGS to make some
-# breathing room in the text space if necessary.  If you take out -DLISPCODE
-# you should move ex_vars.nolisp to ex_vars.h
+# Ex is very large - it may not fit on PDP-11's depending on the operating
+# system and the cflags you turn on. Things that can be turned off to save
+# space include LISPCODE (-l flag, showmatch and lisp options), UCVISUAL
+# (visual \ nonsense on upper case only terminals), CHDIR (the undocumented
+# chdir command.)
+#
+# Don't define VFORK unless your system has the VFORK system call,
+# which is like fork but the two processes have only one data space until the
+# child execs. This speeds up ex by saving the memory copy.
+# -DVMUNIX makes an ex which can edit very large files (eg the w2a dictionary)
+# this allows 200000 lines and about 16M byte temp files.
 #
 # If your system expands tabs to 4 spaces you should -DTABS=4 below
 #
 #
 # If your system expands tabs to 4 spaces you should -DTABS=4 below
 #
-# Ex wants stdio only to get the doprnt.o routine; if other stdio stuff
-# gets dragged in that is a mistake.
+# Ex is likely to overflow the symbol table in your C compiler.
+# It can use -t0 which is (purportedly) a C compiler with a larger
+# symbol table.  The -t1 flag to the C compiler is for a C compiler
+# which puts switch code in I space, increasing the text space size
+# to the benefit of per-user data space.  If you don't have this it
+# doesn't matter much. Another method, which works on v7 pdp-11's,
+# is to use pcc for ex_io.c instead of cc.
 #
 #
-.c.o:
-       ${MKSTR} - ex${VERSION}strings x $*.c
-       ${CC} -E ${CFLAGS} x$*.c | ${XSTR} -c -
-       rm -f x$*.c
-       ${CC} ${CFLAGS} -O -c x.c 
-       mv x.o $*.o
-BINDIR=        /usr/bin
+BINDIR=        /usr/ucb
+NBINDIR=/usr/new
 LIBDIR=        /usr/lib
 LIBDIR=        /usr/lib
-FOLD=  /usr/bin/fold
-CTAGS= /usr/ucb/ctags
-AS=    -as
-XSTR=  /usr/ucb/xstr
-CFLAGS=        -DTABS=8 -DLISPCODE
-MKSTR= /usr/ucb/mkstr
-CXREF= /usr/ucb/cxref
+FOLD=  ${BINDIR}/fold
+CTAGS= ${BINDIR}/ctags
+XSTR=  ${BINDIR}/xstr
+DEBUGFLAGS=    -DTRACE
+NONDEBUGFLAGS= -O
+CFLAGS=        -DTABS=8 -DLISPCODE -DCHDIR -DUCVISUAL -DMACROS -DVFORK -DVMUNIX ${NONDEBUGFLAGS}
+TERMLIB=       -ltermlib
+MKSTR= ${BINDIR}/mkstr
+CXREF= ${BINDIR}/cxref
 INCLUDE=/usr/include
 PR=    pr
 OBJS=  ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
 INCLUDE=/usr/include
 PR=    pr
 OBJS=  ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
@@ -37,48 +46,74 @@ OBJS=       ex.o ex_addr.o ex_cmds.o ex_cmds2.o ex_cmdsub.o ex_data.o ex_get.o \
        ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
        printf.o strings.o
 
        ex_vops.o ex_vops2.o ex_vops3.o ex_vput.o ex_vwind.o \
        printf.o strings.o
 
-all: a.out expreserve exrecover
+all:   a.out exrecover expreserve tags
+
+.c.o:
+#      ${MKSTR} - ex${VERSION}strings x $*.c
+       ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c -
+#      rm -f x$*.c
+       ${CC} ${CFLAGS} -c x.c 
+       mv x.o $*.o
 
 
-a.out: ${OBJS} tags
-       ${CC} -i ${OBJS} -ltermlib
+a.out: ${OBJS}
+       cc -i ${OBJS} ${TERMLIB}
 
 tags:
 
 tags:
-       ../bin/csh ${CTAGS} ex.c ex_*.c
+       ${CTAGS} -w *.h *.c
+
+${OBJS}: ex_vars.h
+
+ex_vars.h:
+       csh makeoptions ${CFLAGS}
 
 strings.o: strings
        ${XSTR}
 
 strings.o: strings
        ${XSTR}
-       ${CC} -c xs.c
-       mv xs.o strings.o
+       ${CC} -c -S xs.c
+       ed - <:rofix xs.s
+       as -o strings.o xs.s
+       rm xs.s
        
 exrecover: exrecover.o
        
 exrecover: exrecover.o
-       ${CC} -o exrecover exrecover.o
+       ${CC} ${CFLAGS} exrecover.o -o exrecover
 
 
-exrecover.o:
+exrecover.o: exrecover.c
        ${CC} ${CFLAGS} -c -O exrecover.c
 
        ${CC} ${CFLAGS} -c -O exrecover.c
 
-expreserve: expreserve.o popen.c
-       ${CC} -o expreserve expreserve.o
+expreserve: expreserve.o
+       ${CC} expreserve.o -o expreserve
 
 expreserve.o:
 
 expreserve.o:
-       ${CC} ${CFLAGS} -c expreserve.c
+       ${CC} ${CFLAGS} -c -O expreserve.c
 
 clean:
 
 clean:
-       -rm a.out exrecover expreserve ex${VERSION}strings strings errs core trace
-       -rm *.o x*.[cs]
+#      If we dont have ex we cant make it so dont rm ex_vars.h
+       -rm -f a.out exrecover expreserve ex${VERSION}strings strings core trace tags
+       -rm -f *.o x*.[cs]
 
 
-install: a.out installutil
-       -chmod 755 ${BINDIR}/ex
-       -${BINDIR}/ex </dev/null
-       -rm -f ${BINDIR}/ex ${BINDIR}/edit /${BINDIR}/vi
-       cp a.out ${BINDIR}/ex
-       ln ${BINDIR}/ex ${BINDIR}/edit
-       ln ${BINDIR}/ex ${BINDIR}/vi
-       cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
-       chmod 1755 ${BINDIR}/ex
+ninstall: a.out
+       -rm -f ${NBINDIR}/ex ${NBINDIR}/vi
+       cp a.out ${NBINDIR}/ex
+#      -cp ex${VERSION}strings ${LIBDIR}/ex${VERSION}strings
+       ln ${NBINDIR}/ex ${NBINDIR}/vi
+       chmod 1755 ${NBINDIR}/ex
 
 
-installutil: exrecover expreserve
-       cp exrecover ${LIBDIR}/ex${VERSION}recover
-       cp expreserve ${LIBDIR}/ex${VERSION}preserve
+install: a.out exrecover expreserve
+       -rm -f ${DESTDIR}${BINDIR}/ex
+       -rm -f ${DESTDIR}${BINDIR}/vi
+       -rm -f ${DESTDIR}${BINDIR}/edit
+       -rm -f ${DESTDIR}${BINDIR}/e
+       -rm -f ${DESTDIR}/usr/bin/ex
+       cp a.out ${DESTDIR}${BINDIR}/ex
+#      cp ex${VERSION}strings ${DESTDIR}/${LIBDIR}/ex${VERSION}strings
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/edit
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/e
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}${BINDIR}/vi
+       ln ${DESTDIR}${BINDIR}/ex ${DESTDIR}/usr/bin/ex
+       chmod 1755 ${DESTDIR}${BINDIR}/ex
+       cp exrecover ${DESTDIR}${LIBDIR}/ex${VERSION}recover
+       cp expreserve ${DESTDIR}/${LIBDIR}/ex${VERSION}preserve
+       chmod 4755 ${DESTDIR}${LIBDIR}/ex${VERSION}recover ${DESTDIR}${LIBDIR}/ex${VERSION}preserve
+       mkdir ${DESTDIR}/usr/preserve
 
 lint:
        lint ex.c ex_?*.c
 
 lint:
        lint ex.c ex_?*.c
@@ -86,17 +121,14 @@ lint:
        lint expreserve.c
 
 print:
        lint expreserve.c
 
 print:
-       @-rm x.c xs.c >/dev/null
        @${PR} READ* BUGS
        @${PR} READ* BUGS
-       @${PR} make*
+       @${PR} makefile*
+       @${PR} /etc/termcap
        @(size -l a.out ; size *.o) | ${PR} -h sizes
        @(size -l a.out ; size *.o) | ${PR} -h sizes
-       @${PR} termcap
        @${PR} -h errno.h ${INCLUDE}/errno.h
        @${PR} -h errno.h ${INCLUDE}/errno.h
-       @${PR} -h pwd.h ${INCLUDE}/pwd.h
        @${PR} -h setjmp.h ${INCLUDE}/setjmp.h
        @${PR} -h sgtty.h ${INCLUDE}/sgtty.h
        @${PR} -h signal.h ${INCLUDE}/signal.h
        @${PR} -h setjmp.h ${INCLUDE}/setjmp.h
        @${PR} -h sgtty.h ${INCLUDE}/sgtty.h
        @${PR} -h signal.h ${INCLUDE}/signal.h
-       @${PR} -h sys/dir.h ${INCLUDE}/sys/dir.h
        @${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
        @${PR} -h sys/types.h ${INCLUDE}/sys/types.h
        @ls -ls | ${PR}
        @${PR} -h sys/stat.h ${INCLUDE}/sys/stat.h
        @${PR} -h sys/types.h ${INCLUDE}/sys/types.h
        @ls -ls | ${PR}
index 72fa653..e74b5c0 100644 (file)
@@ -70,7 +70,9 @@ main(ac, av)
        register int ac;
        register char *av[];
 {
        register int ac;
        register char *av[];
 {
+#ifndef VMUNIX
        char *erpath = EXSTRINGS;
        char *erpath = EXSTRINGS;
+#endif
        register char *cp;
        register int c;
        bool recov = 0;
        register char *cp;
        register int c;
        bool recov = 0;
@@ -99,8 +101,10 @@ main(ac, av)
         * For debugging take files out of . if name is a.out.
         * If a 'd' in our name, then set options for edit.
         */
         * For debugging take files out of . if name is a.out.
         * If a 'd' in our name, then set options for edit.
         */
+#ifndef VMUNIX
        if (av[0][0] == 'a')
                erpath = tailpath(erpath);
        if (av[0][0] == 'a')
                erpath = tailpath(erpath);
+#endif
        if (ivis) {
 #ifdef notdef
                options[BEAUTIFY].odefault = value(BEAUTIFY) = 1;
        if (ivis) {
 #ifdef notdef
                options[BEAUTIFY].odefault = value(BEAUTIFY) = 1;
@@ -115,10 +119,12 @@ main(ac, av)
         * Open the error message file.
         */
        draino();
         * Open the error message file.
         */
        draino();
+#ifndef VMUNIX
        erfile = open(erpath+4, 0);
        if (erfile < 0) {
                erfile = open(erpath, 0);
        }
        erfile = open(erpath+4, 0);
        if (erfile < 0) {
                erfile = open(erpath, 0);
        }
+#endif
        pstop();
 
        /*
        pstop();
 
        /*
index 0a83eef..9493541 100644 (file)
 
 extern int errno;
 
 
 extern int errno;
 
+#ifndef VMUNIX
 typedef        short   line;
 typedef        short   line;
+#else
+typedef        int     line;
+#endif
 typedef        short   bool;
 
 #include "ex_tune.h"
 typedef        short   bool;
 
 #include "ex_tune.h"
@@ -104,7 +108,11 @@ struct     option options[NOPTS + 1];
 #      undef   putchar
 #      undef   getchar
 #else
 #      undef   putchar
 #      undef   getchar
 #else
+#ifdef VMUNIX
+#      define  BUFSIZ  1024
+#else
 #      define  BUFSIZ  512
 #      define  BUFSIZ  512
+#endif
 #      define  NULL    0
 #      define  EOF     -1
 #endif
 #      define  NULL    0
 #      define  EOF     -1
 #endif
@@ -130,14 +138,16 @@ struct    option options[NOPTS + 1];
  */
 bool   aiflag;                 /* Append/change/insert with autoindent */
 bool   anymarks;               /* We have used '[a-z] */
  */
 bool   aiflag;                 /* Append/change/insert with autoindent */
 bool   anymarks;               /* We have used '[a-z] */
-short  chng;                   /* Warn "No write" */
+int    chng;                   /* Warn "No write" */
 char   *Command;
 short  defwind;                /* -w# change default window size */
 char   *Command;
 short  defwind;                /* -w# change default window size */
-short  dirtcnt;                /* When >= MAXDIRT, should sync temporary */
+int    dirtcnt;                /* When >= MAXDIRT, should sync temporary */
 bool   edited;                 /* Current file is [Edited] */
 line   *endcore;               /* Last available core location */
 bool   endline;                /* Last cmd mode command ended with \n */
 bool   edited;                 /* Current file is [Edited] */
 line   *endcore;               /* Last available core location */
 bool   endline;                /* Last cmd mode command ended with \n */
+#ifndef VMUNIX
 short  erfile;                 /* Error message file unit */
 short  erfile;                 /* Error message file unit */
+#endif
 line   *fendcore;              /* First address in line pointer space */
 char   file[FNSIZE];           /* Working file name */
 char   genbuf[LBSIZE];         /* Working buffer when manipulating linebuf */
 line   *fendcore;              /* First address in line pointer space */
 char   file[FNSIZE];           /* Working file name */
 char   genbuf[LBSIZE];         /* Working buffer when manipulating linebuf */
@@ -160,11 +170,11 @@ bool      listf;                  /* Command should run in list mode */
 char   *loc1;                  /* Where re began to match (in linebuf) */
 char   *loc2;                  /* First char after re match (") */
 line   names['z'-'a'+2];       /* Mark registers a-z,' */
 char   *loc1;                  /* Where re began to match (in linebuf) */
 char   *loc2;                  /* First char after re match (") */
 line   names['z'-'a'+2];       /* Mark registers a-z,' */
-short  notecnt;                /* Count for notify (to visual from cmd) */
+int    notecnt;                /* Count for notify (to visual from cmd) */
 bool   numberf;                /* Command should run in number mode */
 char   obuf[BUFSIZ];           /* Buffer for tty output */
 short  ospeed;                 /* Output speed (from gtty) */
 bool   numberf;                /* Command should run in number mode */
 char   obuf[BUFSIZ];           /* Buffer for tty output */
 short  ospeed;                 /* Output speed (from gtty) */
-short  otchng;                 /* Backup tchng to find changes in macros */
+int    otchng;                 /* Backup tchng to find changes in macros */
 short  peekc;                  /* Peek ahead character (cmd mode input) */
 char   *pkill[2];              /* Trim for put with ragged (LISP) delete */
 bool   pfast;                  /* Have stty -nl'ed to go faster */
 short  peekc;                  /* Peek ahead character (cmd mode input) */
 char   *pkill[2];              /* Trim for put with ragged (LISP) delete */
 bool   pfast;                  /* Have stty -nl'ed to go faster */
@@ -175,11 +185,11 @@ int       rpid;                   /* Pid returned from wait() */
 bool   ruptible;               /* Interruptible is normal state */
 bool   shudclob;               /* Have a prompt to clobber (e.g. on ^D) */
 int    status;                 /* Status returned from wait() */
 bool   ruptible;               /* Interruptible is normal state */
 bool   shudclob;               /* Have a prompt to clobber (e.g. on ^D) */
 int    status;                 /* Status returned from wait() */
-short  tchng;                  /* If nonzero, then [Modified] */
+int    tchng;                  /* If nonzero, then [Modified] */
 short  tfile;                  /* Temporary file unit */
 bool   vcatch;                 /* Want to catch an error (open/visual) */
 jmp_buf        vreslab;                /* For error throws to a visual catch */
 short  tfile;                  /* Temporary file unit */
 bool   vcatch;                 /* Want to catch an error (open/visual) */
 jmp_buf        vreslab;                /* For error throws to a visual catch */
-short  xchng;                  /* Suppresses multiple "No writes" in !cmd */
+int    xchng;                  /* Suppresses multiple "No writes" in !cmd */
 
 /*
  * Macros
 
 /*
  * Macros
index c915b6b..373aa69 100644 (file)
@@ -7,6 +7,12 @@
 #include <pwd.h>
 #include "local/uparm.h"
 
 #include <pwd.h>
 #include "local/uparm.h"
 
+#ifdef VMUNIX
+#define        HBLKS   2
+#else
+#define        HBLKS   1
+#endif
+
 /*
  * Expreserve - preserve a file in usrpath(preserve)
  * Bill Joy UCB November 13, 1977
 /*
  * Expreserve - preserve a file in usrpath(preserve)
  * Bill Joy UCB November 13, 1977
  *      temporaries.
  */
 
  *      temporaries.
  */
 
+#ifndef VMUNIX
 #define        LBLKS   125
 #define        LBLKS   125
+#else
+#define        LBLKS   900
+#endif
 #define        FNSIZE  128
 
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
        short   Uid;                    /* This users identity */
 #define        FNSIZE  128
 
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
        short   Uid;                    /* This users identity */
+#ifndef VMUNIX
        short   Flines;                 /* Number of lines in file */
        short   Flines;                 /* Number of lines in file */
+#else
+       int     Flines;
+#endif
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
 } H;
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
 } H;
@@ -170,7 +184,7 @@ format:
 #endif
                goto format;
        }
 #endif
                goto format;
        }
-       if (H.Blocks[0] != 1 || H.Blocks[1] != 2) {
+       if (H.Blocks[0] != HBLKS || H.Blocks[1] != HBLKS+1) {
 #ifdef DEBUG
                fprintf(stderr, "Blocks %d %d\n", H.Blocks[0], H.Blocks[1]);
 #endif
 #ifdef DEBUG
                fprintf(stderr, "Blocks %d %d\n", H.Blocks[0], H.Blocks[1]);
 #endif
index 17660b4..9781fb9 100644 (file)
@@ -488,7 +488,7 @@ nope:
         * puts a word LOST in the header block, so that lost lines
         * can be made to point at it.
         */
         * puts a word LOST in the header block, so that lost lines
         * can be made to point at it.
         */
-       ignorl(lseek(tfile, 504l, 0));
+       ignorl(lseek(tfile, (long)(BUFSIZ*HBLKS-8), 0));
        ignore(write(tfile, "LOST", 5));
        return (1);
 }
        ignore(write(tfile, "LOST", 5));
        return (1);
 }
@@ -522,7 +522,7 @@ scrapbad()
 
        ignore(fstat(tfile, &stbuf));
        size = stbuf.st_size;
 
        ignore(fstat(tfile, &stbuf));
        size = stbuf.st_size;
-       maxt = (size >> SHFT) | 7;
+       maxt = (size >> SHFT) | (BNDRY-1);
        bno = (maxt >> OFFBTS) & BLKMSK;
 #ifdef DEBUG
        fprintf(stderr, "size %ld, maxt %o, bno %d\n", size, maxt, bno);
        bno = (maxt >> OFFBTS) & BLKMSK;
 #ifdef DEBUG
        fprintf(stderr, "size %ld, maxt %o, bno %d\n", size, maxt, bno);
@@ -564,7 +564,7 @@ null:
 #endif
                        if (was == 0)
                                was = ip - zero;
 #endif
                        if (was == 0)
                                was = ip - zero;
-                       *ip = 504 >> SHFT;
+                       *ip = ((HBLKS*BUFSIZ)-8) >> SHFT;
                } else if (was) {
                        if (bad == 0)
                                fprintf(stderr, " [Lost line(s):");
                } else if (was) {
                        if (bad == 0)
                                fprintf(stderr, " [Lost line(s):");
@@ -738,7 +738,7 @@ blkio(b, buf, iofcn)
 {
 
        lseek(tfile, (long) (unsigned) b * BUFSIZ, 0);
 {
 
        lseek(tfile, (long) (unsigned) b * BUFSIZ, 0);
-       if ((*iofcn)(tfile, buf, BUFSIZ) != 512)
+       if ((*iofcn)(tfile, buf, BUFSIZ) != BUFSIZ)
                syserror();
 }
 
                syserror();
 }
 
index 7ce9dba..666045b 100644 (file)
@@ -14,7 +14,7 @@ short argc;
 short  argc0;
 short  morargc;                /* Used with "More files to edit..." */
 
 short  argc0;
 short  morargc;                /* Used with "More files to edit..." */
 
-short  firstln;                /* From +lineno */
+int    firstln;                /* From +lineno */
 char   *firstpat;              /* From +/pat   */
 
 /* Yech... */
 char   *firstpat;              /* From +/pat   */
 
 /* Yech... */
index 3939db5..d577f89 100644 (file)
@@ -260,7 +260,9 @@ doecmd:
                        setnoaddr();
                        filename(c);
                        noonl();
                        setnoaddr();
                        filename(c);
                        noonl();
+/*
                        synctmp();
                        synctmp();
+*/
                        continue;
 
 /* global */
                        continue;
 
 /* global */
@@ -596,7 +598,7 @@ quit:
                                tail("version");
                                setNAEOL();
                                /* should use SCCS subst here */
                                tail("version");
                                setNAEOL();
                                /* should use SCCS subst here */
-                               printf("Version 3.1, November 11, 1979");
+                               printf("Version 3.2, January 4, 1980");
                                noonl();
                                continue;
 
                                noonl();
                                continue;
 
index b630e8b..09c01d9 100644 (file)
@@ -456,7 +456,6 @@ tagfind(quick)
        short omagic;
 
        omagic = value(MAGIC);
        short omagic;
 
        omagic = value(MAGIC);
-       value(MAGIC) = 0;       /* force nomagic mode for tags */
        if (!skipend()) {
                register char *lp = lasttag;
 
        if (!skipend()) {
                register char *lp = lasttag;
 
@@ -531,9 +530,15 @@ badtags:
                                strcat(cmdbuf2, filebuf);
                                globp = cmdbuf2;
                                d = peekc; ungetchar(0);
                                strcat(cmdbuf2, filebuf);
                                globp = cmdbuf2;
                                d = peekc; ungetchar(0);
+                               /*
+                                * BUG: if it isn't found (user edited header
+                                * line) we get left in nomagic mode.
+                                */
+                               value(MAGIC) = 0;
                                commands(1, 1);
                                peekc = d;
                                globp = oglobp;
                                commands(1, 1);
                                peekc = d;
                                globp = oglobp;
+                               value(MAGIC) = omagic;
                                samef = 0;
                        }
                        oglobp = globp;
                                samef = 0;
                        }
                        oglobp = globp;
@@ -541,6 +546,7 @@ badtags:
                        d = peekc; ungetchar(0);
                        if (samef)
                                markpr(dot);
                        d = peekc; ungetchar(0);
                        if (samef)
                                markpr(dot);
+                       value(MAGIC) = 0;
                        commands(1, 1);
                        peekc = d;
                        globp = oglobp;
                        commands(1, 1);
                        peekc = d;
                        globp = oglobp;
@@ -1031,13 +1037,13 @@ addmac(src,dest,dname)
        if (dest) {
                /* Make sure user doesn't screw himself */
                /*
        if (dest) {
                /* Make sure user doesn't screw himself */
                /*
-                * Prevent head and tail recursion. We really should be
-                * checking to see if src is a prefix or suffix of dest
+                * Prevent tail recursion. We really should be
+                * checking to see if src is a suffix of dest
                 * but we are too lazy here, so we don't bother unless
                 * src is only 1 char long.
                 */
                 * but we are too lazy here, so we don't bother unless
                 * src is only 1 char long.
                 */
-               if (src[1] == 0 && (src[0] == dest[0] || src[0] == dest[strlen(dest)-1]))
-                       error("No recursion");
+               if (src[1] == 0 && src[0] == dest[strlen(dest)-1])
+                       error("No tail recursion");
                /*
                 * We don't let the user rob himself of ":", and making
                 * multi char words is a bad idea so we don't allow it.
                /*
                 * We don't let the user rob himself of ":", and making
                 * multi char words is a bad idea so we don't allow it.
index 5336782..402d208 100644 (file)
@@ -38,8 +38,8 @@ struct        option options[NOPTS + 1] = {
        "ignorecase",   "ic",   ONOFF,          0,      0,      0,
        "lisp",         0,      ONOFF,          0,      0,      0,
        "list",         0,      ONOFF,          0,      0,      0,
        "ignorecase",   "ic",   ONOFF,          0,      0,      0,
        "lisp",         0,      ONOFF,          0,      0,      0,
        "list",         0,      ONOFF,          0,      0,      0,
-       "mapinput",     "mi",   ONOFF,          0,      0,      0,
        "magic",        0,      ONOFF,          1,      1,      0,
        "magic",        0,      ONOFF,          1,      1,      0,
+       "mapinput",     "mi",   ONOFF,          0,      0,      0,
        "number",       "nu",   ONOFF,          0,      0,      0,
        "open",         0,      ONOFF,          1,      1,      0,
        "optimize",     "opt",  ONOFF,          0,      0,      0,
        "number",       "nu",   ONOFF,          0,      0,      0,
        "open",         0,      ONOFF,          1,      1,      0,
        "optimize",     "opt",  ONOFF,          0,      0,      0,
index d89f1ff..d22f82e 100644 (file)
  * Following remember where . was in the previous file for return
  * on file switching.
  */
  * Following remember where . was in the previous file for return
  * on file switching.
  */
-short  altdot;
-short  oldadot;
+int    altdot;
+int    oldadot;
 bool   wasalt;
 
 long   cntch;                  /* Count of characters on unit io */
 bool   wasalt;
 
 long   cntch;                  /* Count of characters on unit io */
+#ifndef VMUNIX
 short  cntln;                  /* Count of lines " */
 short  cntln;                  /* Count of lines " */
+#else
+int    cntln;
+#endif
 long   cntnull;                /* Count of nulls " */
 long   cntodd;                 /* Count of non-ascii characters " */
 
 long   cntnull;                /* Count of nulls " */
 long   cntodd;                 /* Count of non-ascii characters " */
 
@@ -476,7 +480,9 @@ bool dofname;       /* if 1 call filename, else use savedfile */
                        error(" Use \"w!\" to write partial buffer");
                }
 cre:
                        error(" Use \"w!\" to write partial buffer");
                }
 cre:
+/*
                synctmp();
                synctmp();
+*/
 #ifdef V6
                io = creat(file, 0644);
 #else
 #ifdef V6
                io = creat(file, 0644);
 #else
@@ -689,7 +695,9 @@ unixex(opt, up, newstdin, mode)
                        close(io);
                if (tfile)
                        close(tfile);
                        close(io);
                if (tfile)
                        close(tfile);
+#ifndef VMUNIX
                close(erfile);
                close(erfile);
+#endif
                signal(SIGHUP, oldhup);
                signal(SIGQUIT, oldquit);
                if (ruptible)
                signal(SIGHUP, oldhup);
                signal(SIGQUIT, oldquit);
                if (ruptible)
index a980ca9..93abfaa 100644 (file)
@@ -410,7 +410,7 @@ dosub()
                        *sp++ = c & TRIM;
                if (sp >= &genbuf[LBSIZE])
 ovflo:
                        *sp++ = c & TRIM;
                if (sp >= &genbuf[LBSIZE])
 ovflo:
-                       error("Line overflow@in substitute - limit 512 chars");
+                       error("Line overflow@in substitute");
        }
        lp = loc2;
        loc2 = sp + (linebuf - genbuf);
        }
        lp = loc2;
        loc2 = sp + (linebuf - genbuf);
index a5ccf85..1e17f4c 100644 (file)
@@ -316,10 +316,14 @@ mesg(str)
 
 /*VARARGS2*/
 merror(seekpt, i)
 
 /*VARARGS2*/
 merror(seekpt, i)
-#ifdef lint
+#ifdef VMUNIX
        char *seekpt;
 #else
        char *seekpt;
 #else
+# ifdef lint
+       char *seekpt;
+# else
        int seekpt;
        int seekpt;
+# endif
 #endif
        int i;
 {
 #endif
        int i;
 {
@@ -340,16 +344,24 @@ merror(seekpt, i)
 }
 
 merror1(seekpt)
 }
 
 merror1(seekpt)
-#ifdef lint
+#ifdef VMUNIX
        char *seekpt;
 #else
        char *seekpt;
 #else
+# ifdef lint
+       char *seekpt;
+# else
        int seekpt;
        int seekpt;
+# endif
 #endif
 {
 
 #endif
 {
 
+#ifdef VMUNIX
+       strcpy(linebuf, seekpt);
+#else
        lseek(erfile, (long) seekpt, 0);
        if (read(erfile, linebuf, 128) < 2)
                CP(linebuf, "ERROR");
        lseek(erfile, (long) seekpt, 0);
        if (read(erfile, linebuf, 128) < 2)
                CP(linebuf, "ERROR");
+#endif
 }
 
 morelines()
 }
 
 morelines()
@@ -584,7 +596,11 @@ smerror(seekpt, cp)
 #ifdef lint
 char   *std_errlist[] = {
 #else
 #ifdef lint
 char   *std_errlist[] = {
 #else
+#ifdef VMUNIX
+char   *std_errlist[] = {
+#else
 short  std_errlist[] = {
 short  std_errlist[] = {
+#endif
 #endif
        error("Error 0"),
        error("Not super-user"),
 #endif
        error("Error 0"),
        error("Not super-user"),
index 340b0be..e8f8780 100644 (file)
@@ -23,13 +23,13 @@ fileinit()
        register int i, j;
        struct stat stbuf;
 
        register int i, j;
        struct stat stbuf;
 
-       if (tline == INCRMT * 3)
+       if (tline == INCRMT * (HBLKS+2))
                return;
        cleanup(0);
        close(tfile);
                return;
        cleanup(0);
        close(tfile);
-       tline = INCRMT * 3;
-       blocks[0] = 1;
-       blocks[1] = 2;
+       tline = INCRMT * (HBLKS+2);
+       blocks[0] = HBLKS;
+       blocks[1] = HBLKS+1;
        blocks[2] = -1;
        dirtcnt = 0;
        iblock = -1;
        blocks[2] = -1;
        dirtcnt = 0;
        iblock = -1;
index 438367a..7d4c751 100644 (file)
@@ -4,9 +4,9 @@
  * similar to that of ed.  The first block of the file is used for a header
  * block which guides recovery after editor/system crashes.
  * Lines are represented in core by a pointer into the temporary file which
  * similar to that of ed.  The first block of the file is used for a header
  * block which guides recovery after editor/system crashes.
  * Lines are represented in core by a pointer into the temporary file which
- * is packed into 16 bits.  15 of these bits index the temporary file,
- * the 16'th is used by global commands.  The parameters below control
- * how much the 15 bits are shifted left before they index the temp file.
+ * is packed into 16 bits (32 on VMUNIX).  All but the low bit index the temp
+ * file; the last is used by global commands.  The parameters below control
+ * how much the other bits are shifted left before they index the temp file.
  * Larger shifts give more slop in the temp file but allow larger files
  * to be edited.
  *
  * Larger shifts give more slop in the temp file but allow larger files
  * to be edited.
  *
  *
  * The following temp file parameters allow 256k bytes in the temporary
  * file.  By changing to the numbers in comments you can get 512k.
  *
  * The following temp file parameters allow 256k bytes in the temporary
  * file.  By changing to the numbers in comments you can get 512k.
- * By typedefing line to long (32 bit) integers you could get much more
- * space in the temp file with (then) no waste.  This would double core
- * requirements and would probably require some editor debugging.
+ * For VMUNIX you get more than you could ever want.
+ * VMUNIX uses long (32 bit) integers giving much more
+ * space in the temp file and no waste.  This doubles core
+ * requirements but allows files of essentially unlimited size to be edited.
  */
  */
+#ifndef VMUNIX
 #define        BLKMSK  0777            /* 01777 */
 #define        BNDRY   8               /* 16 */
 #define        INCRMT  0200            /* 0100 */
 #define        BLKMSK  0777            /* 01777 */
 #define        BNDRY   8               /* 16 */
 #define        INCRMT  0200            /* 0100 */
 #define        OFFBTS  7               /* 6 */
 #define        OFFMSK  0177            /* 077 */
 #define        SHFT    2               /* 3 */
 #define        OFFBTS  7               /* 6 */
 #define        OFFMSK  0177            /* 077 */
 #define        SHFT    2               /* 3 */
+#else
+#define        BLKMSK  077777
+#define        BNDRY   2
+#define        INCRMT  02000
+#define        LBTMSK  01776
+#define        NMBLKS  077770
+#define        OFFBTS  10
+#define        OFFMSK  01777
+#define        SHFT    0
+#endif
 
 /*
  * The editor uses three buffers into the temporary file (ed uses two
  * and is very similar).  These are two read buffers and one write buffer.
 
 /*
  * The editor uses three buffers into the temporary file (ed uses two
  * and is very similar).  These are two read buffers and one write buffer.
- * Basically, the editor deals with the file as a sequence of 512 character
- * blocks (BUFSIZ).  Each block contains some number of lines (and lines
+ * Basically, the editor deals with the file as a sequence of BUFSIZ character
+ * blocks.  Each block contains some number of lines (and lines
  * can run across block boundaries.
  *
  * New lines are written into the last block in the temporary file
  * can run across block boundaries.
  *
  * New lines are written into the last block in the temporary file
@@ -59,7 +71,11 @@ short        iblock2;                /* Temp file block number of ibuff2 (or -1) */
 short  ninbuf;                 /* Number useful chars left in input buffer */
 short  nleft;                  /* Number usable chars left in output buffer */
 short  oblock;                 /* Temp file block number of obuff (or -1) */
 short  ninbuf;                 /* Number useful chars left in input buffer */
 short  nleft;                  /* Number usable chars left in output buffer */
 short  oblock;                 /* Temp file block number of obuff (or -1) */
+#ifndef VMUNIX
 short  tline;                  /* Current temp file ptr */
 short  tline;                  /* Current temp file ptr */
+#else
+int    tline;
+#endif
 
 char   ibuff[BUFSIZ];
 char   ibuff2[BUFSIZ];
 
 char   ibuff[BUFSIZ];
 char   ibuff2[BUFSIZ];
@@ -83,7 +99,11 @@ char obuff[BUFSIZ];
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
        short   Uid;
 struct         header {
        time_t  Time;                   /* Time temp file last updated */
        short   Uid;
+#ifndef VMUNIX
        short   Flines;                 /* Number of lines in file */
        short   Flines;                 /* Number of lines in file */
+#else
+       int     Flines;
+#endif
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
 } H;
        char    Savedfile[FNSIZE];      /* The current file name */
        short   Blocks[LBLKS];          /* Blocks where line pointers stashed */
 } H;
index d025bb0..192e9b8 100644 (file)
  * "/usr/lib/..." here, "/lib" will be tried only for strings.
  */
 #include "local/uparm.h"
  * "/usr/lib/..." here, "/lib" will be tried only for strings.
  */
 #include "local/uparm.h"
-#define        EXRECOVER       libpath(ex3.1recover)
-#define        EXPRESERVE      libpath(ex3.1preserve)
-#define        EXSTRINGS       libpath(ex3.1strings)
+#define        EXRECOVER       libpath(ex3.2recover)
+#define        EXPRESERVE      libpath(ex3.2preserve)
+#ifndef VMUNIX
+#define        EXSTRINGS       libpath(ex3.2strings)
+#endif
 #define        MASTERTAGS      libpath(tags)
 
 /*
 #define        MASTERTAGS      libpath(tags)
 
 /*
  * Maximums
  *
  * The definition of LBSIZE should be the same as BUFSIZ (512 usually).
  * Maximums
  *
  * The definition of LBSIZE should be the same as BUFSIZ (512 usually).
- * Most other defitions are quite generous.
+ * Most other definitions are quite generous.
  */
 /* FNSIZE is also defined in expreserve.c */
 #define        FNSIZE          128             /* File name size */
  */
 /* FNSIZE is also defined in expreserve.c */
 #define        FNSIZE          128             /* File name size */
+#ifdef VMUNIX
+#define        LBSIZE          1024
+#define        ESIZE           512
+#else
 #define        LBSIZE          512             /* Line length */
 #define        ESIZE           128             /* Size of compiled re */
 #define        LBSIZE          512             /* Line length */
 #define        ESIZE           128             /* Size of compiled re */
+#endif
 #define        RHSSIZE         256             /* Size of rhs of substitute */
 #define        NBRA            9               /* Number of re \( \) pairs */
 #define        TAGSIZE         32              /* Tag length */
 #define        RHSSIZE         256             /* Size of rhs of substitute */
 #define        NBRA            9               /* Number of re \( \) pairs */
 #define        TAGSIZE         32              /* Tag length */
 #define        UXBSIZE         128             /* Unix command buffer size */
 #define        VBSIZE          128             /* Partial line max size in visual */
 /* LBLKS is also defined in expreserve.c */
 #define        UXBSIZE         128             /* Unix command buffer size */
 #define        VBSIZE          128             /* Partial line max size in visual */
 /* LBLKS is also defined in expreserve.c */
+#ifndef VMUNIX
 #define        LBLKS           125             /* Line pointer blocks in temp file */
 #define        LBLKS           125             /* Line pointer blocks in temp file */
+#define        HBLKS           1               /* struct header fits in BUFSIZ*HBLKS */
+#else
+#define        LBLKS           900
+#define        HBLKS           2
+#endif
 #define        MAXDIRT         12              /* Max dirtcnt before sync tfile */
 #define TCBUFSIZE      1024            /* Max entry size in termcap, see
                                           also termlib and termcap */
 
 /*
 #define        MAXDIRT         12              /* Max dirtcnt before sync tfile */
 #define TCBUFSIZE      1024            /* Max entry size in termcap, see
                                           also termlib and termcap */
 
 /*
- * These are a ridiculously small due to the
+ * Except on VMUNIX, these are a ridiculously small due to the
  * lousy arglist processing implementation which fixes core
  * proportional to them.  Argv (and hence NARGS) is really unnecessary,
  * and argument character space not needed except when
  * lousy arglist processing implementation which fixes core
  * proportional to them.  Argv (and hence NARGS) is really unnecessary,
  * and argument character space not needed except when
  * of the incore line information and could then
  * be reasonably large.
  */
  * of the incore line information and could then
  * be reasonably large.
  */
+#ifndef VMUNIX
 #define        NARGS   100             /* Maximum number of names in "next" */
 #define        NARGS   100             /* Maximum number of names in "next" */
-#define        NCARGS  512             /* Maximum arglist chars in "next" */
+#define        NCARGS  LBSIZE          /* Maximum arglist chars in "next" */
+#else
+#define        NCARGS  5120
+#define        NARGS   (NCARGS/6)
+#endif
 
 /*
  * Note: because the routine "alloca" is not portable, TUBESIZE
  * bytes are allocated on the stack each time you go into visual
 
 /*
  * Note: because the routine "alloca" is not portable, TUBESIZE
  * bytes are allocated on the stack each time you go into visual
- * and then never freed by the system.  Thus if you have not terminals
+ * and then never freed by the system.  Thus if you have no terminals
  * which are larger than 24 * 80 you may well want to make TUBESIZE
  * smaller.  TUBECOLS should stay at 160 since this defines the maximum
  * length of opening on hardcopies and allows two lines of open on
  * terminals like adm3's (glass tty's) where it switches to pseudo
  * hardcopy mode when a line gets longer than 80 characters.
  */
  * which are larger than 24 * 80 you may well want to make TUBESIZE
  * smaller.  TUBECOLS should stay at 160 since this defines the maximum
  * length of opening on hardcopies and allows two lines of open on
  * terminals like adm3's (glass tty's) where it switches to pseudo
  * hardcopy mode when a line gets longer than 80 characters.
  */
-#define        TUBELINES       36      /* Number of screen lines for visual */
+#ifndef VMUNIX
+#define        TUBELINES       40      /* Number of screen lines for visual */
 #define        TUBECOLS        160     /* Number of screen columns for visual */
 #define        TUBECOLS        160     /* Number of screen columns for visual */
-#define        TUBESIZE        2880    /* Maximum screen size for visual */
+#define        TUBESIZE        3400    /* Maximum screen size for visual */
+#else
+#define        TUBELINES       66
+#define        TUBECOLS        160
+#define        TUBESIZE        6600    /* 66 * 100 */
+#endif
 
 /*
  * Output column (and line) are set to this value on cursor addressible
 
 /*
  * Output column (and line) are set to this value on cursor addressible
index b7b1fbd..c3bd859 100644 (file)
@@ -9,8 +9,8 @@
 #define IGNORECASE      8
 #define LISP            9
 #define LIST            10
 #define IGNORECASE      8
 #define LISP            9
 #define LIST            10
-#define MAPINPUT        11
-#define MAGIC           12
+#define MAGIC           11
+#define MAPINPUT        12
 #define NUMBER          13
 #define OPEN            14
 #define OPTIMIZE        15
 #define NUMBER          13
 #define OPEN            14
 #define OPTIMIZE        15
index c1d1828..a4645a0 100644 (file)
@@ -81,8 +81,9 @@ getATTN:
                        return(*vmacp++);
                /* End of a macro or set of nested macros */
                vmacp = 0;
                        return(*vmacp++);
                /* End of a macro or set of nested macros */
                vmacp = 0;
+               if (inopen == -1)       /* don't screw up undo for esc esc */
+                       vundkind = VMANY;
                inopen = 1;     /* restore old setting now that macro done */
                inopen = 1;     /* restore old setting now that macro done */
-               vundkind = VMANY;
        }
 #ifdef TRACE
        if (trace)
        }
 #ifdef TRACE
        if (trace)
@@ -410,7 +411,7 @@ map(c,maps)
                                        if (trace)
                                                fprintf(trace,"fpk=0: return %c",c);
 #endif
                                        if (trace)
                                                fprintf(trace,"fpk=0: return %c",c);
 #endif
-                                               macpush(&b[1]);
+                                               macpush(&b[1],1);
                                                return(c);
                                        }
                                        *q = getkey();
                                                return(c);
                                        }
                                        *q = getkey();
@@ -419,7 +420,7 @@ map(c,maps)
                                if (*p != *q)
                                        goto contin;
                        }
                                if (*p != *q)
                                        goto contin;
                        }
-                       macpush(maps[d].mapto);
+                       macpush(maps[d].mapto,1);
                        c = getkey();
 #ifdef MDEBUG
        if (trace)
                        c = getkey();
 #ifdef MDEBUG
        if (trace)
@@ -433,7 +434,7 @@ map(c,maps)
        if (trace)
                fprintf(trace,"Fail: return %c",c); /* DEBUG */
 #endif
        if (trace)
                fprintf(trace,"Fail: return %c",c); /* DEBUG */
 #endif
-       macpush(&b[1]);
+       macpush(&b[1],0);
        return(c);
 }
 
        return(c);
 }
 
@@ -442,9 +443,13 @@ map(c,maps)
  * worry about where vmacp was previously pointing. We also have to
  * check for overflow (which is typically from a recursive macro)
  * Finally we have to set a flag so the whole thing can be undone.
  * worry about where vmacp was previously pointing. We also have to
  * check for overflow (which is typically from a recursive macro)
  * Finally we have to set a flag so the whole thing can be undone.
+ * canundo is 1 iff we want to be able to undo the macro.  This
+ * is false for, for example, pushing back lookahead from fastpeekkey(),
+ * since otherwise two fast escapes can clobber our undo.
  */
  */
-macpush(st)
+macpush(st, canundo)
 char *st;
 char *st;
+int canundo;
 {
        char tmpbuf[BUFSIZ];
 
 {
        char tmpbuf[BUFSIZ];
 
@@ -456,17 +461,22 @@ char *st;
 #endif
        if (strlen(vmacp) + strlen(st) > BUFSIZ)
                error("Macro too long@ - maybe recursive?");
 #endif
        if (strlen(vmacp) + strlen(st) > BUFSIZ)
                error("Macro too long@ - maybe recursive?");
-       if (vmacp)
+       if (vmacp) {
                strcpy(tmpbuf, vmacp);
                strcpy(tmpbuf, vmacp);
+               canundo = 0;    /* can't undo inside a macro anyway */
+       }
        strcpy(vmacbuf, st);
        if (vmacp)
                strcat(vmacbuf, tmpbuf);
        vmacp = vmacbuf;
        /* arrange to be able to undo the whole macro */
        strcpy(vmacbuf, st);
        if (vmacp)
                strcat(vmacbuf, tmpbuf);
        vmacp = vmacbuf;
        /* arrange to be able to undo the whole macro */
-       inopen = -1;    /* no need to save since it had to be 1 or -1 before */
-       otchng = tchng;
-       saveall();
-       vundkind = VMANY;
+       if (canundo) {
+               inopen = -1;    /* no need to save since it had to be 1 or -1 before */
+               otchng = tchng;
+               vsave();
+               saveall();
+               vundkind = VMANY;
+       }
 #ifdef TRACE
        if (trace)
                fprintf(trace, "saveall for macro: undkind=%d, unddel=%d, undap1=%d, undap2=%d, dol=%d, unddol=%d, truedol=%d\n", undkind, lineno(unddel), lineno(undap1), lineno(undap2), lineno(dol), lineno(unddol), lineno(truedol));
 #ifdef TRACE
        if (trace)
                fprintf(trace, "saveall for macro: undkind=%d, unddel=%d, undap1=%d, undap2=%d, dol=%d, unddol=%d, truedol=%d\n", undkind, lineno(unddel), lineno(undap1), lineno(undap2), lineno(dol), lineno(unddol), lineno(truedol));
@@ -505,6 +515,8 @@ fastpeekkey()
        int trapalarm();
        register int c;
 
        int trapalarm();
        register int c;
 
+       if (inopen == -1)       /* don't work inside macros! */
+               return (0);
        signal(SIGALRM, trapalarm);
        alarm(1);
        CATCH
        signal(SIGALRM, trapalarm);
        alarm(1);
        CATCH
index b1a40cd..9fac3bc 100644 (file)
@@ -192,8 +192,8 @@ char        DEL[VBSIZE];            /* Last deleted text */
 bool   HADUP;                  /* This insert line started with ^ then ^D */
 bool   HADZERO;                /* This insert line started with 0 then ^D */
 char   INS[VBSIZE];            /* Last inserted text */
 bool   HADUP;                  /* This insert line started with ^ then ^D */
 bool   HADZERO;                /* This insert line started with 0 then ^D */
 char   INS[VBSIZE];            /* Last inserted text */
-short  Vlines;                 /* Number of file lines "before" vi command */
-short  Xcnt;                   /* External variable holding last cmd's count */
+int    Vlines;                 /* Number of file lines "before" vi command */
+int    Xcnt;                   /* External variable holding last cmd's count */
 bool   Xhadcnt;                /* Last command had explicit count? */
 short  ZERO;
 short  dir;                    /* Direction for search (+1 or -1) */
 bool   Xhadcnt;                /* Last command had explicit count? */
 short  ZERO;
 short  dir;                    /* Direction for search (+1 or -1) */
@@ -203,7 +203,7 @@ bool        hadcnt;                 /* (Almost) internal to vmain() */
 bool   heldech;                /* We owe a clear of echo area */
 bool   insmode;                /* Are in character insert mode */
 char   lastcmd[5];             /* Chars in last command */
 bool   heldech;                /* We owe a clear of echo area */
 bool   insmode;                /* Are in character insert mode */
 char   lastcmd[5];             /* Chars in last command */
-short  lastcnt;                /* Count for last command */
+int    lastcnt;                /* Count for last command */
 char   *lastcp;                /* Save current command here to repeat */
 bool   lasthad;                /* Last command had a count? */
 short  lastvgk;                /* Previous input key, if not from keyboard */
 char   *lastcp;                /* Save current command here to repeat */
 bool   lasthad;                /* Last command had a count? */
 short  lastvgk;                /* Previous input key, if not from keyboard */
@@ -214,7 +214,7 @@ char        *notesgn;               /* Change count from last command */
 char   op;                     /* Operation of current command */
 short  Peekkey;                /* Peek ahead key */
 bool   rubble;                 /* Line is filthy (in hardcopy open), redraw! */
 char   op;                     /* Operation of current command */
 short  Peekkey;                /* Peek ahead key */
 bool   rubble;                 /* Line is filthy (in hardcopy open), redraw! */
-short  vSCROLL;                /* Number lines to scroll on ^D/^U */
+int    vSCROLL;                /* Number lines to scroll on ^D/^U */
 char   *vglobp;                /* Untyped input (e.g. repeat insert text) */
 char   vmacbuf[VBSIZE];        /* Text of visual macro, hence nonnestable */
 char   *vmacp;                 /* Like vglobp but for visual macros */
 char   *vglobp;                /* Untyped input (e.g. repeat insert text) */
 char   vmacbuf[VBSIZE];        /* Text of visual macro, hence nonnestable */
 char   *vmacp;                 /* Like vglobp but for visual macros */
index 66bc389..e894dee 100644 (file)
@@ -644,6 +644,7 @@ insrt:
                case 'P':
                case 'p':
                        vmoving = 0;
                case 'P':
                case 'p':
                        vmoving = 0;
+                       forbid (inopen < 0);
                        /*
                         * If previous delete was partial line, use an
                         * append or insert to put it back so as to
                        /*
                         * If previous delete was partial line, use an
                         * append or insert to put it back so as to
@@ -762,7 +763,10 @@ pfixup:
                        vsave();
                        ckaw();
                        oglobp = globp;
                        vsave();
                        ckaw();
                        oglobp = globp;
-                       globp = "e! #";
+                       if (value(AUTOWRITE))
+                               globp = "e! #";
+                       else
+                               globp = "e #";
                        goto gogo;
 
                /*
                        goto gogo;
 
                /*
@@ -1000,6 +1004,7 @@ fixup:
 fonfon:
                        beep();
                        vmacp = 0;
 fonfon:
                        beep();
                        vmacp = 0;
+                       inopen = 1;     /* might have been -1 */
                        continue;
                }
 
                        continue;
                }
 
index 23554f3..86334bc 100644 (file)
@@ -752,7 +752,7 @@ vgetsplit()
 /*
  * Vmaxrep determines the maximum repetitition factor
  * allowed that will yield total line length less than
 /*
  * Vmaxrep determines the maximum repetitition factor
  * allowed that will yield total line length less than
- * 512 characters and also does hacks for the R command.
+ * LBSIZE characters and also does hacks for the R command.
  */
 vmaxrep(ch, cnt)
        char ch;
  */
 vmaxrep(ch, cnt)
        char ch;