dag@chinet.UUCP (11/18/87)
I have made a few minor modifications to the file "tgetent.c" from the recently posted termcap library for the ST. One of these changes permits the use of fully qualified paths in the environment variable "TERMCAP", thus "c:\etc\termcap" could be used, the old version required that the file name be prefixed by a "\" or "/", thus devices were not allowed. That change should work with any compiler, and is conditionalized under the symbol "GEMDOS". The other changes add a search along the library search path (LIBPATH) for the termcap file, and uses the function "path" from the Mark Williams C library (version 2.0 and later). These changes are conditionalized under the symbol "MWC", which must be defined on the compilation command line if you want the feature to be used. Here is an edited "diff" of the files. No lines were deleted, just added. I hope you find these changes useful. 94 a 95,99 #ifdef MWC #include <path.h> /* path search stuff */ #define DEFAULT_ROOT "termcap" /* name without path component */ #define DEFAULT_FILE "termcap" #else ============================= 95 a 101 #endif ============================= 227 a 234,236 #ifdef MWC char *pp; /* path pointer... */ #endif ============================= 230 a 240,242 #ifdef GEMDOS if (*cp == '\\' || *(cp+2) == ':') { /* Improved recog. */ #else ============================= 231 a 244 #endif ============================= 254 a 268,274 #ifdef MWC if ((pp = getenv("LIBPATH")) == NULL) /* Get the library path */ pp = DEFLIBPATH; /* if none, use default */ if ((pp = path(pp, DEFAULT_ROOT, 4)) == NULL) pp = DEFAULT_FILE; /* Find the file */ return (fopen(pp, "r")); /* Open the file */ #else ============================= 255 a 276 #endif ============================= Note: If you copy this posting into a file on your ST along with the source for tgetent.c from the original posting, and you have the version of micro emacs from the 2.* version of MWC, you can use the "error buffer" feature of the editor to speed incorporating these changes. At the shell prompt, type "me tgetent.c -e <file>" where <file> is the name of the file containing this posting. This will bring the editor up with tgetent.c in a large window and this posting in a small window, and the cursor on the first line in tgetent.c where a change should be added. Move the cursor down to the next line and insert the lines that follow the line numbers up until the "=============================", then hit ^X followed by >, which should move you to the next diff. You will probably want to shrink the tgetent.c window so you can see all of each change without messing up the dot position in the error buffer. You could also simply print this out and use the <esc>-G "goto-line" command (don't use ^X-g, since this uses line-in-buffer rather than line-from-file") to go to each line to append to. (only in MWC derived versions of me). -- Daniel A. Glasser ----------------------------------------+---------------------------- Cheese is not a discipline! | ...!ihnp4!chinet!dag | ...!ihnp4!mwc!gorgon!dag | ...!ihnp4!chinet!gorgon!dag Disclaimer: I assume full responsibility for my opinions. If my employer knew of some of them, I'd be unemployed.