las) (05/09/89)
In article <793@cimcor.mn.org> jim_d@cimcor.mn.org (Jim Dahlberg) writes: >> >If you are looking for a good "micro-emacs", I'd suggest Jove4.12 (not >> >easy to port to SysV, but hopefully the next version will be). >> Hmmm... True, I had to work at it, but I've got it working with SysV. I >> Signed: Larry A. Shurr (att!cbnews!cbema!las) >Larry, I started to compile Jove 4.12 on our SysV, but also found it >difficult. Unfortunately I really don't have time to work on it. >Fortunately, you have done it, so could you tell 'the net' how you did it? Sure. Happy to oblige. ---------------snip----------------snip---------------snip--------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting test in a file # 3. Execute the file with /bin/sh (not csh) to create the files: # # Makefile.diff # README # ask1.c # ask2.c # fp.h.diff # io.h.diff # malloc.c.diff # sysdep.h.diff # term.c.diff # tune.h.diff # util.c.diff # # Created by las (Larry A. Shurr) Fri May 5 15:32:34 EDT 1989 # if test -f 'Makefile.diff' then echo shar: will not over-write existing file "'Makefile.diff'" else echo extracting "'Makefile.diff'" sed 's/^X//' >Makefile.diff <<'SHAR_EOF' X*** Makefile~ X--- Makefile X************** X*** 5,10 X # included in all the files. # X ########################################################################### X X # TMPDIR is where the tmp files get stored, usually /tmp or /tmp/jove. If X # your system does not remove subdirectories of /tmp on reboot (lots do X # remove them these days) then it makes sense to make TMPDIR be /tmp/jove. X--- 5,14 ----- X # included in all the files. # X ########################################################################### X X+ # Compiling with GNU C (tested using V1.34) works fine but you have to use X+ # the -traditional option. -Larry A. Shurr X+ # CC = gcc -traditional X+ X # TMPDIR is where the tmp files get stored, usually /tmp or /tmp/jove. If X # your system does not remove subdirectories of /tmp on reboot (lots do X # remove them these days) then it makes sense to make TMPDIR be /tmp/jove. X************** X*** 17,22 X # JOVE, RECOVER and TEACHJOVE. MANEXT is the extension for the man pages, X # e.g., jove.1 or jove.l or jove.m. X X DESTDIR = X TMPDIR = /tmp X LIBDIR = /home/chacha/jpayne/lib/jove X--- 21,36 ----- X # JOVE, RECOVER and TEACHJOVE. MANEXT is the extension for the man pages, X # e.g., jove.1 or jove.l or jove.m. X X+ # I use /local rather than /usr/local because our previous administration X+ # group defined it that way. The /local directory is its own file system X+ # on our machines and they did not mount it on /usr/local because they set X+ # up the backup scripts (which use volcopy) to omit copying anything in X+ # file systems mounted anywhere under /usr. It was a dumb idea - I know - X+ # but due to historical precedent, it would be hard to change now. So X+ # set LOCAL for for your local directory. -Larry A. Shurr X+ X+ LOCAL = /local X+ X DESTDIR = X TMPDIR = /tmp X LIBDIR = $(LOCAL)/lib/jove X************** X*** 19,27 X X DESTDIR = X TMPDIR = /tmp X! LIBDIR = /home/chacha/jpayne/lib/jove X! BINDIR = /home/chacha/jpayne/bin X! MANDIR = /home/chacha/jpayne/lib/manl X MANEXT = l X JSHELL = /bin/csh X X--- 33,41 ----- X X DESTDIR = X TMPDIR = /tmp X! LIBDIR = $(LOCAL)/lib/jove X! BINDIR = $(LOCAL)/bin X! MANDIR = $(LOCAL)/lib/manl X MANEXT = l X JSHELL = /bin/csh X X************** X*** 25,41 X MANEXT = l X JSHELL = /bin/csh X X! # These should all just be right if the above ones are. X! JOVE = $(DESTDIR)$(BINDIR)/jove X! TEACHJOVE = $(DESTDIR)$(BINDIR)/teachjove X! RECOVER = $(DESTDIR)$(LIBDIR)/recover X! PORTSRV = $(DESTDIR)$(LIBDIR)/portsrv X! KBD = $(DESTDIR)$(LIBDIR)/kbd X! JOVERC = $(DESTDIR)$(LIBDIR)/jove.rc X! CMDS.DOC = $(DESTDIR)$(LIBDIR)/cmds.doc X! TEACH-JOVE = $(DESTDIR)$(LIBDIR)/teach-jove X! JOVEM = $(DESTDIR)$(MANDIR)/jove.$(MANEXT) X! TEACHJOVEM = $(DESTDIR)$(MANDIR)/teachjove.$(MANEXT) X X # Select the right libraries for your system. X # 2.10BSD:LIBS = -ltermcap X--- 39,47 ----- X MANEXT = l X JSHELL = /bin/csh X X! DBINDIR = $(DESTDIR)$(BINDIR) X! DLIBDIR = $(DESTDIR)$(LIBDIR) X! DMANDIR = $(DESTDIR)$(MANDIR) X X # These should all just be right if the above ones are. X JOVE = $(DBINDIR)/jove X************** X*** 37,42 X JOVEM = $(DESTDIR)$(MANDIR)/jove.$(MANEXT) X TEACHJOVEM = $(DESTDIR)$(MANDIR)/teachjove.$(MANEXT) X X # Select the right libraries for your system. X # 2.10BSD:LIBS = -ltermcap X # v7: LIBS = -ltermcap X--- 43,60 ----- X DLIBDIR = $(DESTDIR)$(LIBDIR) X DMANDIR = $(DESTDIR)$(MANDIR) X X+ # These should all just be right if the above ones are. X+ JOVE = $(DBINDIR)/jove X+ TEACHJOVE = $(DBINDIR)/teachjove X+ RECOVER = $(DLIBDIR)/recover X+ PORTSRV = $(DLIBDIR)/portsrv X+ KBD = $(DLIBDIR)/kbd X+ JOVERC = $(DLIBDIR)/jove.rc X+ CMDS.DOC = $(DLIBDIR)/cmds.doc X+ TEACH-JOVE = $(DLIBDIR)/teach-jove X+ JOVEM = $(DMANDIR)/jove.$(MANEXT) X+ TEACHJOVEM = $(DMANDIR)/teachjove.$(MANEXT) X+ X # Select the right libraries for your system. X # 2.10BSD:LIBS = -ltermcap X # v7: LIBS = -ltermcap X************** X*** 46,52 X # SysV Rel. 2: LIBS = -lcurses X # SCO Xenix: LIBS = -ltermcap -lx X X! LIBS = -ltermcap X X # If you are not VMUNIX (vax running Berkeley Version 4), you must specify X # the -i flags (split I/D space) and maybe the -x option (for adb to work). X--- 64,70 ----- X # SysV Rel. 2: LIBS = -lcurses X # SCO Xenix: LIBS = -ltermcap -lx X X! LIBS = -lcurses X X # If you are not VMUNIX (vax running Berkeley Version 4), you must specify X # the -i flags (split I/D space) and maybe the -x option (for adb to work). X************** X*** 74,80 X X CFLAGS = -O X X! BASESEG = funcdefs.o keys.o argcount.o ask.o buf.o ctype.o delete.o \ X disp.o insert.o io.o jove.o malloc.o marks.o misc.o re.o \ X screen.o tune.o util.o vars.o version.o list.o keymaps.o X OVLAY1 = abbrev.o rec.o paragraph.o fmt.o X--- 92,98 ----- X X CFLAGS = -O X X! BASESEG = funcdefs.o keys.o argcount.o ask1.o ask2.o buf.o ctype.o delete.o \ X disp.o insert.o io.o jove.o malloc.o marks.o misc.o re.o \ X screen.o tune.o util.o vars.o version.o list.o keymaps.o X OVLAY1 = abbrev.o rec.o paragraph.o fmt.o X************** X*** 85,91 X X OBJECTS = $(BASESEG) $(OVLAY1) $(OVLAY2) $(OVLAY3) $(OVLAY4) $(OVLAY5) X X! C_SRC = funcdefs.c abbrev.c argcount.c ask.c buf.c c.c case.c ctype.c \ X delete.c disp.c extend.c fp.c fmt.c insert.c io.c iproc.c \ X jove.c list.c macros.c malloc.c marks.c misc.c move.c paragraph.c \ X proc.c re.c re1.c rec.c scandir.c screen.c term.c util.c \ X--- 103,109 ----- X X OBJECTS = $(BASESEG) $(OVLAY1) $(OVLAY2) $(OVLAY3) $(OVLAY4) $(OVLAY5) X X! C_SRC = funcdefs.c abbrev.c argcount.c ask1.c ask2.c buf.c c.c case.c ctype.c \ X delete.c disp.c extend.c fp.c fmt.c insert.c io.c iproc.c \ X jove.c list.c macros.c malloc.c marks.c misc.c move.c paragraph.c \ X proc.c re.c re1.c rec.c scandir.c screen.c term.c util.c \ X************** X*** 188,194 X X # install doesn't work for Xenix (no install program) X X! install: $(DESTDIR)$(LIBDIR) $(TEACH-JOVE) $(CMDS.DOC) $(JOVERC) \ X $(PORTSRV) $(KBD) $(RECOVER) $(JOVE) $(TEACHJOVE) $(JOVEM) \ X $(RECOVERM) $(TEACHJOVEM) X X--- 206,212 ----- X X # install doesn't work for Xenix (no install program) X X! install: $(DLIBDIR) $(TEACH-JOVE) $(CMDS.DOC) $(JOVERC) \ X $(PORTSRV) $(KBD) $(RECOVER) $(JOVE) $(TEACHJOVE) $(JOVEM) \ X $(RECOVERM) $(TEACHJOVEM) X X************** X*** 192,199 X $(PORTSRV) $(KBD) $(RECOVER) $(JOVE) $(TEACHJOVE) $(JOVEM) \ X $(RECOVERM) $(TEACHJOVEM) X X! $(DESTDIR)$(LIBDIR): X! -mkdir $(DESTDIR)$(LIBDIR) X X $(TEACH-JOVE): doc/teach-jove X install -c -m 644 doc/teach-jove $(TEACH-JOVE) X--- 210,217 ----- X $(PORTSRV) $(KBD) $(RECOVER) $(JOVE) $(TEACHJOVE) $(JOVEM) \ X $(RECOVERM) $(TEACHJOVEM) X X! $(DLIBDIR): X! -mkdir $(DLIBDIR) X X $(TEACH-JOVE): doc/teach-jove X -rm $(TEACH-JOVE) X************** X*** 196,202 X -mkdir $(DESTDIR)$(LIBDIR) X X $(TEACH-JOVE): doc/teach-jove X! install -c -m 644 doc/teach-jove $(TEACH-JOVE) X X doc/cmds.doc: doc/cmds.doc.nr doc/jove.4 doc/jove.5 X nroff doc/cmds.doc.nr doc/jove.4 doc/jove.5 > doc/cmds.doc X--- 214,221 ----- X -mkdir $(DLIBDIR) X X $(TEACH-JOVE): doc/teach-jove X! -rm $(TEACH-JOVE) X! /etc/install -c $(DLIBDIR) -m 644 doc/teach-jove X X doc/cmds.doc: doc/cmds.doc.nr doc/jove.4 doc/jove.5 X nroff doc/cmds.doc.nr doc/jove.4 doc/jove.5 > doc/cmds.doc X************** X*** 202,208 X nroff doc/cmds.doc.nr doc/jove.4 doc/jove.5 > doc/cmds.doc X X $(CMDS.DOC): doc/cmds.doc X! install -c -m 644 doc/cmds.doc $(CMDS.DOC) X X $(JOVERC): doc/system.rc X install -c -m 644 doc/system.rc $(JOVERC) X--- 221,228 ----- X nroff doc/cmds.doc.nr doc/jove.4 doc/jove.5 > doc/cmds.doc X X $(CMDS.DOC): doc/cmds.doc X! -rm $(CMDS.DOC) X! /etc/install -c $(DLIBDIR) -m 644 doc/cmds.doc X X $(JOVERC): doc/system.rc X -rm $(JOVERC) X************** X*** 205,211 X install -c -m 644 doc/cmds.doc $(CMDS.DOC) X X $(JOVERC): doc/system.rc X! install -c -m 644 doc/system.rc $(JOVERC) X X $(PORTSRV): portsrv X install -c -s -m 755 portsrv $(PORTSRV) X--- 225,234 ----- X /etc/install -c $(DLIBDIR) -m 644 doc/cmds.doc X X $(JOVERC): doc/system.rc X! -rm $(JOVERC) X! ln doc/system.rc doc/jove.rc X! /etc/install -c $(DLIBDIR) -m 644 doc/jove.rc X! rm doc/jove.rc X X $(PORTSRV): portsrv X -rm $(PORTSRV) X************** X*** 208,214 X install -c -m 644 doc/system.rc $(JOVERC) X X $(PORTSRV): portsrv X! install -c -s -m 755 portsrv $(PORTSRV) X X $(KBD): kbd X install -c -s -m 755 kbd $(KBD) X--- 231,238 ----- X rm doc/jove.rc X X $(PORTSRV): portsrv X! -rm $(PORTSRV) X! /etc/install -c $(DLIBDIR) -s -m 755 portsrv X X $(KBD): kbd X -rm $(KBD) X************** X*** 211,217 X install -c -s -m 755 portsrv $(PORTSRV) X X $(KBD): kbd X! install -c -s -m 755 kbd $(KBD) X X $(RECOVER): recover X install -c -s -m 755 recover $(RECOVER) X--- 235,242 ----- X /etc/install -c $(DLIBDIR) -s -m 755 portsrv X X $(KBD): kbd X! -rm $(KBD) X! /etc/install -c $(DLIBDIR) -s -m 755 kbd X X $(RECOVER): recover X -rm $(RECOVER) X************** X*** 214,220 X install -c -s -m 755 kbd $(KBD) X X $(RECOVER): recover X! install -c -s -m 755 recover $(RECOVER) X X $(JOVE): xjove X install -c -m 755 xjove $(JOVE) X--- 239,246 ----- X /etc/install -c $(DLIBDIR) -s -m 755 kbd X X $(RECOVER): recover X! -rm $(RECOVER) X! /etc/install -c $(DLIBDIR) -s -m 755 recover X X $(JOVE): xjove X -rm $(JOVE) X************** X*** 217,223 X install -c -s -m 755 recover $(RECOVER) X X $(JOVE): xjove X! install -c -m 755 xjove $(JOVE) X X $(TEACHJOVE): teachjove X install -c -s -m 755 teachjove $(TEACHJOVE) X--- 243,252 ----- X /etc/install -c $(DLIBDIR) -s -m 755 recover X X $(JOVE): xjove X! -rm $(JOVE) X! ln xjove jove X! /etc/install -c $(DBINDIR) -m 755 jove X! rm jove X X $(TEACHJOVE): teachjove X -rm $(TEACHJOVE) X************** X*** 220,226 X install -c -m 755 xjove $(JOVE) X X $(TEACHJOVE): teachjove X! install -c -s -m 755 teachjove $(TEACHJOVE) X X $(JOVEM): doc/jove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X--- 249,256 ----- X rm jove X X $(TEACHJOVE): teachjove X! -rm $(TEACHJOVE) X! /etc/install -c $(DBINDIR) -s -m 755 teachjove X X $(JOVEM): doc/jove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X************** X*** 225,232 X $(JOVEM): doc/jove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X -e 's;LIBDIR;$(LIBDIR);' \ X! -e 's;SHELL;$(JSHELL);' doc/jove.nr > /tmp/jove.nr X! install -m 644 /tmp/jove.nr $(JOVEM) X X $(TEACHJOVEM): doc/teachjove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X--- 255,263 ----- X $(JOVEM): doc/jove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X -e 's;LIBDIR;$(LIBDIR);' \ X! -e 's;SHELL;$(JSHELL);' doc/jove.nr > /tmp/jove.$(MANEXT) X! -rm $(JOVEM) X! /etc/install -c $(DMANDIR) -m 644 /tmp/jove.$(MANEXT) X X $(TEACHJOVEM): doc/teachjove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X************** X*** 231,238 X $(TEACHJOVEM): doc/teachjove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X -e 's;LIBDIR;$(LIBDIR);' \ X! -e 's;SHELL;$(JSHELL);' doc/teachjove.nr > /tmp/teachjove.nr X! install -m 644 /tmp/teachjove.nr $(TEACHJOVEM) X X echo: X @echo $(C-FILES) $(HEADERS) X--- 262,270 ----- X $(TEACHJOVEM): doc/teachjove.nr X @sed -e 's;TMPDIR;$(TMPDIR);' \ X -e 's;LIBDIR;$(LIBDIR);' \ X! -e 's;SHELL;$(JSHELL);' doc/teachjove.nr > /tmp/teachjove.$(MANEXT) X! -rm $(TEACHJOVEM) X! /etc/install -c $(DMANDIR) -m 644 /tmp/teachjove.$(MANEXT) X X echo: X @echo $(C-FILES) $(HEADERS) X************** X*** 308,316 X argcount.o: argcount.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h X argcount.o: ./iproc.h ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h X argcount.o: ./screen.h ./style.h ./externs.h X! ask.o: ask.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h ./iproc.h X! ask.o: ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h ./screen.h X! ask.o: ./style.h ./externs.h ./termcap.h ./ctype.h ./chars.h ./disp.h X buf.o: buf.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h ./iproc.h X buf.o: ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h ./screen.h X buf.o: ./style.h ./externs.h ./ctype.h ./disp.h X--- 340,351 ----- X argcount.o: argcount.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h X argcount.o: ./iproc.h ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h X argcount.o: ./screen.h ./style.h ./externs.h X! ask1.o: ask1.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h ./iproc.h X! ask1.o: ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h ./screen.h X! ask1.o: ./style.h ./externs.h ./termcap.h ./ctype.h ./chars.h ./disp.h X! ask2.o: ask2.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h ./iproc.h X! ask2.o: ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h ./screen.h X! ask2.o: ./style.h ./externs.h ./termcap.h ./ctype.h ./chars.h ./disp.h X buf.o: buf.c ./jove.h ./tune.h ./sysdep.h ./buf.h ./wind.h ./io.h ./iproc.h X buf.o: ./dataobj.h ./keymaps.h ./argcount.h ./util.h ./vars.h ./screen.h X buf.o: ./style.h ./externs.h ./ctype.h ./disp.h SHAR_EOF if test 12927 -ne "`wc -c < 'Makefile.diff'`" then echo shar: error transmitting "'Makefile.diff'" '(should have been 12927 characters)' fi fi if test -f 'README' then echo shar: will not over-write existing file "'README'" else echo extracting "'README'" sed 's/^X//' >README <<'SHAR_EOF' XHere you have updates for making Jove V4.12 compile under System V. I Xhave compiled jove using these changes for the following: X X Computer Operating System C Compiler X --------- ----------------------- ----------- X AT&T 3b2 Unix System V Rel 2.0.5 pcc X AT&T 3b15 Unix System V Rel 2.1.1 pcc X AT&T 3b20 Unix System V Rel 2.0 pcc X AT&T 6386 Unix System V Rel 3.1 pcc X AT&T 6386 Unix System V Rel 3.1 gcc (GNU C) X XThus there is some reason to hope that it will compile for your System V Xas well. 'Course I can't guarantee it, but you knew that anyway. X XMy apologies for the "hackiness" of the changes - I would not call them Xsmoothly integrated into the installation, but then the installation Xwas not all that could be wished for to begin with. The resulting pro- Xgram does, however, work well and I like the way it handles keymaps. X XI've happily used Daniel Lawrence's MicroEmacs for years on the PC, but XI've never liked the way it manages the display when running on Unix - Xit always repaints the screen for major updates, it never tries to Xreuse onscreen data by scrolling it - that's not a problem on a fast PC Xdisplay, but it's marginal at 9600 baud and exasperating at 1200. Jove Xis somewhat more intelligent and that helps on slow dialup lines. Now Xif I could get it to compile using Turbo C 2.0 or Lattice 3.4 that'd be Xgreat - maybe I should spring for Quick C, I hate to have to spend Xmajor bucks for the full MicroSoft C package in addition to the two C's XI already have, but what do you do when they're not all compatible? X*sigh* (perhaps I should say sh*t!) X XNotes: X X* The diff files are context diff files for changing files in the Jove X V4.12 distribution. X X* The files ask1.c and ask2.c are complete source files which should be X placed in the jove distribution directory in place of the file ask.c. X On the AT&T 3b2 and 3b15 systems, the source file was too long for X the compiler (of course the compiler didn't tell me this, it simply X issued peculiar and unhelpful error messages). The source file ask.c X may not be too long for other compilers, but I have not checked). X X* The following files are included in this System V conversion package: X X Makefile.diff Diff file for updating Makefile X README This file X ask1.c Part 1 of ask.c replacement X ask2.c Part 2 of ask.c replacement X fp.h.diff Diff file for updating fp.h X io.h.diff Diff file for updating io.h X malloc.c.diff Diff file for updating malloc.c X sysdep.h.diff Diff file for updating sysdep.h X term.c.diff Diff file for updating term.c X tune.h.diff Diff file for updating tune.h X util.c.diff Diff file for updating util.c X XGood luck with your conversion to System V Jove! X Xregards, Larry (las@cbema.ATT.COM for a little while longer anyway) X(after June 31, 1989 get my address by watching for my postings on XUSENET in comp.sys.ibm.pc, comp.binaries.ibm.pc.d, comp.editors, Xcomp.emacs or other likely looking groups) SHAR_EOF if test 2937 -ne "`wc -c < 'README'`" then echo shar: error transmitting "'README'" '(should have been 2937 characters)' fi fi if test -f 'ask1.c' then echo shar: will not over-write existing file "'ask1.c'" else echo extracting "'ask1.c'" sed 's/^X//' >ask1.c <<'SHAR_EOF' X/*************************************************************************** X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE * X * is provided to you without charge, and with no warranty. You may give * X * away copies of JOVE, including sources, provided that this notice is * X * included in all the files. * X ***************************************************************************/ X X#include "jove.h" X#include "termcap.h" X#include "ctype.h" X#include "chars.h" X#include "disp.h" X#include "fp.h" X#include "scandir.h" X X#include <signal.h> X X#if defined(MAC) X# include "mac.h" X#else /* !MAC */ X# ifdef STDARGS X# include <stdargs.h> X# else X# include <varargs.h> X# endif X# if defined(F_COMPLETION) X# include <sys/stat.h> X# endif X#endif /* !MAC */ X Xprivate Buffer * get_minibuf proto((void)); X Xchar * real_ask proto((char *, int (*)(), char *, char *)); X Xint f_complete proto((int)); X Xprivate int X bad_extension proto((char *)), X isdir proto((char *)); Xprivate void X fill_in proto((char **, int)), X EVexpand proto((void)); X Xint AbortChar = CTL('G'), X DoEVexpand = NO; /* should we expand evironment variables? */ X Xint Asking = NO; Xchar Minibuf[LBSIZE]; Xprivate Line *CurAskPtr = 0; /* points at some line in mini-buffer */ Xprivate Buffer *AskBuffer = 0; /* Askbuffer points to actual structure */ X X/* The way the mini-buffer works is this: The first line of the mini-buffer X is where the user does his stuff. The rest of the buffer contains X strings that the user often wants to use, for instance, file names, or X common search strings, etc. If he types C-N or C-P while in ask(), we X bump the point up or down a line and extract the contents (we make sure X is somewhere in the mini-buffer). */ X Xstatic Buffer * Xget_minibuf() X{ X if (AskBuffer) { /* make sure ut still exists */ X register Buffer *b; X X for (b = world; b != 0; b = b->b_next) X if (b == AskBuffer) X return b; X } X AskBuffer = do_select((Window *) 0, "*minibuf*"); X AskBuffer->b_type = B_SCRATCH; X return AskBuffer; X} X X/* Add a string to the mini-buffer. */ X Xvoid Xminib_add(str, movedown) Xchar *str; Xint movedown; X{ X register Buffer *saveb = curbuf; X X SetBuf(get_minibuf()); X LineInsert(1); X ins_str(str, NO); X if (movedown) X CurAskPtr = curline; X SetBuf(saveb); X} X X/* look for any substrings of the form $foo in linebuf, and expand X them according to their value in the environment (if possible) - X this munges all over curchar and linebuf without giving it a second X thought (I must be getting lazy in my old age) */ Xprivate void XEVexpand() X{ X register int c; X register char *lp = linebuf, X *ep; X char varname[128], X *vp, X *lp_start; X Mark *m = MakeMark(curline, curchar, M_FLOATER); X X while ((c = *lp++) != '\0') { X if (c != '$') X continue; X lp_start = lp - 1; /* the $ */ X vp = varname; X while ((c = *lp++) != '\0') { X if (!isword(c)) X break; X *vp++ = c; X } X *vp = '\0'; X /* if we find an env. variable with the right X name, we insert it in linebuf, and then delete X the variable name that we're replacing - and X then we continue in case there are others ... */ X if ((ep = getenv(varname)) != NIL) { X curchar = lp_start - linebuf; X ins_str(ep, NO); X del_char(FORWARD, strlen(varname) + 1, NO); X lp = linebuf + curchar; X } X } X ToMark(m); X DelMark(m); X} X Xint InRealAsk = 0; X Xchar * Xreal_ask(delim, d_proc, def, prompt) Xchar *delim, X *def, X *prompt; Xint (*d_proc)(); X{ X jmp_buf savejmp; X int c, X prompt_len; X Buffer *saveb = curbuf; X int abort = 0, X no_typed = 0; X data_obj *push_cmd = LastCmd; X int o_a_v = arg_value(), X o_i_an_a = is_an_arg(); X#ifdef MAC X menus_off(); X#endif X X if (InRealAsk) X complain((char *) 0); X push_env(savejmp); X InRealAsk += 1; X SetBuf(get_minibuf()); X if (!inlist(AskBuffer->b_first, CurAskPtr)) X CurAskPtr = curline; X prompt_len = strlen(prompt); X ToFirst(); /* Beginning of buffer. */ X linebuf[0] = '\0'; X modify(); X makedirty(curline); X X if (setjmp(mainjmp)) X if (InJoverc) { /* this is a kludge */ X abort = YES; X goto cleanup; X } X X for (;;) { X clr_arg_value(); X last_cmd = this_cmd; X init_strokes(); Xcont: s_mess("%s%s", prompt, linebuf); X Asking = curchar + prompt_len; X c = getch(); X if ((c == EOF) || index(delim, c)) { X if (DoEVexpand) X EVexpand(); X if (d_proc == (int(*)())0 || (*d_proc)(c) == 0) X goto cleanup; X } else if (c == AbortChar) { X message("[Aborted]"); X abort = YES; X goto cleanup; X } else switch (c) { X case CTL('N'): X case CTL('P'): X if (CurAskPtr != 0) { X int n = (c == CTL('P') ? -arg_value() : arg_value()); X CurAskPtr = next_line(CurAskPtr, n); X if (CurAskPtr == curbuf->b_first && CurAskPtr->l_next != 0) X CurAskPtr = CurAskPtr->l_next; X (void) ltobuf(CurAskPtr, linebuf); X modify(); X makedirty(curline); X Eol(); X this_cmd = 0; X } X break; X X case CTL('R'): X if (def) X ins_str(def, NO); X else X rbell(); X break; X X default: X dispatch(c); X break; X } X if (curbuf != AskBuffer) X SetBuf(AskBuffer); X if (curline != curbuf->b_first) { X CurAskPtr = curline; X curline = curbuf->b_first; /* with whatever is in linebuf */ X } X if (this_cmd == ARG_CMD) X goto cont; X } Xcleanup: X pop_env(savejmp); X X LastCmd = push_cmd; X set_arg_value(o_a_v); X set_is_an_arg(o_i_an_a); X no_typed = (linebuf[0] == '\0'); X strcpy(Minibuf, linebuf); X SetBuf(saveb); X InRealAsk = Asking = Interactive = NO; X if (!abort) { X if (!charp()) { X Placur(ILI, 0); X flusho(); X } X if (no_typed) X return 0; X } else X complain(mesgbuf); X return Minibuf; X} X X#ifdef STDARGS X char * Xask(char *def, char *fmt,...) X#else X /*VARARGS2*/ char * Xask(def, fmt, va_alist) X char *def, X *fmt; X va_dcl X#endif X{ X char prompt[128]; X char *ans; X va_list ap; X X va_init(ap, fmt); X format(prompt, sizeof prompt, fmt, ap); X va_end(ap); X ans = real_ask("\r\n", (int (*)()) 0, def, prompt); X if (ans == 0) { /* Typed nothing. */ X if (def == 0) X complain("[No default]"); X return def; X } X return ans; X} X X#ifdef STDARGS X char * Xdo_ask(char *delim, int (*d_proc)(), char *def, char *fmt,...) X#else X /*VARARGS4*/ char * Xdo_ask(delim, d_proc, def, fmt, va_alist) X char *delim, X *def, X *fmt; X int (*d_proc)(); X va_dcl X#endif X{ X char prompt[128]; X va_list ap; X X va_init(ap, fmt); X format(prompt, sizeof prompt, fmt, ap); X va_end(ap); X return real_ask(delim, d_proc, def, prompt); X} X X#ifdef STDARGS X int Xyes_or_no_p(char *fmt, ...) X#else X /*VARARGS1*/ int Xyes_or_no_p(fmt, va_alist) X char *fmt; X va_dcl X#endif X{ X char prompt[128]; X int c; X va_list ap; X X va_init(ap, fmt); X format(prompt, sizeof prompt, fmt, ap); X va_end(ap); X for (;;) { X message(prompt); X Asking = strlen(prompt); /* so redisplay works */ X c = getch(); X Asking = NO; X if (c == AbortChar) X complain("[Aborted]"); X switch (CharUpcase(c)) { X case 'Y': X return YES; X X case 'N': X return NO; X X default: X add_mess("[Type Y or N]"); X SitFor(10); X } X } X /* NOTREACHED */ X} X X#if defined(F_COMPLETION) Xstatic char *fc_filebase; Xint DispBadFs = YES; /* display bad file names? */ X# if !defined(MSDOS) Xchar BadExtensions[128] = ".o"; X# else /* MSDOS */ Xchar BadExtensions[128] = ".obj .exe .com .bak .arc .lib .zoo"; X# endif /* MSDOS */ X Xprivate int Xbad_extension(name) Xchar *name; X{ X char *ip, X *bads = BadExtensions; X int namelen = strlen(name), X ext_len, X stop = 0; X X do { X if ((ip = index(bads, ' ')) == 0) { X ip = bads + strlen(bads); X stop = YES; X } X if ((ext_len = ip - bads) == 0) X continue; X if ((ext_len < namelen) && X (strncmp(&name[namelen - ext_len], bads, ext_len) == 0)) X return YES; X } while ((bads = ip + 1), !stop); X return NO; X} X Xprivate int Xf_match(file) Xchar *file; X{ X int len = strlen(fc_filebase); X X if (DispBadFs == NO) X if (bad_extension(file)) X return NO; X X return ((len == 0) || X#if defined(MSDOS) X (casencmp(file, fc_filebase, strlen(fc_filebase)) == 0) X#else X (strncmp(file, fc_filebase, strlen(fc_filebase)) == 0) X#endif X ); X} X Xprivate int Xisdir(name) Xchar *name; X{ X struct stat stbuf; X char filebuf[FILESIZE]; X X PathParse(name, filebuf); X return ((stat(filebuf, &stbuf) != -1) && X (stbuf.st_mode & S_IFDIR) == S_IFDIR); X} X Xprivate void Xfill_in(dir_vec, n) Xregister char **dir_vec; Xint n; X{ X int minmatch = 0, X numfound = 0, X lastmatch = -1, X i, X the_same = TRUE, /* After filling in, are we the same X as when we were called? */ X is_ntdir; /* Is Newly Typed Directory name */ X X for (i = 0; i < n; i++) { X /* if it's no, then we have already filtered them out X in f_match() so there's no point in doing it again */ X if (DispBadFs == YES) { X if (bad_extension(dir_vec[i])) X continue; X } X if (numfound) X minmatch = min(minmatch, X numcomp(dir_vec[lastmatch], dir_vec[i])); X else X minmatch = strlen(dir_vec[i]); X lastmatch = i; X numfound += 1; X } X /* Ugh. Beware--this is hard to get right in a reasonable X manner. Please excuse this code--it's past my bedtime. */ X if (numfound == 0) { X rbell(); X return; X } X Eol(); X if (minmatch > strlen(fc_filebase)) { X the_same = FALSE; X null_ncpy(fc_filebase, dir_vec[lastmatch], (size_t) minmatch); X Eol(); X makedirty(curline); X } X is_ntdir = ((numfound == 1) && X (curchar > 0) && X (linebuf[curchar - 1] != '/') && X (isdir(linebuf))); X if (the_same && !is_ntdir) { X add_mess((n == 1) ? " [Unique]" : " [Ambiguous]"); X SitFor(7); X } X if (is_ntdir) X insert_c('/', 1); X} X X/* called from do_ask() when one of "\r\n ?" is typed. Does the right X thing, depending on which. */ X Xint Xf_complete(c) Xint c; X{ X char dir[FILESIZE], X **dir_vec; X int nentries, X i; X X if (c == CR || c == LF) X return 0; /* tells ask to return now */ X#if !defined(MSDOS /* kg */) X if ((fc_filebase = rindex(linebuf, '/')) != 0) { X#else /* MSDOS */ X fc_filebase = rindex(linebuf, '/'); X if (fc_filebase == (char *)0) X fc_filebase = rindex(linebuf, '\\'); X if (fc_filebase == (char *)0) X fc_filebase = rindex(linebuf, ':'); X if (fc_filebase != (char *)0) { X#endif /* MSDOS */ X char tmp[FILESIZE]; X X fc_filebase += 1; X null_ncpy(tmp, linebuf, (size_t) (fc_filebase - linebuf)); X if (tmp[0] == '\0') X strcpy(tmp, "/"); X PathParse(tmp, dir); X } else { X fc_filebase = linebuf; X strcpy(dir, "."); X } X if ((nentries = scandir(dir, &dir_vec, f_match, alphacomp)) == -1) { X add_mess(" [Unknown directory: %s]", dir); X SitFor(7); X return 1; X } X if (nentries == 0) { X add_mess(" [No match]"); X SitFor(7); X } else if (c == ' ' || c == '\t') X fill_in(dir_vec, nentries); X else { X /* we're a '?' */ X int maxlen = 0, X ncols, X col, X lines, X linespercol; X X TOstart("Completion", FALSE); /* false means newline only on request */ X Typeout("(! means file will not be chosen unless typed explicitly)"); X Typeout((char *) 0); X Typeout("Possible completions (in %s):", dir); X Typeout((char *) 0); X X for (i = 0; i < nentries; i++) X maxlen = max(strlen(dir_vec[i]), maxlen); X maxlen += 4; /* pad each column with at least 4 spaces */ X ncols = (CO - 2) / maxlen; X linespercol = 1 + (nentries / ncols); X X for (lines = 0; lines < linespercol; lines++) { X for (col = 0; col < ncols; col++) { X int isbad, X which; X X which = (col * linespercol) + lines; X if (which >= nentries) X break; X if (DispBadFs == YES) X isbad = bad_extension(dir_vec[which]); X else X isbad = NO; X Typeout("%s%-*s", isbad ? "!" : NullStr, X maxlen - isbad, dir_vec[which]); X } X Typeout((char *) 0); X } X TOstop(); X } X freedir(&dir_vec, nentries); X return 1; X} X X#endif X SHAR_EOF if test 11508 -ne "`wc -c < 'ask1.c'`" then echo shar: error transmitting "'ask1.c'" '(should have been 11508 characters)' fi fi if test -f 'ask2.c' then echo shar: will not over-write existing file "'ask2.c'" else echo extracting "'ask2.c'" sed 's/^X//' >ask2.c <<'SHAR_EOF' X/*************************************************************************** X * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne. JOVE * X * is provided to you without charge, and with no warranty. You may give * X * away copies of JOVE, including sources, provided that this notice is * X * included in all the files. * X ***************************************************************************/ X X#include "jove.h" X#include "termcap.h" X#include "ctype.h" X#include "chars.h" X#include "disp.h" X#include "fp.h" X#include "scandir.h" X X#include <signal.h> X X#if defined(MAC) X# include "mac.h" X#else /* !MAC */ X# ifdef STDARGS X# include <stdargs.h> X# else X# include <varargs.h> X# endif X# if defined(F_COMPLETION) X# include <sys/stat.h> X# endif X#endif /* !MAC */ X Xextern int X AbortChar, X DoEVexpand; /* should we expand evironment variables? */ X Xextern int X Asking; X Xchar Minibuf[LBSIZE]; X Xint f_complete proto((int)); Xchar * real_ask proto((char *, int (*)(), char *, char *)); X Xchar * Xask_file(prmt, def, buf) Xchar *prmt, X *def, X *buf; X{ X char *ans, X prompt[128], X *pretty_name = pr_name(def, YES); X X if (prmt) X strcpy(prompt, prmt); X else { X if (def != 0 && *def != '\0') { X swritef(prompt, ": %f (default %s) ", pretty_name); X if (strlen(prompt) * 2 >= CO) X swritef(prompt, ProcFmt); X } else X swritef(prompt, ProcFmt); X } X#if defined(F_COMPLETION) X ans = real_ask("\r\n \t?", f_complete, pretty_name, prompt); X if (ans == 0 && (ans = pretty_name) == 0) X complain("[No default file name]"); X#else X ans = ask(pretty_name, prompt); X#endif X PathParse(ans, buf); X X return buf; X} SHAR_EOF if test 1655 -ne "`wc -c < 'ask2.c'`" then echo shar: error transmitting "'ask2.c'" '(should have been 1655 characters)' fi fi if test -f 'fp.h.diff' then echo shar: will not over-write existing file "'fp.h.diff'" else echo extracting "'fp.h.diff'" sed 's/^X//' >fp.h.diff <<'SHAR_EOF' X*** fp.h~ X--- fp.h X************** X*** 12,18 X #define getc(fp) (((--(fp)->f_cnt < 0) ? filbuf(fp) : *(fp)->f_ptr++)) X #define f_eof(fp) (fp->f_flags & F_EOF) X X! typedef struct file { X int f_cnt, /* number of characters left in buffer */ X f_bufsize, /* size of what f_base points to */ X f_fd, /* fildes */ X--- 12,18 ----- X #define getc(fp) (((--(fp)->f_cnt < 0) ? filbuf(fp) : *(fp)->f_ptr++)) X #define f_eof(fp) (fp->f_flags & F_EOF) X X! typedef struct xx_file { X int f_cnt, /* number of characters left in buffer */ X f_bufsize, /* size of what f_base points to */ X f_fd, /* fildes */ SHAR_EOF if test 611 -ne "`wc -c < 'fp.h.diff'`" then echo shar: error transmitting "'fp.h.diff'" '(should have been 611 characters)' fi fi if test -f 'io.h.diff' then echo shar: will not over-write existing file "'io.h.diff'" else echo extracting "'io.h.diff'" sed 's/^X//' >io.h.diff <<'SHAR_EOF' X*** io.h~ X--- io.h X************** X*** 23,29 X *pr_name proto((char *fname,int okay_home)), X *sprint proto((char *, ...)); X X! extern struct file X *open_file proto((char *fname,char *buf,int how,int complainifbad,int loudness)); X X extern void X--- 23,29 ----- X *pr_name proto((char *fname,int okay_home)), X *sprint proto((char *, ...)); X X! extern struct xx_file X *open_file proto((char *fname,char *buf,int how,int complainifbad,int loudness)); X X extern void SHAR_EOF if test 477 -ne "`wc -c < 'io.h.diff'`" then echo shar: error transmitting "'io.h.diff'" '(should have been 477 characters)' fi fi if test -f 'malloc.c.diff' then echo shar: will not over-write existing file "'malloc.c.diff'" else echo extracting "'malloc.c.diff'" sed 's/^X//' >malloc.c.diff <<'SHAR_EOF' X*** malloc.c~ X--- malloc.c X************** X*** 5,10 X * included in all the files. * X ***************************************************************************/ X X #include "tune.h" X X #ifdef MY_MALLOC X--- 5,11 ----- X * included in all the files. * X ***************************************************************************/ X X+ #include <sys/types.h> X #include "tune.h" X X #ifdef MY_MALLOC SHAR_EOF if test 499 -ne "`wc -c < 'malloc.c.diff'`" then echo shar: error transmitting "'malloc.c.diff'" '(should have been 499 characters)' fi fi if test -f 'sysdep.h.diff' then echo shar: will not over-write existing file "'sysdep.h.diff'" else echo extracting "'sysdep.h.diff'" sed 's/^X//' >sysdep.h.diff <<'SHAR_EOF' X*** sysdep.h~ X--- sysdep.h X************** X*** 34,42 X # if !sun X extern int errno; X # endif X! # define YP_PASSWD /* if you are a sun running the yellow pages */ X! # define VFORK /* if you have vfork(2) */ X! # define JOB_CONTROL /* if you have job stopping */ X # ifdef JOB_CONTROL X # define MENLO_JCL X # endif X--- 34,42 ----- X # if !sun X extern int errno; X # endif X! /*# define YP_PASSWD -- if you are a sun running the yellow pages */ X! /*# define VFORK -- if you have vfork(2) */ X! /*# define JOB_CONTROL -- if you have job stopping */ X # ifdef JOB_CONTROL X # define MENLO_JCL X # endif X************** X*** 71,78 X X #ifdef UNIX X /* pick your version of Unix */ X! # define BSD4_2 /* Berkeley 4.2 BSD */ X! # define BSD4_3 /* Berkeley 4.3 BSD and 2.10 BSD */ X /*# define SYSV -- for (System III/System V) UNIX systems */ X /*# define SYSVR2 -- system 5, rel. 2 */ X /* M_XENIX is defined by the Compiler */ X--- 71,78 ----- X X #ifdef UNIX X /* pick your version of Unix */ X! /*# define BSD4_2 -- Berkeley 4.2 BSD */ X! /*# define BSD4_3 -- Berkeley 4.3 BSD and 2.10 BSD */ X /*# define SYSV -- for (System III/System V) UNIX systems */ X # define SYSVR2 /* system 5, rel. 2 */ X /* M_XENIX is defined by the Compiler */ X************** X*** 74,80 X # define BSD4_2 /* Berkeley 4.2 BSD */ X # define BSD4_3 /* Berkeley 4.3 BSD and 2.10 BSD */ X /*# define SYSV -- for (System III/System V) UNIX systems */ X! /*# define SYSVR2 -- system 5, rel. 2 */ X /* M_XENIX is defined by the Compiler */ X #endif /* UNIX */ X X--- 74,80 ----- X /*# define BSD4_2 -- Berkeley 4.2 BSD */ X /*# define BSD4_3 -- Berkeley 4.3 BSD and 2.10 BSD */ X /*# define SYSV -- for (System III/System V) UNIX systems */ X! # define SYSVR2 /* system 5, rel. 2 */ X /* M_XENIX is defined by the Compiler */ X #endif /* UNIX */ X SHAR_EOF if test 1847 -ne "`wc -c < 'sysdep.h.diff'`" then echo shar: error transmitting "'sysdep.h.diff'" '(should have been 1847 characters)' fi fi if test -f 'term.c.diff' then echo shar: will not over-write existing file "'term.c.diff'" else echo extracting "'term.c.diff'" sed 's/^X//' >term.c.diff <<'SHAR_EOF' X*** term.c~ X--- term.c X************** X*** 86,91 X HOlen, X LLlen; X X #ifdef notdef X /* X * Are you sure about this one Jon? On the SYSV system I tried this X--- 86,92 ----- X HOlen, X LLlen; X X+ #define notdef X #ifdef notdef X /* X * Are you sure about this one Jon? On the SYSV system I tried this X************** X*** 93,99 X * defined in -ltermcap. Similarly for BC and UP ... X */ X # ifdef SYSVR2 /* release 2, at least */ X! char PC; X # endif /* SYSVR2 */ X #endif X X--- 94,101 ----- X * defined in -ltermcap. Similarly for BC and UP ... X */ X # ifdef SYSVR2 /* release 2, at least */ X! char PC,*BC,*UP; X! short ospeed; X # endif /* SYSVR2 */ X #endif X SHAR_EOF if test 687 -ne "`wc -c < 'term.c.diff'`" then echo shar: error transmitting "'term.c.diff'" '(should have been 687 characters)' fi fi if test -f 'tune.h.diff' then echo shar: will not over-write existing file "'tune.h.diff'" else echo extracting "'tune.h.diff'" sed 's/^X//' >tune.h.diff <<'SHAR_EOF' X*** tune.h~ X--- tune.h X************** X*** 11,17 X X #ifdef UNIX X # define SUBPROCS /* only on UNIX systems (NOT INCORPORATED YET) */ X! # define IPROCS /* interactive processes */ X #endif /* UNIX */ X X #ifndef VFORK X--- 11,17 ----- X X #ifdef UNIX X # define SUBPROCS /* only on UNIX systems (NOT INCORPORATED YET) */ X! /*# define IPROCS -- interactive processes */ X #endif /* UNIX */ X X #ifndef VFORK X************** X*** 29,35 X #define CMT_FMT /* include the comment formatting routines */ X X #ifdef UNIX X! # define LOAD_AV /* Use the load average for various commands. X # Do not define this if you lack a load average X # system call and kmem is read protected. */ X # X--- 29,35 ----- X #define CMT_FMT /* include the comment formatting routines */ X X #ifdef UNIX X! /*# define LOAD_AV -- Use the load average for various commands. X # Do not define this if you lack a load average X # system call and kmem is read protected. */ X # X************** X*** 33,39 X # Do not define this if you lack a load average X # system call and kmem is read protected. */ X # X! # define BIFF /* if you have biff (or the equivalent) */ X # define SPELL /* spell words and buffer commands */ X #endif X X--- 33,39 ----- X # Do not define this if you lack a load average X # system call and kmem is read protected. */ X # X! /*# define BIFF -- if you have biff (or the equivalent) */ X # define SPELL /* spell words and buffer commands */ X #endif X SHAR_EOF if test 1491 -ne "`wc -c < 'tune.h.diff'`" then echo shar: error transmitting "'tune.h.diff'" '(should have been 1491 characters)' fi fi if test -f 'util.c.diff' then echo shar: will not over-write existing file "'util.c.diff'" else echo extracting "'util.c.diff'" sed 's/^X//' >util.c.diff <<'SHAR_EOF' X*** util.c~ X--- util.c X************** X*** 9,14 X #include "ctype.h" X #include "termcap.h" X #include "disp.h" X #include <signal.h> X X #ifdef MAC X--- 9,15 ----- X #include "ctype.h" X #include "termcap.h" X #include "disp.h" X+ #include "fp.h" X #include <signal.h> X X #ifdef MAC SHAR_EOF if test 284 -ne "`wc -c < 'util.c.diff'`" then echo shar: error transmitting "'util.c.diff'" '(should have been 284 characters)' fi fi # end of shell archive exit 0 ---------------snip----------------snip---------------snip--------------------- -- Signed: Larry A. Shurr (att!cbnews!cbema!las) Clever signature, Wonderful wit, Outdo the others, Be a big hit! - Burma Shave (With apologies to the real thing. The above represents my views only.) (Please note my mailing address. Mail sent to me on cbnews doesn't make it.)