9. Operating System Notes

Elvis 2.0 currently runs under MS-DOS, MS-WindowsNT/MS-Winsdows95, and many versions of UNIX. This describes the quirks of each implementation.

9.1 MS-DOS

Elvis 2.0 was ported to MS-DOS by Steve Kirkendall, using code from Guntram Blohm and Martin Patzel's MS-DOS port elvis 1.X.
The "os" option
Under MS-DOS, the os option's value is "msdos".
The "shell" option
The default value of shell is "C:\COMMAND.COM". This can be overridden by the value of the COMSPEC environment variable.
The "lpout" option
The default value of the lpout option is "prn", which causes the :lpr command to write its output directly to the printer.

I tried to make it use the spooler program, PRINT, but failed. The first problem I ran into was the fact that PRINT can't read data from stdin; it must be given the name of a file. To work around this problem, I modified the osmsdos/osprg.c file to allow $1 in the command line to be replaced by the name of elvis' temporary file that contains the print data.

This lead to the the second problem: PRINT doesn't make a copy of the file, and elvis deletes the temporary file as soon as PRINT exits. Since PRINT exits before the file has been printed completely, this means that the file is deleted before PRINT is through reading it. The print job is truncated. I was unable to find a way around this problem, so I gave up and just set lpout=prn.

The "ccprg" option
The default value of the ccprg option is "cl /c ($1?$1:$2)", which is appropriate for MSVC++ 1.5. This way, you can run :cc without arguments to compile (but not link) the current source file. If you supply arguments, they'll be used instead of the filename.
The "makeprg" option
The default value of the makeprg option is "nmake -f ($1?$1:basename($2)".mak")", which is appropriate for MSVC++ 1.5. When :make is run without arguments, the NMAKE program will be run on a *.MAK file with the same basename as the current source file. Or you can explicitly give a different *.MAK file name as an argument.
The "elvispath" option
The default value of the elvispath option is "~\lib;~". Note that elements of the path are separated with semicolons. The ~ character is replaced by the value of the home option, which is usually the name of the directory where ELVIS.EXE resides.
The "blksize" option
The blksize option controls the size of elvis' data blocks. Under other operating systems this is usually 2048, but for MS-DOS is it reduced to 512 because memory is tight.
The "TERM" environment variable
The TERM environment variable tells elvis how to access the screen. If it is undefined, or set to "pcbios", then elvis will use BIOS calls to access the screen. This should work on all MS-DOS systems, but it isn't very fast.

If TERM is set to "ansi" then elvis will output escape sequences which are supported by the ANSI.SYS driver. This isn't recommended; ANSI.SYS is just as slow as the BIOS, and it isn't as powerful so elvis is forced to redraw the screen instead of scrolling it, in some circumstances.

If TERM is set to "nansi" then elvis will output escape sequences which are supported by more capable drivers, such as NANSI.SYS and FANSI.SYS. These drivers usually bypass the BIOS, so they are very fast. If you're looking for a way to speed up elvis, this is probably your best bet.

9.2 MS-Windows95/MS-WindowsNT

Elvis 2.0 was ported to Windows95/WindowsNT by Steve Kirkendall.
The "os" option
Under Windows95/WindowsNT, the os option's value is "win32".
The "shell" option
The default value of shell is "cmd".
The "lpout" option
The default value of the lpout option is "print $1", which causes the :lpr command to print via the standard spooler.

The "$1" is there to work around a problem: PRINT can't read data from stdin. It must be given the name of a file, so I modified the oswin32/osprg.c file to allow $1 in the command line to be replaced by the name of elvis' temporary file that contains the print data.

The "ccprg" option
The default value of the ccprg option is "cl /c ($1?$1:$2)", which is appropriate for MSVC++ 2.0 or later. This way, you can run :cc without arguments to compile (but not link) the current source file. If you supply arguments, they'll be used instead of the filename.
The "makeprg" option
The default value of the makeprg option is "nmake -f ($1?$1:basename($2)".mak")", which is appropriate for MSVC++ 2.0 or later. When :make is run without arguments, the NMAKE program will be run on a *.MAK file with the same basename as the current source file. Or you can explicitly give a different *.MAK file name as an argument.
The "elvispath" option
The default value of the elvispath option is "~\elvislib;BIN;BIN\lib", where BIN is the name of the directory where ELVIS.EXE resides. Note that elements of the path are separated with semicolons. The ~ character is replaced by the value of the home option, which is usually C:\users\default for WindowsNT.
The "TERM" environment variable
The TERM environment variable tells elvis how to access the screen. It should probably be left undefined, or set to "console". Other values have not been tested, but the following should work via terminal emulators or whatever: dosansi, nansi, vt100, vt100w, and vt52.
Console size
Win32 distinguishes between a console's buffer size and its window size. Many users like to set the buffer to a huge size (e.g., 100 lines) but leave the window set at 25 lines. They do this so they can scroll back and review earlier programs' output.

