Browse files

Import Elvis 2.1_4 (written by Steve Kirkendall)

  • Loading branch information...
1 parent 3a9bb55 commit 97d899801d31738f6f0802cd6d4a9315e9f33f8e @mbert committed Dec 10, 2011
Showing with 3,030 additions and 746 deletions.
  1. +115 −60 BUGS
  2. +1 −1 COPYING
  3. +28 −27 INSTALL
  4. +17 −5 Makefile.in
  5. +257 −22 README.html
  6. +12 −0 alias.c
  7. +13 −13 buffer.c
  8. +29 −9 calc.c
  9. +33 −10 configure
  10. +30 −16 ctags.c
  11. +37 −11 dmmarkup.c
  12. +16 −1 dmsyntax.c
  13. +59 −18 draw.c
  14. +2 −2 draw.h
  15. +2 −1 draw2.h
  16. +5 −5 elvis.lsm
  17. +10 −11 ex.c
  18. +23 −6 ex.h
  19. +8 −5 exaction.c
  20. +122 −41 exconfig.c
  21. +3 −3 exmake.c
  22. +6 −5 gui.c
  23. +4 −3 guiwin32/WinElvis.rc
  24. BIN guiwin32/elvis.ico
  25. +2 −1 guiwin32/elvisres.h
  26. +4 −3 guiwin32/gwmsg.c
  27. +18 −2 guix11/guix11.c
  28. +4 −1 guix11/guix11.h
  29. +12 −2 guix11/xdialog.c
  30. +2 −1 guix11/xevent.c
  31. +3 −2 guix11/xtext.c
  32. +45 −24 input.c
  33. +6 −8 io.c
  34. +90 −6 lib/elvis.ali
  35. +11 −20 lib/elvis.arf
  36. +3 −3 lib/elvis.bwf
  37. +6 −1 lib/elvis.html
  38. +41 −29 lib/elvis.ini
  39. +2 −2 lib/elvis.man
  40. +90 −23 lib/elvis.syn
  41. +35 −2 lib/elvisex.html
  42. +12 −0 lib/elvisopt.html
  43. +25 −1 lib/elvisos.html
  44. +2 −0 lib/elvisses.html
  45. +14 −5 lib/elvistip.html
  46. +15 −4 lib/elvisvi.html
  47. +162 −2 lib/howto.html
  48. +19 −15 lowbuf.c
  49. +2 −2 lp.c
  50. +1 −1 lp.h
  51. +37 −11 lpescape.c
  52. +45 −8 makos2.cmd
  53. +18 −3 mark.c
  54. +1 −0 mark.h
  55. +54 −38 move.c
  56. +2 −2 operator.c
  57. +3 −2 optglob.c
  58. +6 −5 optglob.h
  59. +37 −14 osos2/Makefile.os2
  60. +0 −11 osos2/changes.os2
  61. +1 −0 osos2/config-with-tcp.h
  62. +2 −1 osos2/osdef.h
  63. +6 −2 osos2/osdir.c
  64. +47 −49 osos2/osnet.c
  65. +1 −0 osunix/osnet.c
  66. +2 −2 oswin32/osblock.c
  67. +117 −14 oswin32/osdir.c
  68. +1,166 −126 oswin32/osprg.c
  69. +4 −1 oswin32/ostext.c
  70. +2 −2 oswin32/tcaphelp.c
  71. +5 −1 ref.c
  72. +3 −3 scan.c
  73. +1 −1 session.h
  74. +4 −3 tinytcap.c
  75. +2 −2 verify.c
  76. +1 −1 version.h
  77. +5 −9 window.c