When elvis starts, it creates a separate buffer which is the same size as the window. Elvis does this mostly so the scrollbar will go away. If you change the buffer size while elvis is running, elvis will adjust the size of the window to match the new buffer size, and then redraw the text to take advantage of the new screen size.

When you exit elvis, the console will revert to its original buffer and original window size.

Mouse
The mouse should work, whether run in full-screen mode or in a window. Dragging with the left, right, or both buttons pressed is will select characters, whole lines, or a rectangular block, respectively. Clicking the left button will cancel a pending text selection, and move the cursor. Clicking the right button will move the cursor; if a text selection is pending, it will be extended to the new cursor position. Double-clicking the left or right button will follow a hypertext reference or return from one, respectively.

There is a weird bug in WindowsNT's console mouse support. If, when the console is shown in a window, part of that console is located off-screen, then the mouse won't be able to move there, even if you're currently in full-screen mode! Since WindowsNT will sometimes resize your console when you switch between full-screen and windowed modes, this might not be obvious. But if the mouse refuses to move onto part of your full-screen console, I suggest you switch back to windowed mode and reduce the size of your font there. When you switch back to full-screen mode again it will look exactly the same, but the mouse should be able to go where no mouse has gone before.

9.3 UNIX

Elvis was originally written under UNIX, so it seems strange to say I ported it to UNIX, but I'll say it anyway: Elvis 2.0 was ported to UNIX by Steve Kirkendall, with a lot of feedback from many people on the net.

Since elvis (and vi, for that matter) were originally designed and written for UNIX, there aren't many quirks that show up for generic UNIX. Most of this section will describe the quirks of individual UNIX versions.

The "os" option
Under all versions of UNIX, the os option's value is "unix".
The "lpout" option
The default value of the lpout option is either "!lp -s" or "!lpr". The choice is made by the configure script; if /usr/bin/lp exists then it will use "!lp -s", else it will use "!lpr".
The "elvispath" option
The default value of elvispath is usually ~/.elvislib:/usr/local/lib/elvis. The /usr/local/lib/elvis member of that path can be set via the --datadir=directory flag.
Missing functions
If your linker reports an undefined function, such as strdup(), then you should check the need.h and need.c files; they contain implementations of many such functions. To use elvis' version of the missing function, edit the config.h file and change "#undef NEED_XXX" to "#define NEED_XXX".

9.3.1 UNIX versions

The configure script works around most of the quirks of individual UNIX versions. Here, I will describe what configure does, or fails to do, for each type of UNIX.
SunOS and Solaris
SunOS and Solaris2 both claim to be SunOS, according to the uname command. However, their configuration is quite different, so the configure distinguishes between them by looking at the revision number output by "uname -r".

The SunOS port uses BSD's sgtty ioctl calls, instead of the POSIX calls, even though SunOS supports the POSIX calls. This choice was made because differences in signal handling were preventing the SunOS port from responding to window resize signals.

Solaris2 seems to have a bad implementation of rlogin, at least on the system where I tested it. It couldn't handle 2000-character write() calls. Because this is a communication issue, and not purely a Solaris issue, I decided to reduce the size of the output buffer for all systems to 1500 bytes.

The SunOS port uses termcap because I prefer it. The Solaris port uses terminfo because Solaris doesn't seem to have a termcap library.

If you configure elvis to support X-windows, and your LD_LIBRARY_PATH environment variable doesn't contain an X11 library directory, then the configure script will output a warning message telling you how to set that variable.

OSF-1
This configuration is rather weird. I don't have access to an OSF-1 system myself, so it's hard for me to make it less weird.

The primary weirdness is that it uses tinytcap.c (by defining NEED_TGETENT in the config.h file) instead of the real terminfo functions. I suggest you try compiling without NEED_TGETENT.

BSD
For BSD, configure will try to use the shlicc2 compiler if it is available, so elvis can use shared libraries.

Interestingly, the BSD port is configured to use POSIX ioctl calls instead of BSD's own sgtty calls. This may be a mistake. If elvis fails to adjust when you resize your xterm, then I suggest you add -DUSE_SGTTY to the end of the CC= line in Makefile, and recompile.

SCO
SCO used to change the operating system name (as reported by the "uname" command) to match the network node name. Does it still do that? If "uname" doesn't output some string containing "sco" then you'll need to explicitly give the name "sco" as an argument to the configure script.