View
175 BUGS
@@ -11,7 +11,69 @@ NOTE: Not all of these are truly bugs. This file also serves as my "to do"
list, so some items are just unimplemented features that sounded like a good
idea at one time or another.
-* There appears to be a bug in scanning -- a scanned block is not necessarily
+-----------------------------------------------------------------------------
+Fixed (or not) in version 2.1_4:
+
+* Nested font changes don't always work correctly. For example,
+ "<strong><a href=foo>FOO!</a></strong> bar?" displays "bar?" in the
+ strong font. "<a href=foo><strong>Foo!</strong></a>" works though.
+
+/ The built-in calculator's shell() function gives an ugly error message
+ if the safer option is set. It fails correctly; it simply looks ugly.
+
+/ POSIX says that ^F/^B should leave two lines overlapping, not just one
+
+/ POSIX says that $ should accept a count, and move forward (count-1) lines.
+
+/ Executing ":do source somefile", where somefile contains an inner :while
+ loop, messes up the condition for the outer loop.
+
+? The text-mode version of elvis sometimes has problems drawing characters
+ near the left edge of the window. Apparently it gets confused about where
+ the cursor is located.
+
+ I've seen this on some occasions, but I not recently. I've never
+ been able to reproduce it reliably. Perhaps it was a side-effect
+ of some other bug?
+
+/ Under MS-DOS with TERM=nansi (and NANSI.SYS installed, of course) the screen
+ is shifted up one line. TERM=ansi works, but doesn't use nansi efficiently.
+
+/ For gui="x11", if a window scrolls while some other window has pointer
+ focus, then the cursor isn't drawn. This is important when, e.g., you
+ use a dialog to search for text.
+
+/ When the same buffer is shown in two windows, inserting text into one
+ window can cause the other to scroll. This seems to occur only when
+ the location of the change is above the top line of the other window.
+
+ Apparently what's happening is this: In a series of blank lines,
+ (i.e., lines which contain only a newline character), after any
+ character is inserted before line n, line n-1 has the same offset
+ than line n used to have, so the window update functions assume
+ that line n-1 is really still line n, so it shows line n-1 at the
+ top of the window instead of line n.
+
+ Probably the win->di->topline variable, which is currently a long
+ which stores an offset, should be replaced with a MARK. Since
+ MARKs are updated when a buffer changes, this should fix it.
+
+* Given a URL such as "../untar.c", referenced from "/pub/elvis/unreleased",
+ elvis 2.1_3 tries to fetch "/pub/elvis/unreleased/../untar.c", but it *MUST*
+ be normalized as "/pub/elvis/untar.c" -- i.e., delete instances of "dir/../".
+ Some web servers depend on this.
+
+? In "html" mode, if a single displayed line contains more than one link,
+ elvis always seems to follow the *last* link regardless of which one you
+ click on. This is bad for some menu bars.
+
+ Actually, this only seems to occur when multiple images appear
+ on a line, and you want to download one of the images. For
+ real links, elvis works correctly.
+
+ I took a stab at fixing this one. It seems better now.
+
+? There appears to be a bug in scanning -- a scanned block is not necessarily
being locked for the whole time that it should be, which means that it may
be removed from the block cache, in which case NULL may be returned by some
of the blkXXXX() functions. Also, on at least one occasion elvis appeared
@@ -21,15 +83,60 @@ idea at one time or another.
recent attempts to make searches run faster by keeping at least one
scan context for the current location at all times.
-/ One user reported crashes in WinElvis when the "Options->syntax" menu item
- is activated while in "syntax" display mode.
+ The FEATURE_LITRE bug is fixed; hopefully that fixes this too.
+
+* There are still problems with running external programs under Win32.
+ The :make command doesn't work. Also, the screen is sometimes messed up
+ after running a program.
+
+ I switched back to the older, more complex version of oswin32/osprg.c.
+ The only problem it has is that sometimes 16-bit filter programs don't
+ work correctly... but I just tested it again and that seems to work
+ now. Anyway, 16-bit filters are less important than :make, so I'm
+ keeping the older version.
+
+/ When viewing an HTML document at a URL such as "http://foo/bar.html?boo/far",
+ containing a link to "zot.html", elvis will resolve that link to be to
+ "http://foo/bar.html?boo/zot.html", but it should be "http://foo/zot.html".
+
+ Similarly, I suspect that fileext() fails on URLs like that.
-* One user reported that elvis was sensitive to keystrokes during quitting.
+/ Hitting ^] on an operator doesn't search for an "operatorXX" tag? I
+ thought it did.
+
+ It appears to work now. I don't know why it didn't work before.
+
+/ The alias.c program (which is compiled as vi.exe, ex.exe, and view.exe)
+ has been reported to cause problems under WindowsNT, and more recently
+ under Windows98 as well.
+
+ It appears that a Microsoft has introduced a bug into their versions
+ of the "exec" system calls. I switched to "spawn", which waits a
+ little RAM but seems to work correctly.
+
+/ Under Windows95/98/NT, the "Terminal" font has funny spacing and sometimes
+ characters overlap each other.
+
+ This is a bug in the font, not in elvis. Elvis only supports
+ fixed-pitch fonts, and although "Terminal" claims to be fixed-pitch,
+ it is really a variable-pitch font.
+
+/ Control chars in an alias aren't displayed in a printable form by the
+ :alias command. ":alias clean s/.^H//g" looks like "alias clean s///g".
+
+/ Add VIM's "smarttab" option -- <Tab> keys at the beginning of a line act
+ like ^T, so they indent by the shiftwidth amount using a combination of
+ tabs and spaces. <Tab> keys elsewhere in a line are real tabs.
+
+/ One user reported that elvis was sensitive to keystrokes during quitting.
I suspect that gui->poll was being called while the file was being written
(possibly just when written via FTP). That write should not be quittable.
-* Under MS-DOS with TERM=nansi (and NANSI.SYS installed, of course) the screen
- is shifted up one line. TERM=ansi works, but doesn't use nansi efficiently.
+------------------------------------------------------------------------------
+Fixed in 2.1_3
+
+/ One user reported crashes in WinElvis when the "Options->syntax" menu item
+ is activated while in "syntax" display mode.
/ Can't identify tags whose whose contains a new-style comment. Apparently
the tag-selector can't parse \/\/ in an regular expression.
@@ -318,58 +425,9 @@ Fixed in 2.1j-beta....
/ Make elvis.arf strip off the perl version number from #!/usr/bin/perl-XXXX
lines. This makes syntax easier to recognize.
-------------
-* Under X11, the XV button doesn't work. It reports that the temporary
- file is empty.
-
- The XV button does ":w !xv - >/dev/null 2>&1 &". The "x11" user
- interface runs xv as a filter, so it can show the program's output
- in the elvis window. Since xv doesn't output anything useful, I
- tried to avoid that by running it in the background. However,
- since pipes can fill up, elvis uses a temporary file for the filter's
- stdin, and a pipe to read its stdout. Running a program in the
- background like this causes elvis to read EOF from the filter's
- stdout immediately, so elvis immediately clobbers the temp file.
- The filter (xv) sees no data on its stdin. (Actually this is a
- little surprising since elvis doesn't truncate the file; it deletes
- it. A deleted file is *supposed* to remain allocated until the
- last file descriptor on it is closed.)
-
- The short-term fix is to avoid running filters in the background.
-
- The long-term fix is to make the "x11" interface smarter about
- running programs in the background, so it can use a pipe for stdin;
- This would also allow the removal of ">/dev/null 2>&1".
-
* If xcurses exists, it should probably be used in preference to curses.
(This would be a change to the "configure" script.)
-* In "html" mode, if a single displayed line contains more than one link,
- elvis always seems to follow the *last* link regardless of which one you
- click on. This is bad for some menu bars.
-
- Actually, this only seems to occur when multiple images appear
- on a line, and you want to download one of the images. For
- real links, elvis works correctly. This bug can wait until
- after 2.1 is done.
-
-* For gui="x11", if a window scrolls while some other window has pointer
- focus, then the cursor isn't drawn. This is important when, e.g., you
- use a dialog to search for text.
-
-* When the same buffer is shown in two windows, inserting text into one
- window can cause the other to scroll. This seems to occur only when
- the location of the change is above the top line of the other window.
-
- Apparently what's happening is this: In a series of blank lines,
- (i.e., lines which contain only a newline character), after any
- character is inserted before line n, line n-1 has the same offset
- than line n used to have, so the window update functions assume
- that line n-1 is really still line n, so it shows line n-1 at the
- top of the window instead of line n.
-
-* Hitting ^] on an operator doesn't search for an "operatorXX" tag? I
- thought it did.
-
? Elvis gets confused if you load a URL which has no filename component,
such as "http://www.yahoo.com". Adding a trailing slash avoids that.
@@ -680,7 +738,7 @@ Fixed in 2.1j-beta....
> like deducing them. What do you want to be done?
Apparently elvis needs to inspect the session's low-level buffers more
- carefully before I restore them. In your session file, there is a
+ carefully before restoring them. In your session file, there is a
low-level buffer (at block 52) which contains a reference to a bogus
block number, and that's preventing you from restarting elvis to
recover the other buffers in that session file.
@@ -760,7 +818,7 @@ Fixed in 2.1j-beta....
In addition, a potential bug in the termcap interface was fixed.
-* Some crashes/hangs have been reported under Linux. These may have something
+? Some crashes/hangs have been reported under Linux. These may have something
to do with <u> and <Shift-U> commands. Usually there are no clues, but at
least twice the buffer filled with ^@ characters. Reported by Steve Woodard,
woodard@kodakr.kodak.com
@@ -872,9 +930,6 @@ Fixed in 2.1j-beta....
* In the installation routine, create links named "vi", "ex", and "view".
Similarly, supply .BAT files or something for Win32.
-* Some problems have been reported while trying to recover files. Either
- there's a bug, or I need to improve the documentation.
-
* Ctags doesn't produce "Mfilename" tags for main() functions in filename.c
* Sometimes text changes as you move the cursor over it in HTML mode. This
View
2 COPYING
@@ -1,4 +1,4 @@
-Elvis 2.1 Copyright 1996 by Steve Kirkendall
+Elvis 2.1 Copyright 1999 by Steve Kirkendall
Elvis 2.1 is copyrighted freeware. It is provided in the hope that it will
be useful, but with no warranty.
View
55 INSTALL
@@ -1,4 +1,4 @@
-HOW TO COMPILE & INSTALL ELVIS 2.1
+HOW TO COMPILE & INSTALL ELVIS 2.1_4
Separate sets of instructions are provided below for UNIX, Windows-NT,
MS-DOS, and OS/2.
@@ -10,13 +10,24 @@ development environment if you prefer. Separate instructions are given
for both compilation methods, for both operating systems.
All of these instructions assume that you have already unpacked the files
-from the source code archive, "elvis-2.1.tar.gz". That's a gzipped tar
+from the source code archive, "elvis-2.1_4.tar.gz". That's a gzipped tar
archive. If you don't have the gzip and tar utilities, then the easiest
way for you to unpack them is to compile the "untar.c" program (available
via anonymous FTP from ftp://ftp.cs.pdx.edu/pub/elvis/untar.c). The files
-will be placed in a subdirectory named "elvis-2.1". The MS-DOS *.MAK files
+will be placed in a subdirectory named "elvis-2.1_4". The MS-DOS *.MAK files
assume that you've unpacked them while in C:\MSVC, so the files themselves
-should end up in C:\MSVC\elvis-2.1.
+should end up in C:\MSVC\elvis-2.1_4.
+
+Under MS-DOS, the name of the archive will be mangled. It will probably
+be "elvis-~1.gz", but it may be something else; the exact name depends on
+how you downloaded it, and whether you already had an old version of that
+archive in the same directory. The MS-DOS version of the "untar" program
+needs to be passed the mangled name, whatever that turns out to be. The
+Win32 version, on the other hand, can handle the full "elvis-2.1_4.tar.gz"
+file name.
+
+Also under MS-DOS, you may see complaints about some OS/2 files. You can
+ignore that; you don't need those files to compile elvis for MS-DOS.
================================================================================
@@ -126,17 +137,7 @@ UNIX
================================================================================
-NOTE FOR WINDOWS/NT: The "vi.exe", "ex.exe", and "view.exe" programs have been
-reported to cause problems under NT. If they don't work on your system, then
-I suggest you replace them with the equivalent batch files. Each batch file
-would be just one line long:
-
- vi.bat: elvis %1 %2 %3 %4 %4 %5 %6 %7 %8 %9
- ex.bat: elvis -e %1 %2 %3 %4 %4 %5 %6 %7 %8 %9
- view.bat: elvis -R %1 %2 %3 %4 %4 %5 %6 %7 %8 %9
-
-
-MS-Windows/NT (or Windows95?), with Visual C++ 2.0 (Method #1):
+MS-Windows/NT (or Windows95?), with Visual C++ 2.0 or later (Method #1):
1) Run the "makwin32.bat" file.
makwin32
@@ -153,7 +154,7 @@ MS-Windows/NT (or Windows95?), with Visual C++ 2.0 (Method #1):
copy lib\*.* \localbin\lib
-MS-Windows/NT (or Windows95?), with Visual C++ 2.0 (Method #2):
+MS-Windows/NT (or Windows95?), with Visual C++ 2.0 or later (Method #2):
1) Copy all of the "*.mak" files from files from the oswin32 subdirectory.
copy oswin32\*.mak
@@ -191,11 +192,11 @@ MS-Windows/NT (or Windows95?), with Visual C++ 2.0 (Method #2):
MS-DOS, using Visual C++ 1.5 (Method #1):
REMINDER: MSVC++ 1.5 always puts the complete pathnames of all files
into its NMAKE files. Because of this, you *MUST* install the
- source code into a directory named "C:\MSVC\elvis-2.1". The
- "elvis-2.1" component of that directory name is stored in the
- "elvis-2.1.tar.gz" archive file, so you should be in the C:\MSVC
+ source code into a directory named "C:\MSVC\elvis-2.1_4". The
+ "elvis-2.1_4" component of that directory name is stored in the
+ "elvis-2.1_4.tar.gz" archive file, so you should be in the C:\MSVC
directory when you extract the files. After extracting the files,
- do a "cd elvis-2.1"
+ do a "cd elvis-2.1_4"
1) Run the "makmsdos.bat" file
@@ -215,19 +216,19 @@ MS-DOS, using Visual C++ 1.5 (Method #1):
MS-DOS, using Visual C++ 1.5 (Method #2):
REMINDER: MSVC++ 1.5 always puts the complete pathnames of all files
into its NMAKE files. Because of this, you *MUST* install the
- source code into a directory named "C:\MSVC\elvis-2.1". The
- "elvis-2.1" component of that directory name is stored in the
- "elvis-2.1.tar.gz" archive file, so you should be in the C:\MSVC
+ source code into a directory named "C:\MSVC\elvis-2.1_4". The
+ "elvis-2.1_4" component of that directory name is stored in the
+ "elvis-2.1_4.tar.gz" archive file, so you should be in the C:\MSVC
directory when you extract the files.
- 1) Copy all of the "C:\MSVC\elvis-2.1\OSMSDOS\*.MAK" files into the
- "C:\MSVC\elvis-2.1" directory.
+ 1) Copy all of the "C:\MSVC\elvis-2.1_4\OSMSDOS\*.MAK" files into the
+ "C:\MSVC\elvis-2.1_4" directory.
c:
- cd \msvc\elvis-2.1
+ cd \msvc\elvis-2.1_4
copy osmsdos\*.mak
- 2) Copy the "\MSVC\elvis-2.1\OSMSDOS\OSCONFIG.H" file to
+ 2) Copy the "\MSVC\elvis-2.1_4\OSMSDOS\OSCONFIG.H" file to
"\MSVC\elvis-2.1\CONFIG.H" Note that the "OS" is dropped from the
filename.
View
22 Makefile.in
@@ -1,5 +1,5 @@
# Makefile.in
-# $Id: Makefile.in,v 2.62 1999/06/19 01:06:23 steve Exp $
+# $Id: Makefile.in,v 2.65 1999/10/20 18:30:01 steve Exp $
#
# Makefile.in should not be modified! The "configure" script reads Makefile.in
# and writes a customized Makefile by editing the values of the following
@@ -150,8 +150,8 @@ CFLAGS= $(FLAGI)os$(OS)
EVERY= $(ALL) verify$(EXE) elvdump$(EXE) calc$(EXE)
SHELL= /bin/sh
-DISTRIB=elvis-2.1_3
-DOSEXE=exedos
+DISTRIB=elvis-2.1_4
+MSDOSEXE=exemsdos
WIN32EXE=exewin32
OS2EXE=exeos2
@@ -249,6 +249,9 @@ clean.unix:
$(RM) verify.elv
$(RM) $(DISTRIB).tar.gz
$(RM) lib/elvtags.man
+ $(RM) $(MSDOSEXE)/*
+ $(RM) $(WIN32EXE)/*
+ $(RM) $(OS2EXE)/*
clean.msdos:
$(RM) *$(OBJ)
@@ -294,6 +297,9 @@ $(DISTRIB).tar.gz:
cp lib/* $(DISTRIB)/lib
for i in os*/*.c os*/*.h os*/*.mak os*/*.lib os*/*.ICO osos2/*.def osos2/*os2*; do cp $$i $(DISTRIB)/$$i; done
for i in gui*/*; do if [ -f $$i ]; then cp $$i $(DISTRIB)/$$i; fi; done
+ mkdir $(DISTRIB)/osos2/manual
+ mkdir $(DISTRIB)/osos2/manual/org
+ cp osos2/manual/*.ed osos2/manual/*.cmd $(DISTRIB)/osos2/manual/
rm -f $(DISTRIB)/osunix/osconfig.h
rm -f $(DISTRIB)/config.h
rm -f $(DISTRIB)/Makefile
@@ -302,6 +308,7 @@ $(DISTRIB).tar.gz:
rm -rf $(DISTRIB)
$(DISTRIB)-win32.tar.gz: $(WIN32EXE)
+ @[ -f $(WIN32EXE)/elvis.exe ] || (echo "You need to copy the *.exe files into $(WIN32EXE)"; exit 2)
rm -rf bin-win32
mkdir bin-win32
cp $(WIN32EXE)/*.exe bin-win32
@@ -313,11 +320,13 @@ $(DISTRIB)-win32.tar.gz: $(WIN32EXE)
/' <COPYING >bin-win32/COPYING
mkdir bin-win32/lib
cp lib/* bin-win32/lib
+ sed 's/$$/
/' <lib/printdoc.bat >bin-win32/lib/printdoc.bat
-/' <lib/printdoc.bat >bin-win32/lib/printdoc.bat
+ sed 's/$$/
+/' <lib/license >bin-win32/lib/license
(cd bin-win32; tar czf ../$(DISTRIB)-win32.tar.gz *)
rm -rf bin-win32
- (cd bin-win32; tar czf ../$(DISTRIB)-win32.tar.gz *)
+
$(DISTRIB)-msdos.tar.gz: $(MSDOSEXE)
@[ -f $(MSDOSEXE)/elvis.exe ] || (echo "You need to copy the *.exe files into $(MSDOSEXE)"; exit 2)
rm -rf bin-msdos
@@ -326,8 +335,10 @@ $(DISTRIB)-msdos.tar.gz: $(DOSEXE)
sed 's/$$/
/' <README.html >bin-msdos/README.html
sed 's/$$/
+/' <BUGS >bin-msdos/BUGS
sed 's/$$/
/' <COPYING >bin-msdos/COPYING
+ mkdir bin-msdos/lib
cp lib/* bin-msdos/lib
sed 's/$$/
/' <lib/printdoc.bat >bin-msdos/lib/printdoc.bat
@@ -343,6 +354,7 @@ $(DISTRIB)-os2.tar.gz: $(OS2EXE)
cp $(OS2EXE)/*.exe bin-os2
sed 's/$$/
/' <README.html >bin-os2/README.html
+ sed 's/$$/
/' <BUGS >bin-os2/BUGS
sed 's/$$/
/' <COPYING >bin-os2/COPYING
View
279 README.html
@@ -19,18 +19,24 @@
<li><a HREF="#functions">3.3 New functions</a>
<li><a HREF="#gui">3.4 New ports and GUI features</a>
<li><a HREF="#misc">3.5 Miscellany</a>
- <li><a HREF="#revision">3.6 Revisions since the original 2.1 release</a>
+ <li><a HREF="#revision3">3.6 Differences between 2.1_3 and the original 2.1 release</a>
+ <li><a HREF="#revision4">3.7 Differences between 2.1_4 and 2.1_3</a>
</menu>
<li><a HREF="#future">4. The future of elvis</a>
<li><a HREF="#links">5. Links to related files</a>
</menu>
+<pre graphic>
+.---------------------------------------------------------------.
+| <strong>This is not elvis' user manual!</strong> The <em>real</em> documentation for |
+| elvis is located in its online help facility. While running |
+| elvis, enter the command "<code>:help</code>" to see the table of contents.|
+^---------------------------------------------------------------^
-<hr>
<h1><a NAME="thisfile"></a>1. About this file</h1>
This file is written in the HTML markup language.
You can view it with any WWW viewer, such as Netscape.
-You can also use elvis 2.1i-beta to view it; this version of elvis
+You can also use elvis 2.1 to view it; this version of elvis
has the ability to view HTML documents, and print them.
<p>This file has many hypertext links.
@@ -159,7 +165,7 @@
any pending macros or aliases are aborted.
<pre>
:alias togglecase {
- try !% s/.*/\U&amp;
+ try !% s/.*[a-z].*/\U&amp;
else !% s/.*/\L&amp;
}
</pre>
@@ -176,6 +182,22 @@
}
</pre>
+<dt>:switch
+<br>:case
+<br>:default
+<dd>This is a multi-way branch.
+The <code>:switch</code> command evaluates an expression, and stores the
+result in an internal variable.
+Each <code>:case</code> command compares the switch value to a literal string;
+if it matches then the remainder of the line is executed an an ex command.
+If none of the cases match, then <code>:default</code> will run its ex command.
+<pre>
+ :switch os
+ :case unix echo LF
+ :case mac echo CR
+ :default echo CR-LF
+</pre>
+
</dl>
<h2><a name="options">3.2 Options</a></h2>
@@ -315,8 +337,7 @@
expression.
<dt>tagprg, tp
-<br>tagprgonce, tpo
-<dd>These allow you to use an external program to perform tag searches.
+<dd>This allows you to use an external program to perform tag searches.
<dt>blkhit, bh
<br>blkmiss, bm
@@ -333,14 +354,19 @@
<dd>These affect the way text is printed.
Setting <code>lpnumber</code> causes line numbers to be printed, just as
<code>number</code> causes line number to be shown on the screen.
-For the "normal" or "syntax" display modes, <code>lpheader</code>
+Setting the <code>lpheader</code> option
causes pages to have a header showing the file name, page number, and date.
<dt>previousdir, pdir
<dd>This stores the previous directory.
You can use "~-" (tilde minus) at the start of a file name as a shorthand
for the previous directory name.
+<dt>smarttab, sta
+<dd>If set, this causes the <kbd>&lt;Tab&gt;</kbd> key to act like
+<kbd>^T</kbd> when in the indentation area of a line.
+Elsewhere in a line, <kbd>&lt;Tab&gt;</kbd> will act normally.
+
</dl>
<h2><a name="functions">3.3 New functions</a></h2>
@@ -391,6 +417,16 @@
<dt>alias(<var>name</var>)
<dd>Test for the existence of a given alias.
+<dt>shell(<var>command</var>)
+<dd>Executes the <var>command</var> via a shell, and returns the text that
+the program wrote to stdout.
+
+<dt>line(<var>buffer</var>, <var>line</var>)
+<dd>Returns a single line from a buffer.
+If <var>buffer</var> is omitted, then the current buffer is assumed.
+If both <var>buffer</var> and <var>line</var> are omitted, then the current
+line of the current buffer is returned.
+
</dl>
<h2><a name="gui">3.4 New ports, and new GUI features</a></h2>
@@ -428,7 +464,6 @@
and "~-" for the previous directory.
Also, under Unix you can use "~<var>user</var>" for the home directory of
<var>user</var>.
-~name, ~+, ~-
<dt>Network protocols
<dd>Elvis can read via HTTP, and read or write via FTP.
@@ -468,14 +503,9 @@
</dl>
-<h2><a name="revision"></a>3.6 Revisions since the first 2.1 release</h2>
+<h2><a name="revision3"></a>3.6 Differences between 2.1_3 and the original 2.1 release</h2>
-This version of elvis is 2.1_3 (pronounced "two point one patch-level 3").
-It may also be written as 2.1.3; however, the "2.1_3" notation was chosen for a reason:
-the directory name "elvis-2.1_3" is a valid MS-DOS directory name, but
-"elvis-2.1.3" is not.
-
-<p>Many bugs and annoyances have been fixed since the first 2.1 release
+Many bugs and annoyances have been fixed since the first 2.1 release
a couple months ago.
The highlights are:
<dl>
@@ -683,6 +713,191 @@
</dl>
+<h2><a name="revision4"></a>3.7 Differences between 2.1_4 and 2.1_3</h2>
+
+This version of elvis is 2.1_4 (pronounced "two point one patch-level 4").
+It may also be written as 2.1.4;
+however, the "2.1_4" notation was chosen for a reason:
+the directory name "elvis-2.1_4" is a valid MS-DOS directory name, but
+"elvis-2.1.4" is not.
+
+<p>This is primarily a bug-fix update.
+There are some big changes that I'd like to make to elvis, but
+they'll all have to wait until version 2.2.
+This bug-fix version is simply intended to make waiting for 2.2 a little
+easier.
+
+<p>Some of the main areas of bug fixes are:
+
+<dl>
+
+<dt>Buffer bugs
+<dd>Several people reported that elvis complained about the '#' being used
+in initialization scripts (even though '#' doesn't appear anywhere in those
+scripts), or that sometimes a buffer would get scrambled.
+These problems have now been fixed, thanks mostly to William Plant.
+He tracked the problem down to the use of FEATURE_LITRE in scan.c.
+
+<p>This was a significant bug!
+The '#' thing was only one manifestation of a dangerous bug.
+Other manifestations could mangle buffers, cause core dumps, etc.
+This bug fix alone is probably enough to justify downloading 2.1_4.
+
+<dt>Cygwin support
+<dd>The Win32 version of elvis 2.1_3 (or earlier) didn't work very well
+under Cygwin's <code>bash</code> shell.
+elvis 2.1_4 should fix that. Specifically...
+<ul>
+<li>Cygwin sets the TERM environment variable to "cygwin",
+which elvis will now recognize as a synonym for "console".
+<li>Elvis now supports the mount table produced by the Cygwin
+<code>mount</code> utility.
+
+<dt>Windows98 chokes on vi.exe, etc.
+<dd>An apparent bug in recent versions of Windows causes the
+<code>vi.exe</code>, <code>view.exe</code>, and <code>ex.exe</code> programs
+to run in the background.
+(Those programs worked in Windows95, but choked in Windows98 and NT.)
+To work around this, I replaced the execvp() call with a spawnvp() call
+followed by an exit() call.
+It'll waste a little RAM now, but at least it works.
+
+<p>This bug also hit Cygwin's <code>bash</code> shell, when run under Windows98
+or NT.
+I've tested 2.1_4 under <code>bash</code>, and it works now.
+
+<dt>Running external programs under Win32
+<dd>There were two bugs which, together, caused elvis to act weird after
+running an external command such as ":!dir".
+This was particularly acute in the text-mode version, but now both versions
+seem to work as intended.
+
+<dt>Screen glitch in MS-DOS with NANSI.SYS
+<dd>The screen wasn't always drawn correctly when using one of the better
+ANSI drivers, and setting TERM=nansi (or whatever).
+This was due to a bug in the nansi termcap entry in tinytcap.c;
+it should be fixed now.
+
+<dt>Scrolling after :split
+<dd>Previously there was a bug which showed up when you have two windows
+open on the same buffer.
+Inserting text in one window could cause the other window to scroll after
+each keystroke.
+This has been fixed.
+
+<dt>Name completion with spaces
+<dd>There were some problems when attempting filename completion on
+files whose names contain spaces.
+The bug responsible for this has been fixed.
+
+<dt>Ctags/elvtags
+<dd>Some bugs in the ctags/elvtags program have been fixed.
+Mostly these only occured when you're using long lines.
+
+<dt>Display modes
+<dd>The "tex" and "syntax" display modes should work a little better now.
+I added some TeX markups, and enhanced the "syntax" display mode to handle
+PERL slightly better.
+Also, some users have contributed syntax descriptions for new languages.
+
+<dt>:make
+<dd>The <code>:make</code>, <code>:cc</code>, and <code>:errlist</code>
+commands were treating any alphanumeric word as a filename, without
+checking to see if it even exists.
+It was <em>supposed</em> to verify that the name was an existing,
+readable/writable (or just readable if <code>noanyerror</code>),
+non-binary file... and now it will.
+
+<dt>POSIX compatibility tweaks
+<dd>The <code>:=</code> command, when invoked without line number, should
+display the total number of lines in the buffer. Previous versions of elvis
+didn't do that correctly, but 2.1_3 did.
+Unfortunately, that fix broke the <code>:.=</code> command, which is supposed
+to display the current line number.
+Version 2.1_4 should both of those right, finally.
+
+<p>The <kbd>^F</kbd> and <kbd>^B</kbd> paging commands are supposed to leave
+two lines of overlap, but previous versions of elvis have only kept one line
+of overlap.
+(NOTE: I considered adding an option to control the overlap, because if you
+have a 24-line screen and 66-line pages, then then it would be nice to leave
+1 line of overlap because three <kbd>^F</kbd>s or <kbd>^B</kbd>s would equal
+one page.
+If you believe an option would be useful, please let me know.)
+
+<p>The <kbd>$</kbd> command accepts a <var>count</var> argument, and moves
+forward (<var>count</var>-1) lines before moving to the end.
+
+</dl>
+
+<hr>
+<p>The only new features (since 2.1_3) are...
+<dl>
+
+<dt>:switch/:case/:default commands
+<dd>Elvis now has a :switch command for doing a multi-way branch in a readable
+way.
+I believe this is justified, since the current :if/:then/:else commands would
+require you to use deeper and deeper nested braces to achieve the same effect.
+The old way:
+<pre>
+ if os=="unix"
+ then echo Unix
+ else {
+ if os=="win32"
+ then echo Windows95/98/NT/2000
+ else {
+ if os=="msdos"
+ then echo MS-DOS
+ else {
+ if os=="os2"
+ then echo OS/2
+ else echo Who?
+ }
+ }
+ }
+</pre>
+The new way:
+<pre>
+ switch os
+ case unix echo Unix
+ case win32 echo Windows95/98/NT/2000
+ case msdos echo MS-DOS
+ case os2 echo OS/2
+ default echo Who?
+</pre>
+
+<dt>"html" printer type
+<dd>Setting the <code>lptype</code> option to "html" causes the
+<code>:lpr</code> command to write HTML output, instead of normal printer
+control sequences.
+This give a good way to generate WYSIWYG HTML code from any of elvis'
+display modes.
+It required minimal changes to the code, too -- basically, I just created
+a new printer type that uses "&lt;b&gt;" to start bold font, "&lt;i&gt;" to
+start italics, and so on, instead of some printer-dependent escape sequence.
+
+<dt>"makehtml" alias
+<dd>There is a new <code>:makehtml</code> alias which attempts to convert plain text to HTML.
+It works pretty well, though you'll still need to hand-edit the results in
+many cases. You might want to compare the output of <code>:makehtml</code> to
+that of the "html" lptype, to see which one fits your needs better.
+
+<dt>"smarttab" option
+<dd>I added VIM's "smarttab" alias.
+When set, this causes the <kbd>&lt;Tab&gt;</kbd> key to act like <kbd>^T</kbd>
+when pressed in the indentation area of a line.
+Elsewhere in the line, <kbd>&lt;Tab&gt;</kbd> is treated normally.
+Now you can do things like "<code>:set&nbsp;smarttab&nbsp;shiftwidth=4</code>"
+to change your indentation levels while leaving the <code>tabstop</code>
+option unchanged.
+
+<p>The current implementation is a little half-assed though --
+you can't backspace over the indentation.
+Instead, you must hit <kbd>^D</kbd> to reduce the indentation level.
+
+</dl>
+
<h1><a name="future"></a>4. The future of elvis</h1>
One of the biggest tasks on my list is to rewrite the ctags program
@@ -715,6 +930,26 @@
That way, you could create your own markups to display nroff -ms, RTF, SGML,
and MIME "rich text" documents.
+<p>I'd like to redesign the way elvis assigns assigns buffer names.
+I'd like to make it always use the full pathname of a file as the buffer name.
+In addition, I'd like for elvis to store a "current working directory" for
+each window, and use that to convert a relative buffer name into a the absolute
+pathname.
+A similar trick would be used for filenames.
+When running an external program, elvis would change the real current
+directory to that window's directory.
+The benefits of all this:
+<ul>
+<li>If you're editing "foo" and "./foo", they'll both use the same buffer.
+This sounds contrived, but a similar thing happens with tag files fairly often.
+<li>If you do a :cd command, then the old buffers will still write out to
+their old directories.
+<li>Different windows could have different directories.
+<li>The X-windows "-client" flag would behave in a more reasonable manner.
+<li>The "current directory" could be something other than a local directory.
+For example, there's no reason you shouldn't be able to ":cd ftp://ftp.sunsite.unc.edu/pub/incoming".
+</ul>
+
<h1><a name="links"></a>5. Links to related files</H1>
If the main site (<a href="ftp://ftp.cs.pdx.edu/pub/elvis/README.html">ftp.cs.pdx.edu</a>) is too slow, try the mirror site at
@@ -755,37 +990,37 @@
So if you extract the files under Windows95, DOS programs won't be able to
find them with their expected names, and vice versa.
Consequently, you must use <code>untardos.exe</code> to unpack
-<code>elvis-2.1-msdos.tar.gz</code>, and <code>untarw32.exe</code> to unpack
-<code>elvis-2.1-win32.tar.gz</code>.
+<code>elvis-2.1_4-msdos.tar.gz</code>, and <code>untarw32.exe</code> to unpack
+<code>elvis-2.1_4-win32.tar.gz</code>.
<dt><a href="ftp://ftp.cs.pdx.edu/pub/elvis/untaros2.exe">untaros2.exe</a>
<dd>This is an OS/2 executable, produced from the above "untar.c" file.
For brief instructions on how to use <code>untaros2,</code>
run it with no arguments.
-<dt><a href="elvis-2.1_3.tar.gz">elvis-2.1_3.tar.gz</a>
+<dt><a href="elvis-2.1_4.tar.gz">elvis-2.1_4.tar.gz</a>
<dd>This is a gzipped tar archive of the source code and documentation for
Elvis 2.1 and its related programs.
-<dt><a href="elvis-2.1_3-msdos.tar.gz">elvis-2.1_3-msdos.tar.gz</a>
+<dt><a href="elvis-2.1_4-msdos.tar.gz">elvis-2.1_4-msdos.tar.gz</a>
<dd>This archive contains the documentation and MS-DOS executables
for Elvis 2.1.
-<dt><a href="elvis-2.1_3-win32.tar.gz">elvis-2.1_3-win32.tar.gz</a>
+<dt><a href="elvis-2.1_4-win32.tar.gz">elvis-2.1_4-win32.tar.gz</a>
<dd>This archive contains the documentation and Win32 executables
for Elvis 2.1.
These were compiled and tested under Windows95, but should work under
WindowsNT 3.51 (or later) as well.
-<dt><a href="elvis-2.1_3-os2.tar.gz">elvis-2.1_3-os2.tar.gz</a>
+<dt><a href="elvis-2.1_4-os2.tar.gz">elvis-2.1_4-os2.tar.gz</a>
<dd>This archive contains the documentation and OS/2 executables
for Elvis 2.1.
<dt>
<a href="ftp://ftp.fh-wedel.de/pub/fh-wedel/staff/herbert/elvis/00-index.html">
ftp://ftp.fh-wedel.de/pub/fh-wedel/staff/herbert/elvis/00-index.html</a>
<dd>This is where the OS/2 maintainer stores his most up-to-date versions.
-It may be better than the <code>elvis-2.1-os2.tar.gz</code> file, above.
+It may be better than the <code>elvis-2.1_4-os2.tar.gz</code> file, above.
</dl>
</body></html>
View
12 alias.c
@@ -47,6 +47,18 @@
# define ARGV0 VI
#endif
+/* Win32 seems to have developed an inability to exec() correctly. The shell
+ * thinks the program has exited when in fact it has merely exec'ed some
+ * other function. This messes up the ex/vi/view aliases for elvis. To work
+ * around it, we SPAWN elvis and wait for it to return before the alias exits.
+ * This wastes a little memory, but at least it works.
+ */
+#if _MSC_VER >= 900 /* 32-bit compiler for Windows */
+# define execvp(p,a) (i = _spawnvp(_P_WAIT, p,a)); if (i >= 0) exit(i);
+#endif
+
+
+
main(argc, argv)
int argc;
char *argv[];
View
26 buffer.c
@@ -1,7 +1,7 @@
/* buffer.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_buffer[] = "$Id: buffer.c,v 2.94 1999/06/15 04:21:43 steve Exp $";
+char id_buffer[] = "$Id: buffer.c,v 2.95 1999/10/08 18:03:03 steve Exp $";
#include "elvis.h"
@@ -622,7 +622,7 @@ BUFFER bufload(bufname, filename, reload)
MARKBUF top;
MARKBUF end;
BUFFER initbuf; /* buffer containing the initialization script */
- BOOLEAN oldthen;
+ EXCTLSTATE oldctlstate;
int i;
void *locals;
@@ -684,14 +684,14 @@ BUFFER bufload(bufname, filename, reload)
/* execute the script */
locals = optlocal(NULL);
- oldthen = exthenflag;
+ exctlsave(oldctlstate);
if (experform(windefault, marktmp(top, initbuf, 0),
marktmp(end, initbuf, o_bufchars(initbuf))) != RESULT_COMPLETE)
{
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
return buf;
}
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
(void)optlocal(locals);
}
}
@@ -765,10 +765,10 @@ BUFFER bufload(bufname, filename, reload)
/* Execute the script's contents. */
locals = optlocal(NULL);
- oldthen = exthenflag;
+ exctlsave(oldctlstate);
(void)experform(windefault, marktmp(top, initbuf, 0),
marktmp(end, initbuf, o_bufchars(initbuf)));
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
(void)optlocal(locals);
}
}
@@ -1097,7 +1097,7 @@ BOOLEAN bufwrite(from, to, wfile, force)
BOOLEAN filter; /* If True, we're writing to a filter */
BOOLEAN wholebuf; /* if True, we're writing the whole buffer */
BOOLEAN samefile; /* If True, we're writing the buffer to its original file */
- BOOLEAN oldthen;
+ EXCTLSTATE oldctlstate;
int bytes;
void *locals;
@@ -1159,15 +1159,15 @@ BOOLEAN bufwrite(from, to, wfile, force)
/* execute the script */
locals = optlocal(NULL);
- oldthen = exthenflag;
+ exctlsave(oldctlstate);
if (experform(windefault, marktmp(top, initbuf, 0),
marktmp(next, initbuf, o_bufchars(initbuf))) != RESULT_COMPLETE
&& !force)
{
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
return False;
}
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
(void)optlocal(locals);
}
}
@@ -1264,10 +1264,10 @@ BOOLEAN bufwrite(from, to, wfile, force)
/* execute the script */
locals = optlocal(NULL);
- oldthen = exthenflag;
+ exctlsave(oldctlstate);
(void)experform(windefault, marktmp(top, initbuf, 0),
marktmp(next, initbuf, o_bufchars(initbuf)));
- exthenflag = oldthen;
+ exctlrestore(oldctlstate);
(void)optlocal(locals);
}
}
View
38 calc.c
@@ -1,7 +1,7 @@
/* calc.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_calc[] = "$Id: calc.c,v 2.65 1999/04/08 22:09:25 steve Exp $";
+char id_calc[] = "$Id: calc.c,v 2.68 1999/10/12 22:43:30 steve Exp $";
#include "elvis.h"
#include <setjmp.h>
@@ -396,6 +396,14 @@ static BOOLEAN func(name, arg)
}
else if (!CHARcmp(name, toCHAR("dirext")))
{
+ /* if this is a URL, and it contains a '#' or '?' character,
+ * then truncate it there.
+ */
+ if ((arg[3] == ':' || arg[4] == ':')
+ && ((tmp = CHARchr(arg, '#')) != NULL
+ || (tmp = CHARchr(arg, '?')) != NULL))
+ *tmp = '\0';
+
/* find the last '.' in the name */
for (tmp = arg + CHARlen(arg); --tmp >= arg && isalnum(*tmp); )
{
@@ -782,17 +790,19 @@ static BOOLEAN func(name, arg)
*--arg = '!';
/* Run the command and read its output */
- if (ioopen(tochar8(arg), 'r', False, False, 't'))
+ if (!ioopen(tochar8(arg), 'r', False, False, 't'))
+ return False;
+ arg = name;
+ while ((i = ioread(arg,RESULT_AVAIL(name))) > 0)
{
- arg = name;
- while ((i = ioread(arg,RESULT_AVAIL(name))) > 0)
+ if (RESULT_OVERFLOW(arg, i + 1))
{
- if (RESULT_OVERFLOW(arg, i + 1))
- goto Overflow;
- arg += i;
+ ioclose();
+ goto Overflow;
}
- ioclose();
+ arg += i;
}
+ ioclose();
/* Remove the last newline */
if (arg != name && arg[-1] == '\n')
@@ -1536,6 +1546,16 @@ void main(int argc, char **argv)
{
case '?':
fprintf(stderr, "usage: %s [-m] [-e expr] [arg]...\n", argv[0]);
+ fprintf(stderr, "This program is meant to be used primarily for testing elvis' built-in\n");
+ fprintf(stderr, "calculator. It may also be useful for systems that don't have \"bc\".\n");
+ fprintf(stderr, "The -m flag causes the expression to be evaluated using elvis' simpler\n");
+ fprintf(stderr, "syntax, which is used mostly for outputing messages; otherwise it uses\n");
+ fprintf(stderr, "the normal syntax. The -eexpr flag causes it to evaluate expr and quit;\n");
+ fprintf(stderr, "otherwise it reads expressions from stdin until EOF. Any remaining\n");
+ fprintf(stderr, "arguments are used as parameters which are accessible as $1 through $9\n");
+ fprintf(stderr, "in the expression. See the elvis manual for more information.\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "This program is unsupported and carries no guarantees.\n");
exit(0);
break;
@@ -1560,7 +1580,7 @@ void main(int argc, char **argv)
}
else
{
- while (gets(tochar8(expr)))
+ while (fgets(tochar8(expr), sizeof expr, stdin))
{
result = calculate(expr, (CHAR **)&argv[optind], msg);
if (result)
View
43 configure
@@ -31,7 +31,8 @@
# xenix ancient SCO Xenix-386 systems
# sco SCO UNIX or Open Desktop systems
# bsd typical BSD implementations
-# freebsd freebsd is a specific BSD implementation
+# freebsd FreeBSD is a specific BSD implementation
+# openbsd OpenBSD is a specific BSD implementation
# posix generic POSIX implementations
# cygwin GNU utilities under Windows95/98/NT
# (anything else) generic UNIX, including SysV
@@ -43,7 +44,7 @@
# Set some defaults
XINCPATH="/usr/include /usr/include/X11 /usr/X11/include /usr/local/X11/include /usr/openwin/include /usr/X11R6/include"
-XLIBPATH="/lib /usr/lib /usr/X11/lib /usr/local/X11/lib /usr/openwin/lib /usr/X11R6/lib "`echo "$LD_LIBRARY_PATH" | tr ':' ' '`
+XLIBPATH="/lib /usr/lib /usr/X11/lib /usr/local/X11/lib /usr/openwin/lib /usr/X11R6/lib /usr/ucblib /usr/ccs/lib /usr/local/lib "`echo "$LD_LIBRARY_PATH" | tr ':' ' '`
GNUPATH=`echo "$PATH" | tr ':' ' '`
BINDIR=/usr/local/bin
LIBDIR=/usr/local/lib/elvis
@@ -55,6 +56,7 @@ WHY=""
# Initialize some variables. These aren't merely defaults; don't change them!
args=""
XLIBS=""
+NLIBS=""
# Ultrix has a broken /bin/sh; it doesn't support shell functions. Try to be
# clever about running bash instead of /bin/sh there.
@@ -71,7 +73,7 @@ fi
# This function echoes its arguments, but only if the --verbose flag is given
why()
{
- if [ $WHY ]
+ if [ "$WHY" ]
then
echo "$@"
fi
@@ -109,8 +111,9 @@ usage()
echo " --libs=STRING non-X11 part of the LIBS= string in Makefile"
echo " --ioctl=VARIETY type of tty ioctl to use: termios, termio, or sgtty"
echo " --verbose explain any decisions made during configuration"
- echo "system: linux, sunos, solaris, solaris2, freebsd, bsd, posix, aix, osf-1, hp-ux"
- echo " ultrix, qnx, irix, cygwin, xenix, sco (meaning SCO Unix or OpenDesktop)"
+ echo "system: linux, sunos, solaris, solaris2, freebsd, openbsd, bsd, posix,"
+ echo " aix, osf-1, hp-ux, ultrix, qnx, irix, cygwin, xenix,"
+ echo " sco (meaning SCO Unix or OpenDesktop)"
if [ "$*" ]
then
echo "$*"
@@ -210,7 +213,7 @@ then
why " This is really '$SYS'"
;;
- linux|solaris|solaris2|aix|osf-1|ultrix|hp-ux|qnx|irix|xenix|sco|bsd|freebsd|posix|cygwin*)
+ linux|solaris|solaris2|aix|osf-1|ultrix|hp-ux|qnx|irix*|xenix|sco|bsd|freebsd|openbsd|posix|cygwin*)
why " I know '$SYS' -- This should be easy!"
;;
@@ -403,7 +406,11 @@ fi
if [ $PROTOCOL_HTTP = define -o $PROTOCOL_FTP = define ]
then
why "Does this system support inet_aton()?"
- if fgrep inet_aton /usr/include/arpa/inet.h </dev/null >/dev/null
+ if [ "$SYS" = sunos -o "$SYS" = solaris -o "$SYS" = solaris2 ]
+ then
+ why " Assuming no, because this is a Sun system."
+ NEED_INET_ATON=define
+ elif fgrep inet_aton /usr/include/arpa/inet.h </dev/null >/dev/null
then
why " Assuming yes, because it is declared in <arpa/inet.h>"
NEED_INET_ATON=undef
@@ -412,6 +419,17 @@ then
NEED_INET_ATON=define
fi
fi
+if [ $NEED_INET_ATON = undef ]
+then
+ why "Does this system require -lresolv to use inet_aton()?"
+ if [ "`searchpath libresolv.a $XLIBPATH`" = "" ]
+ then
+ why " Assuming no, because I couldn't find libresolv.a"
+ else
+ why " Assuming yes, because I found libresolv.a"
+ NLIBS="$NLIBS -lresolv"
+ fi
+fi
why "Does this system support memmove()?"
if fgrep memmove /usr/include/string*.h </dev/null >/dev/null
then
@@ -521,7 +539,7 @@ case "$SYS" in
fi
if [ -f /usr/ccs/lib/libtermcap.a ]
then
- why "For Solaris2, -ltermcap is usually not necessary but since you have and and"
+ why "For Solaris2, -ltermcap is usually not necessary but since you have one and"
why " it is harmless, I'll add it."
TLIBS="$TLIBS -ltermcap"
fi
@@ -573,6 +591,11 @@ case "$SYS" in
why "For FreeBSD, we ignore the <sys/select.h> file"
NEED_SELECT_H="undef"
;;
+ *openbsd*)
+ why "For OpenBSD, we ignore the <sys/select.h> file"
+ NEED_SELECT_H="undef"
+ TLIBS="-lcurses"
+ ;;
*bsd*)
why "For BSD we like to use shlicc2 because it supports shared libraries"
tmp=`searchpath shlicc2 $GNUPATH`
@@ -666,7 +689,7 @@ then
fi
if [ "$LIBS" = "" ]
then
- LIBS=${TLIBS:--ltermcap}
+ LIBS="${TLIBS:--ltermcap} $NLIBS"
fi
case "$LIBS" in
*ncurses*) NEED_BC=undef;;
@@ -868,7 +891,7 @@ sed -f $tmp Makefile.in >Makefile && rm $tmp
# Some parting advice
case "$SYS" in
*solaris*|*sunos*)
- if [ "$GUI_X11" = "define" ]
+ if [ "$GUI_X11" = "define" -a "$WHY" = y ]
then
xlibdir=`dirname "$xlib"`
case "$LD_LIBRARY_PATH" in
View
46 ctags.c
@@ -1,6 +1,6 @@
/* ctags.c */
-char id_ctags[] = "$Id: ctags.c,v 2.23 1999/02/26 21:31:41 steve Exp $";
+char id_ctags[] = "$Id: ctags.c,v 2.25 1999/10/06 19:10:45 steve Exp $";
/* This is a reimplementation of the ctags(1) program. It supports ANSI C,
* and has heaps o' flags. It is meant to be distributed with elvis.
@@ -49,7 +49,7 @@ char id_ctags[] = "$Id: ctags.c,v 2.23 1999/02/26 21:31:41 steve Exp $";
extern void file_open P_((char *));
extern int file_getc P_((void));
extern void file_ungetc P_((int));
-extern void file_copyline P_((long, FILE *, char *));
+extern int file_copyline P_((long, FILE *, char *));
extern void cpp_open P_((char *));
extern void cpp_echo P_((int));
extern int cpp_getc P_((void));
@@ -58,7 +58,7 @@ extern int lex_gettoken P_((void));
extern void maketag P_((int, char *, long, long, int, char *));
extern void ctags P_((char *));
extern void usage P_((void));
-extern void main P_((int, char **));
+extern int main P_((int, char **));
#if defined (GUI_WIN32)
@@ -102,7 +102,7 @@ char hint_class[200];/* class name, for tags preceeded by a name and :: */
/* -------------------------------------------------------------------------- */
/* display a fatal error message from safe.c */
-#ifdef USE_PROTOTYPES
+#if USE_PROTOTYPES
void msg(MSGIMP type, char *msg, ...)
#else
void msg(type, msg)
@@ -214,49 +214,62 @@ void file_ungetc(ch)
*
* This is meant to be used when generating a tag line.
*/
-void file_copyline(seek, fp, buf)
+int file_copyline(seek, fp, buf)
long seek; /* where the lines starts in the source file */
FILE *fp; /* the output stream to copy it to if buf==NULL */
char *buf; /* line buffer, or NULL to write to fp */
{
long oldseek;/* where the file's pointer was before we messed it up */
char ch; /* a single character from the file */
char next; /* the next character from this file */
+ char *build; /* where to store the next character */
/* go to the start of the line */
oldseek = ftell(file_fp);
fseek(file_fp, seek, 0);
/* write everything up to, but not including, the newline */
- for (ch = getc(file_fp); ch != '\n' && ch != EOF; ch = next)
+ for (ch = getc(file_fp), build = buf; ch != '\n' && ch != EOF; ch = next)
{
+ /* if too many chars have been written already, then stop */
+ if (build && build >= &buf[160])
+ {
+ break;
+ }
+
/* preread the next character from this file */
next = getc(file_fp);
/* if character is '\', or a terminal '$', then quote it */
- if (buf && (ch == '\\'
+ if (build && (ch == '\\'
|| ch == (backward ? '?' : '/')
|| (ch == '$' && next == '\n')))
{
- *buf++ = '\\';
+ *build++ = '\\';
}
/* copy the character, unless it is a terminal '\r' */
if (ch != '\r' || next != '\n')
{
- if (buf)
- *buf++ = ch;
+ if (build)
+ *build++ = ch;
else
putc(ch, fp);
}
}
/* mark the end of the line */
- if (buf)
- *buf = '\0';
+ if (build)
+ *build = '\0';
/* seek back to the old position */
fseek(file_fp, oldseek, 0);
+
+ /* return 1 if it fit, 0 if it was truncated */
+ if (build && build >= &buf[160])
+ return 0;
+ else
+ return 1;
}
/* -------------------------------------------------------------------------- */
@@ -772,7 +785,7 @@ void maketag(scope, name, lnum, seek, number, kind)
char *kind; /* token type of the tag: "f" for function, etc. */
{
TAG tag; /* structure for storing tag info */
- char buf[200];
+ char buf[300];
char lnbuf[20];
@@ -801,8 +814,9 @@ void maketag(scope, name, lnum, seek, number, kind)
else
{
strcpy(buf, backward ? "?^" : "/^");
- file_copyline(seek, NULL, buf + 2);
- strcat(buf, backward ? "$?" : "$/");
+ if (file_copyline(seek, NULL, buf + 2))
+ strcat(buf, "$");
+ strcat(buf, backward ? "?" : "/");
}
tag.TAGADDR = buf;
@@ -1022,7 +1036,7 @@ void usage()
-void main(argc, argv)
+int main(argc, argv)
int argc;
char **argv;
{
View
48 dmmarkup.c
@@ -1,7 +1,7 @@
/* dmmarkup.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_dmmarkup[] = "$Id: dmmarkup.c,v 2.85 1999/06/15 04:18:16 steve Exp $";
+char id_dmmarkup[] = "$Id: dmmarkup.c,v 2.87 1999/10/05 19:14:08 steve Exp $";
/* This file contains some fairly generic text formatting code -- generic
* in the sense that it can be easily tweaked to format a variety of types
@@ -1170,7 +1170,8 @@ static CHAR *htmltagatcursor(win, cursor)
{
scanalloc(&p, marktmp(tmp, markbuffer(cursor), mui->line[i].offset));
anyviz = False;
- while ((token = htmlget(&p)) != NULL && (!anyviz || token->offset[0] < endoffset))
+ while ((token = htmlget(&p)) != NULL
+ && (!anyviz || token->offset[0] < endoffset))
{
if (!token->markup)
{
@@ -1183,7 +1184,8 @@ static CHAR *htmltagatcursor(win, cursor)
|| !CHARncmp(token->text, toCHAR("<frame "), 7)
|| !CHARncmp(token->text, toCHAR("<htmlurl "), 9)
|| !CHARncmp(token->text, toCHAR("<ulink "), 7)
- || (anchor.text[1] == '/' && !CHARncmp(token->text, toCHAR("<img "), 5)))
+ || (anchor.text[1] == '/'
+ && !CHARncmp(token->text, toCHAR("<img "), 5)))
{
anchor = *token;
anyviz = False;
@@ -1192,7 +1194,9 @@ static CHAR *htmltagatcursor(win, cursor)
anyviz = True;
}
scanfree(&p);
+#if 0
endoffset = mui->line[i].offset;
+#endif
} while (anchor.text[0] == 0 && --i >= 0);
/* If we found an <a ...> tag, then generate a dynamically-allocated
@@ -1336,7 +1340,20 @@ static MARK htmltagload(tagname, from)
|| urllocal(tochar8(o_filename(markbuffer(from))))
!= tochar8(o_filename(markbuffer(from))) ))
{
+ /* get the directory part of the origin name */
inherit = dirdir(tochar8(o_filename(markbuffer(from))));
+
+ /* if it contains '?' or '#' then lop that off and try again */
+ if ((tmp = strchr(inherit, '?')) != NULL
+ || (tmp = strchr(inherit, '#')) != NULL)
+ {
+ *tmp = '\0';
+ inherit = dirdir(inherit);
+ }
+
+ /* if the inherit string contains a pathname, and the new URL
+ * doesn't, then combine the new URL with the inherit pathname.
+ */
if (strlen(inherit) > 2
&& inherit[strlen(inherit) - 1] == '/'
&& !urllocal(tochar8(o_filename(markbuffer(from)))))
@@ -2548,8 +2565,8 @@ static twrap_t textitle(token)
font = 'b';
break;
- case 't': /* \secTion{} */
- center = False;
+ case 't': /* \secTion{} or \parT{} */
+ center = (BOOLEAN)(token->text[1] == 'p'); /* part */
indent = 0;
font = 'b';
break;
@@ -2717,15 +2734,17 @@ static TOKEN *texget(refp)
{ "title", "-22-NY-", textitle },
#define TEX_AUTHOR &markups[10]
{ "author", "-12-NY-", textitle },
-#define TEX_CHAPTER &markups[11]
+#define TEX_PART &markups[11]
+ { "part", "-c2NNYS", textitle },
+#define TEX_CHAPTER &markups[12]
{ "chapter", "-c2NNYS", textitle },
-#define TEX_SECTION &markups[12]
+#define TEX_SECTION &markups[13]
{ "section", "-c2NNYS", textitle },
-#define TEX_SUBSECTION &markups[13]
+#define TEX_SUBSECTION &markups[14]
{ "subsection", "-12NNYS", textitle },
-#define TEX_DIGRAPH &markups[14]
+#define TEX_DIGRAPH &markups[15]
{ "digraph", "-------", texdigraph },
-#define TEX_HFIL &markups[15]
+#define TEX_HFIL &markups[16]
{ "hfil", "--=----" },
{ "hfill", "--=----" },
{ "hline", "-02--Y-", htmlhr }, /* reuse HTML! */
@@ -2846,6 +2865,7 @@ static TOKEN *texget(refp)
|| !CHARcmp(rettok.text, "\\footnote")
|| !CHARcmp(rettok.text, "\\title")
|| !CHARcmp(rettok.text, "\\author")
+ || !CHARcmp(rettok.text, "\\part")
|| !CHARcmp(rettok.text, "\\chapter")
|| !CHARcmp(rettok.text, "\\section")
|| !CHARcmp(rettok.text, "\\subsection")
@@ -2867,6 +2887,11 @@ static TOKEN *texget(refp)
rettok.markup = TEX_AUTHOR;
goto End;
}
+ if (!CHARncmp(rettok.text, "\\part", 5))
+ {
+ rettok.markup = TEX_PART;
+ goto End;
+ }
if (!CHARncmp(rettok.text, "\\chapter", 8))
{
rettok.markup = TEX_CHAPTER;
@@ -2888,7 +2913,8 @@ static TOKEN *texget(refp)
* doesn't become the default font.
*/
if ((!CHARncmp(rettok.text, "\\text", 4)
- || !CHARcmp(rettok.text, "\\code"))
+ || !CHARcmp(rettok.text, "\\code")
+ || !CHARcmp(rettok.text, "\\emph"))
&& *refp
&& **refp == '{')
{
View
17 dmsyntax.c
@@ -1,7 +1,7 @@
/* dmsyntax.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_dmsyntax[] = "$Id: dmsyntax.c,v 2.49 1998/11/14 01:38:08 steve Exp $";
+char id_dmsyntax[] = "$Id: dmsyntax.c,v 2.50 1999/09/30 18:23:02 steve Exp $";
#include "elvis.h"
#ifdef DISPLAY_SYNTAX
@@ -1064,6 +1064,21 @@ static MARK image(w, line, info, draw)
if (!cfont[COMMENT2])
cfont[COMMENT2] = o_commentfont;
}
+ else if (!undec[2])
+ {
+ /* two-char keyword, parse it
+ * like two-punct keyword. This
+ * intended to support Perl's
+ * $# keyword, where $ is legal
+ * as the start of a word so it
+ * wouldn't hit the standard
+ * freaky-keyword code below.
+ */
+ sinfo->token = FIRSTPUNCT;
+ cfont[FIRSTPUNCT] = cfont[SECONDPUNCT] = wordfont(kp);
+ if (!cfont[FIRSTPUNCT])
+ cfont[FIRSTPUNCT] = cfont[SECONDPUNCT] = o_keywordfont;
+ }
else
{
sinfo->token = KEYWORD;
View
77 draw.c
@@ -1,7 +1,7 @@
/* draw.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_draw[] = "$Id: draw.c,v 2.73 1997/12/24 03:12:52 steve Exp $";
+char id_draw[] = "$Id: draw.c,v 2.75 1999/10/08 18:04:29 steve Exp $";
#include "elvis.h"
@@ -26,9 +26,10 @@ static void openmove(WINDOW win, long oldcol, long newcol, CHAR *image, long len
#endif
/* allocate a drawinfo struct, including the related arrays */
-DRAWINFO *drawalloc(rows, columns)
+DRAWINFO *drawalloc(rows, columns, top)
int rows; /* height of new window image */
int columns;/* width of new window image */
+ MARK top; /* top of screen */
{
DRAWINFO *newp;
int i;
@@ -43,6 +44,8 @@ DRAWINFO *drawalloc(rows, columns)
newp->curchar = (CHAR *)safealloc(rows * columns, sizeof(CHAR));
newp->curfont = (char *)safealloc(rows * columns, sizeof(char));
newp->offsets = (long *)safealloc(rows * columns, sizeof(long));
+ newp->topmark = markdup(top);
+ newp->bottommark = markdup(top);
/* clear the current image and the "new" image */
for (i = rows * columns; --i >= 0; )
@@ -73,6 +76,8 @@ void drawfree(di)
safefree(di->curchar);
safefree(di->curfont);
safefree(di->offsets);
+ markfree(di->topmark);
+ markfree(di->bottommark);
if (di->openimage)
{
safefree(di->openimage);
@@ -98,7 +103,6 @@ void drawexpose(win, top, left, bottom, right)
int right; /* right edge to be redrawn */
{
int row, column, same, base, nonblank;
- MARKBUF m;
long firstline, lastline;
assert(win != NULL && top >= 0 && left >= 0 && bottom < o_lines(win)
@@ -159,10 +163,10 @@ void drawexpose(win, top, left, bottom, right)
if (win->md->move == dmnormal.move)
{
/* find line numbers of first and last lines shown */
- firstline = markline(marktmp(m, markbuffer(win->cursor), win->di->topline)) - 1;
- lastline = markline(marktmp(m, markbuffer(win->cursor), win->di->bottomline)) - 1;
+ firstline = markline(win->di->topmark) - 1;
+ lastline = markline(win->di->bottommark) - 1;
- /* Some scrolling commands temporarily set bottomline
+ /* Some scrolling commands temporarily set bottommark
* to the end of the buffer. Ordinarily this causes
* no problems, but if an expose event occurs before
* the screen is redrawn, the the scrollbar's "thumb"
@@ -181,8 +185,8 @@ void drawexpose(win, top, left, bottom, right)
}
else
{
- (*gui->scrollbar)(win->gw, win->di->topline,
- win->di->bottomline, win->di->curnbytes);
+ (*gui->scrollbar)(win->gw, markoffset(win->di->topmark),
+ markoffset(win->di->bottommark), win->di->curnbytes);
}
}
guiflush();
@@ -1224,9 +1228,10 @@ static BOOLEAN drawquick(win)
!win->md->canopt || /* display mode doesn't support optimization */
di->logic != DRAW_NORMAL || /* last command made a subtle change */
di->drawstate != DRAW_VISUAL || /* screen doesn't already show image */
+ markbuffer(win->cursor)!=markbuffer(di->topmark) || /* cursor is in different buffer */
di->curchgs != markbuffer(win->cursor)->changes || /* last command made a normal change */
- cursoff < di->topline || /* cursor off top of screen */
- cursoff >= di->bottomline || /* cursor off bottom of screen */
+ cursoff < markoffset(di->topmark) || /* cursor off top of screen */
+ cursoff >= markoffset(di->bottommark) || /* cursor off bottom of screen */
col < 0 || /* cursor off left edge of screen */
col >= di->columns || /* cursor off right edge of screen */
win->seltop) /* visually selecting text */
@@ -1312,8 +1317,9 @@ void drawimage(win)
if (win->di->curbuf != markbuffer(win->cursor))
{
/* place the cursor's line at the center of the screen */
- win->di->topline = markoffset(dispmove(win, -(o_lines(win) / 2), 0));
- win->di->bottomline = o_bufchars(markbuffer(win->cursor));
+ markset(win->di->topmark, dispmove(win, -(o_lines(win) / 2), 0));
+ marksetbuffer(win->di->bottommark, markbuffer(win->cursor));
+ marksetoffset(win->di->bottommark, o_bufchars(markbuffer(win->cursor)));
win->di->logic = DRAW_CENTER;
win->di->curbuf = markbuffer(win->cursor);
}
@@ -1325,8 +1331,8 @@ void drawimage(win)
}
/* setup, and choose a starting point for the drawing */
- next = (*win->md->setup)(win, marktmp(first, markbuffer(win->cursor), win->di->topline),
- markoffset(win->cursor), marktmp(last, markbuffer(win->cursor), win->di->bottomline), win->mi);
+ next = (*win->md->setup)(win, win->di->topmark,
+ markoffset(win->cursor), win->di->bottommark, win->mi);
thiswin = win;
thiscell = 0;
thiscol = 0;
@@ -1390,7 +1396,7 @@ void drawimage(win)
wantcurs = win->di->rows;
/* draw each line until we reach the last row */
- win->di->topline = markoffset(next);
+ markset(win->di->topmark, next);
for (row = 0; thiscell < maxcell || win->di->cursrow < 0 || (win->di->cursrow > wantcurs && markoffset(next) < o_bufchars(markbuffer(win->cursor))); )
{
/* set column limits, taking o_sidescroll into consideration */
@@ -1462,7 +1468,7 @@ void drawimage(win)
}
}
}
- win->di->bottomline = markoffset(next);
+ markset(win->di->bottommark, next);
assert(linesshown > 0 && linesshown <= maxrow);
/* update the scrollbar */
@@ -1496,8 +1502,8 @@ void drawimage(win)
* efficiently next time.
*/
win->di->logic = nextlogic;
- win->di->topline = win->di->newline[0].start;
- win->di->bottomline = markoffset(next);
+ marksetoffset(win->di->topmark, win->di->newline[0].start);
+ markset(win->di->bottommark, next);
win->di->nlines = linesshown;
win->di->curnbytes = o_bufchars(markbuffer(next));
win->di->curchgs = markbuffer(next)->changes;
@@ -2052,3 +2058,38 @@ void drawextext(win, text, len)
}
}
}
+
+/* This is like drawextext, except that here we're careful about making
+ * control characters (other than newline) visible.
+ */
+void drawexlist(win, text, len)
+ WINDOW win; /* window where ex output should be drawn */
+ CHAR *text; /* text to be output */
+ int len; /* length of text */
+{
+ CHAR buf[2];
+ int from, to;
+
+ /* divide the text into segments of all-printable characters, or
+ * or individual non-printable characters.
+ */
+ for (from = to = 0; to < len; to++)
+ {
+ if (text[to] != '\n' && iscntrl(text[to]))
+ {
+ /* draw the last printable segment, if any */
+ if (from < to)
+ drawextext(win, &text[from], to - from);
+ from = to + 1;
+
+ /* draw this control char in a printable format */
+ buf[0] = '^';
+ buf[1] = text[to] ^ '@';
+ drawextext(win, buf, 2);
+ }
+ }
+
+ /* if we ended with a printable segment, then draw it now */
+ if (from < to)
+ drawextext(win, &text[from], to - from);
+}
View
4 draw.h
@@ -45,8 +45,8 @@ typedef struct
CHAR *curchar; /* characters of current image */
char *curfont; /* fonts of current image */
long *offsets; /* buffer offsets of each individual cell */
- long topline; /* offset of first line drawn */
- long bottomline; /* offset of line after last drawn */
+ MARK topmark; /* first line drawn */
+ MARK bottommark; /* line after last drawn */
BUFFER curbuf; /* current buffer */
long curnbytes; /* size of buffer when current image drawn */
long curchgs; /* buffer's "changes" counter when image drawn */
View
3 draw2.h
@@ -5,7 +5,7 @@
#define drawscratch(di) ((di)->mustredraw = True)
BEGIN_EXTERNC
-extern DRAWINFO *drawalloc P_((int rows, int columns));
+extern DRAWINFO *drawalloc P_((int rows, int columns, MARK top));
extern void drawfree P_((DRAWINFO *di));
extern void drawimage P_((WINDOW win));
extern void drawexpose P_((WINDOW win, int top, int left, int bottom, int right));
@@ -15,4 +15,5 @@ extern void drawfinish P_((WINDOW win));
extern void drawopenedit P_((WINDOW win));
extern void drawopencomplete P_((WINDOW win));
extern void drawextext P_((WINDOW win, CHAR *text, int len));
+extern void drawexlist P_((WINDOW win, CHAR *text, int len));
END_EXTERNC
View
10 elvis.lsm
@@ -1,8 +1,8 @@
Begin3
Title: elvis, a clone of the vi text editor
Version: 2.1
-Release: 3
-Entered-date: 1APR99
+Release: 4
+Entered-date: 15OCT99
Description: Clone of vi editor, with added support for multiple edit
buffers, multiple windows, a variety of user interfaces
(including X-windows), several display modes (including
@@ -11,12 +11,12 @@ Description: Clone of vi editor, with added support for multiple edit
improvements to the X-windows interface, a new graphical
interface for Win32, OS/2 ports, enhanced tags, and an
:alias command. Many other small changes, and bug fixes.
-Keywords: vi editor HTML syntax-coloring X11
+Keywords: vi editor HTML FTP HTTP syntax-coloring X11
Author: kirkenda@cs.pdx.edu (Steve Kirkendall)
Maintained-by:
Primary-site: ftp.cs.pdx.edu /pub/elvis
- 991k elvis-2.1_3.tgz
- 976 elvis.lsm
+ 1012k elvis-2.1_4.tar.gz
+ 999 elvis.lsm
Alternate-site: sunsite.unc.edu /pub/Linux/apps/editors
ftp.false.com /pub/elvis
Original-site:
View
21 ex.c
@@ -1,7 +1,7 @@
/* ex.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_ex[] = "$Id: ex.c,v 2.151 1999/03/11 17:53:08 steve Exp $";
+char id_ex[] = "$Id: ex.c,v 2.153 1999/10/08 18:03:03 steve Exp $";
#include "elvis.h"
@@ -122,12 +122,14 @@ static struct
/*c */{"change", EX_CHANGE, ex_append, a_Range | a_Bang | a_Count | a_Text | q_Undo | q_Ex },
/*cha */{"chdir", EX_CD, ex_cd, a_Bang | a_File | q_Exrc | q_Unsafe },
/*ca */{"calculate", EX_CALC, ex_comment, a_Cmds | q_Exrc },
+/*cas */{"case", EX_CASE, ex_case, a_Lhs | a_Cmds | q_Exrc },
/*cc */{"cc", EX_CC, ex_make, a_Bang | a_Rhs | q_Unsafe | q_SwitchB },
/*cd */{"cd", EX_CD, ex_cd, a_Bang | a_File | q_Exrc | q_Unsafe },
/*cl */{"close", EX_CLOSE, ex_xit, a_Bang | q_MayQuit },
/*co */{"copy", EX_COPY, ex_move, a_Range | a_Target | a_Pflag | q_Autop | q_Undo },
/*col */{"color", EX_COLOR, ex_color, a_Rhs | q_Exrc | q_Custom },
/*d */{"delete", EX_DELETE, ex_delete, a_Range | a_Buffer | a_Count | a_Pflag | q_Undo | q_Autop },
+/*de */{"default", EX_DEFAULT, ex_case, a_Cmds | q_Exrc },
/*di */{"display", EX_DISPLAY, ex_display, a_Rhs },
/*dig */{"digraph", EX_DIGRAPH, ex_digraph, a_Bang | a_Rhs | q_Exrc | q_Custom },
/*do */{"do", EX_DO, ex_do, a_Cmds | q_Exrc },
@@ -192,6 +194,7 @@ static struct
/*sta */{"stag", EX_STAG, ex_tag, a_Rhs },
/*stac*/{"stack", EX_STACK, ex_stack, d_None },
/*su */{"suspend", EX_SUSPEND, ex_suspend, a_Bang | q_Unsafe },
+/*sw */{"switch", EX_SWITCH, ex_switch, a_Cmds | q_Exrc },
/*t */{"to", EX_COPY, ex_move, a_Range | a_Target | a_Pflag | q_Autop | q_Undo },
/*ta */{"tag", EX_TAG, ex_tag, a_Bang | a_Rhs | q_Unsafe | q_SwitchB },
/*th */{"then", EX_THEN, ex_then, a_Cmds | q_Exrc },
@@ -1848,8 +1851,8 @@ static RESULT parse(win, refp, xinf)
CHAR *logstr;/* start of string command, or NULL if from buffer */
int i;
- /* if verbose, then display this line on stderr */
- if (o_verbose >= 3 && !win)
+ /* if verbose, then display this line in window, or on stderr */
+ if (o_verbose >= (win ? 5 : 3))
{
lntext = NULL;
for (scandup(&p2, refp); p2 && *p2 != '\n'; scannext(&p2))
@@ -2609,15 +2612,12 @@ RESULT exstring(win, str, name)
{
EXINFO xinfb; /* buffer, holds info about command being parsed */
CHAR *p; /* pointer used for scanning command line */
- BOOLEAN oldthenflag;
- CHAR *olddotest;
+ EXCTLSTATE oldctlstate;
RESULT result;
void *locals;
- /* commands run this way don't affect the :if or :while expressions */
- oldthenflag = exthenflag;
- olddotest = exdotest;
- exdotest = NULL;
+ /* commands run this way don't affect :if/:while/:switch expressions */
+ exctlsave(oldctlstate);
locals = optlocal(NULL);
/* start reading commands */
@@ -2648,8 +2648,7 @@ RESULT exstring(win, str, name)
Done:
(void)optlocal(locals);
- exthenflag = oldthenflag;
- exdotest = olddotest;
+ exctlrestore(oldctlstate);
return result;
}
View
29 ex.h
@@ -15,9 +15,9 @@ typedef enum
{
EX_ABBR, EX_ALIAS, EX_ALL, EX_APPEND, EX_ARGS, EX_AT,
EX_BANG, EX_BBROWSE, EX_BREAK, EX_BROWSE, EX_BUFFER,
- EX_CALC, EX_CC, EX_CD, EX_CHANGE, EX_CLOSE, EX_COLOR, EX_COMMENT,
- EX_COPY,
- EX_DELETE, EX_DIGRAPH, EX_DISPLAY, EX_DO, EX_DOALIAS,
+ EX_CALC, EX_CASE, EX_CC, EX_CD, EX_CHANGE, EX_CLOSE, EX_COLOR,
+ EX_COMMENT, EX_COPY,
+ EX_DEFAULT, EX_DELETE, EX_DIGRAPH, EX_DISPLAY, EX_DO, EX_DOALIAS,
EX_ECHO, EX_EDIT, EX_ELSE, EX_EQUAL, EX_ERRLIST, EX_ERROR, EX_EVAL,
EX_FILE,
EX_GOTO, EX_GLOBAL, EX_GUI,
@@ -33,7 +33,7 @@ typedef enum
EX_SALL, EX_SAFER, EX_SBBROWSE, EX_SBROWSE, EX_SET, EX_SHELL,
EX_SHIFTL, EX_SHIFTR, EX_SLAST, EX_SNEW, EX_SNEXT, EX_SOURCE,
EX_SPLIT, EX_SPREVIOUS, EX_SREWIND, EX_STAG, EX_STACK, EX_STOP,
- EX_SUBAGAIN, EX_SUBRECENT, EX_SUBSTITUTE, EX_SUSPEND,
+ EX_SUBAGAIN, EX_SUBRECENT, EX_SUBSTITUTE, EX_SUSPEND, EX_SWITCH,
EX_TAG, EX_THEN, EX_TRY,
EX_UNABBR, EX_UNALIAS, EX_UNBREAK, EX_UNDO, EX_UNMAP,
EX_VERSION, EX_VGLOBAL, EX_VISUAL,
@@ -74,9 +74,24 @@ typedef struct
} EXINFO;
+/* This stores the current state of ex's control structures */
+typedef struct
+{
+ BOOLEAN thenflag; /* result of an :if */
+ BOOLEAN switchcarry; /* falling through to next :case? */
+ CHAR *switchvalue; /* result of :switch, compare to :case value */
+ CHAR *dotest; /* expression to be evaluated by :do */
+} EXCTLSTATE;
+
+
/* defined in exconfig.c */
-extern BOOLEAN exthenflag;
-extern CHAR *exdotest;
+extern EXCTLSTATE exctlstate;
+
+/* macros for saving & restoring the control state in a local variable */
+#define exctlsave(v) {(v) = exctlstate; memset(&exctlstate, 0, sizeof exctlstate);}
+#define exctlrestore(v) {if (exctlstate.switchvalue) safefree(exctlstate.switchvalue);\
+ if (exctlstate.dotest) safefree(exctlstate.dotest);\
+ exctlstate = (v);}
/* defined in exmake.c */
extern BOOLEAN makeflag;
@@ -103,6 +118,7 @@ extern RESULT ex_at P_((EXINFO *xinf));
extern RESULT ex_bang P_((EXINFO *xinf));
extern RESULT ex_browse P_((EXINFO *xinf));
extern RESULT ex_buffer P_((EXINFO *xinf));
+extern RESULT ex_case P_((EXINFO *xinf));
extern RESULT ex_cd P_((EXINFO *xinf));
extern RESULT ex_color P_((EXINFO *xinf));
extern RESULT ex_comment P_((EXINFO *xinf));
@@ -138,6 +154,7 @@ extern RESULT ex_source P_((EXINFO *xinf));
extern RESULT ex_stack P_((EXINFO *xinf));
extern RESULT ex_substitute P_((EXINFO *xinf));
extern RESULT ex_suspend P_((EXINFO *xinf));
+extern RESULT ex_switch P_((EXINFO *xinf));
extern RESULT ex_tag P_((EXINFO *xinf));
extern RESULT ex_then P_((EXINFO *xinf));
extern RESULT ex_undo P_((EXINFO *xinf));
View
13 exaction.c
@@ -1,7 +1,7 @@
/* exaction.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_exaction[] = "$Id: exaction.c,v 2.86 1999/02/26 21:27:08 steve Exp $";
+char id_exaction[] = "$Id: exaction.c,v 2.88 1999/10/07 16:23:58 steve Exp $";
#include "elvis.h"
@@ -533,10 +533,13 @@ RESULT ex_file(xinf)
switch (xinf->command)
{
case EX_EQUAL:
- if (xinf->from != xinf->to)
+ if (xinf->anyaddr)
{
- msg(MSG_INFO, "[ddd]$1,$2 = $3 lines",
- xinf->from, xinf->to, xinf->to - xinf->from + 1);
+ if (xinf->from != xinf->to)
+ msg(MSG_INFO, "[dd]$1,$2 = ($2-$1+1) lines",
+ xinf->from, xinf->to);
+ else
+ msg(MSG_INFO, "[d]$1", xinf->from);
}
else
{
@@ -962,7 +965,7 @@ RESULT ex_bang(xinf)
/* clean up & exit */
markfree(mark);
- return (prgclose() == 0) ? RESULT_COMPLETE : RESULT_ERROR;
+ return (gui->prgclose ? (*gui->prgclose)() : prgclose()) == 0 ? RESULT_COMPLETE : RESULT_ERROR;
}
View
163 exconfig.c
@@ -1,14 +1,14 @@
/* exconfig.c */
/* Copyright 1995 by Steve Kirkendall */
-char id_exconfig[] = "$Id: exconfig.c,v 2.84 1999/03/11 17:55:46 steve Exp $";
+char id_exconfig[] = "$Id: exconfig.c,v 2.87 1999/10/08 18:03:03 steve Exp $";
#include "elvis.h"
-BOOLEAN exthenflag; /* set by ":if", tested by ":then" & ":else" */
-CHAR *exdotest; /* set by ":while", tested by ":do" */
+/* This variable stores the current state of ex's control structures. */
+EXCTLSTATE exctlstate;
@@ -33,7 +33,6 @@ static alias_t *aliases; /* This is the head of a list of aliases */
/* look up a name in the alias list. The name can be terminated with any
* non-alphanumeric character, not just '\0'. Return its name if alias,
* or NULL otherwise. Optionally ignore if already in use.
- i
*/
char *exisalias(name, inuse)
char *name; /* name of a command, maybe an alias */
@@ -59,52 +58,52 @@ static void listalias(win, alias, shortformat)
CHAR *start;
int len;
- drawextext(win, toCHAR(alias->name), strlen(alias->name));
+ drawexlist(win, toCHAR(alias->name), strlen(alias->name));
if (CHARchr(alias->command, '\n') == alias->command + CHARlen(alias->command) - 1)
{
/* single-line command simply follows the alias name */
- drawextext(win, blanks, 10 - (CHARlen(alias->name) % 10));
- drawextext(win, alias->command, CHARlen(alias->command));
+ drawexlist(win, blanks, 10 - (CHARlen(alias->name) % 10));
+ drawexlist(win, alias->command, CHARlen(alias->command));
}
else if (shortformat)
{
/* multi-line command, but only show first line */
- drawextext(win, blanks, 10 - (CHARlen(alias->name) % 10));
+ drawexlist(win, blanks, 10 - (CHARlen(alias->name) % 10));
ch[0] = '{';
ch[1] = ' ';
- drawextext(win, ch, 2);
+