nortond@mosys.UUCP (Daniel A. Norton) (12/07/87)
I have some diffs for MicroEMACS and Microsoft C versions 3, 4, & 5. The changes are described below. If you are interested in obtaining the diffs, e-mail me -- please do *not* post the request in a news article. If there is sufficient interest, I will post the changes. I am unsure, however, of where to post the changes. comp.sources.bugs? comp.emacs? Somewhere else? The diffs are about 16k. I also have a Makefile. 001 - Changed routines whose names conflict with standard library routines. Apparently, the authors did not like the way the standard routines worked and created new ones with the same names. This is a pet peeve of mine, since someone looking through such code does not really know right-away that he is looking at a bastardized version of the function. Functions affected are: Old Name New Name ltoa fmtlong itoa itods strncpy xstrncpy atoi dstoi The diffs file is fairly large with these changes. You may prefer to do global substitutes on the original to the new names. 002 - For some odd reason, the "malloc" function is declared throughout the sources. Since it is already defined in edef.h, I have removed the duplicate declarations. Besides, the redefinitions conflict with the definitions provided by the standard include file in MSC. 003 - For the MSC version, I have changed edef.h to include the standard include files "stdlib.h" and "string.h". 004 - Have added a capability to create a backup file when saving a file to disk. The suffix of the old version of the file is changed to .BAK. The environment variable "$backup" is added. When it is set (non-zero), the backup file is created. When is reset (zero), the operation is as before. On startup, the backup flag is turned off. It may be turned on with the "emacs.rc" file. This feature is enabled by the compile-time flag DOSBAK. 005 - Unfortunately, the MSC compilers vary between versions enough to warrant three additional compile-time variables: MSC3, MSC4, and MSC5, to indicate the version of the MSC compiler. 006 - EMACS seems to run faster in a network environment if the file is opened in binary mode and CR characters are appended manually by EMACS. It is faster when the file is written, that is. 007 - the "sindex" function in eval.c is updated for MSC to use the "strstr" library function. 008 - Since MS-DOS does not distinguish between case in file names, EMACS is changed to do the same. Previously, it was forcing the name to lower case. Now you can "emacs Makefile" and the name will display as "Makefile", rather than "makefile". 009 - The spawn.c routines did not even compile with the regular release of 3.9e. The changes here take advantage of what is available with the MSC routines. In particular, there is no need for the "execprog" routine. Also, when invoking the shell, the SHELL environment variable is checked before checking the COMSPEC variable for the name of the user shell. 010 - Some of the messages were inconsistent and misspelled in spawn.c. --- Daniel A. Norton nortond@mosys.UUCP c/o Momentum Systems Corporation ...uunet!mosys!nortond 2 Keystone Avenue Cherry Hill, NJ 08003 609/424-0734 -- Daniel A. Norton nortond@mosys.UUCP c/o Momentum Systems Corporation ...uunet!mosys!nortond 2 Keystone Avenue Cherry Hill, NJ 08003 609/424-0734
nortond@mosys.UUCP (Daniel A. Norton) (12/20/87)
Archive-name: uemacs/msc-diffs Here are the diffs that I mentioned for MSC and MicroEMACS. If you have MSC 5.0, you can also use the Makefile that is in this archive. Make sure that you do not select intrinsic function generation with MSC 5.0. The file patch.msc contains context diffs suitable for input to patch, with the exception that I have converted spaces to tabs in the original where useful to reduce the size of this shar. -- Daniel A. Norton nortond@mosys.UUCP c/o Momentum Systems Corporation ...uunet!mosys!nortond 2 Keystone Avenue Cherry Hill, NJ 08003 609/424-0734 --------------------------Cut Here-------------------------- : #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # Changes.msc # Makefile.msc # patch.msc # # This archive created: Sat Dec 19 15:24:22 1987 # if test -f 'Changes.msc' then echo shar: will not over-write existing "'Changes.msc'" else echo extracting "'Changes.msc'" sed 's/^X//' > Changes.msc <<'SHAR_EOF' X 001 - Changed routines whose names conflict with standard Xlibrary routines. Apparently, the authors did not like the way Xthe standard routines worked and created new ones with the same Xnames. This is a pet peeve of mine, since someone looking Xthrough such code does not really know right-away that he is Xlooking at a bastardized version of the function. Functions Xaffected are: X Old Name New Name X ltoa fmtlong X itoa itods X strncpy xstrncpy X atoi dstoi X XThe diffs file is fairly large with these changes. You may Xprefer to do global substitutes on the original to the new names. X X X 002 - For some odd reason, the "malloc" function is Xdeclared throughout the sources. Since it is already defined in Xedef.h, I have removed the duplicate declarations. Besides, the Xredefinitions conflict with the definitions provided by the Xstandard include file in MSC. X X X 003 - For the MSC version, I have changed edef.h to Xinclude the standard include files "stdlib.h" and "string.h". X X X 004 - Have added a capability to create a backup file Xwhen saving a file to disk. The suffix of the old version of the Xfile is changed to .BAK. The environment variable "$backup" is Xadded. When it is set (non-zero), the backup file is created. XWhen is reset (zero), the operation is as before. On startup, Xthe backup flag is turned off. It may be turned on with the X"emacs.rc" file. This feature is enabled by the compile-time Xflag DOSBAK. X X X 005 - Unfortunately, the MSC compilers vary between Xversions enough to warrant three additional compile-time Xvariables: MSC3, MSC4, and MSC5, to indicate the version of the XMSC compiler. X X X 006 - EMACS seems to run faster in a network environment Xif the file is opened in binary mode and CR characters are Xappended manually by EMACS. It is faster when the file is written, Xthat is. X X 007 - Since MS-DOS does not distinguish between case in Xfile names, EMACS is changed to do the same. Previously, it was Xforcing the name to lower case. Now you can "emacs Makefile" and Xthe name will display as "Makefile", rather than "makefile". X X X 008 - The spawn.c routines did not even compile with the Xregular release of 3.9e. The changes here take advantage of what Xis available with the MSC routines. In particular, there is no Xneed for the "execprog" routine. Also, when invoking the shell, Xthe SHELL environment variable is checked before checking the XCOMSPEC variable for the name of the user shell. X X 009 - Some of the messages were inconsistent and Xmisspelled in spawn.c. X--- XDaniel A. Norton nortond@mosys.UUCP Xc/o Momentum Systems Corporation ...uunet!mosys!nortond X2 Keystone Avenue XCherry Hill, NJ 08003 609/424-0734 SHAR_EOF if test 2680 -ne "`wc -c < 'Changes.msc'`" then echo shar: error transmitting "'Changes.msc'" '(should have been 2680 characters)' fi fi if test -f 'Makefile.msc' then echo shar: will not over-write existing "'Makefile.msc'" else echo extracting "'Makefile.msc'" sed 's/^X//' > Makefile.msc <<'SHAR_EOF' X# Makefile for MicroEMACS 3.9 X# MS-DOS and MSC 5.0 X X# Enable the following two lines for debugging X#CDEBUG = -Od -Zi -DDAN_DEBUG X#LDEBUG = /co X X#CDEBUG = -DDAN_DEBUG X XCDEFS = -DLINT_ARGS XCFLAGS= -AL -Oalt -Gs $(CDEFS) $(CDEBUG) XLFLAGS= /noi/st:16384$(LDEBUG) X XBIN = \usr\local\bin X XOBJS = ansi.obj basic.obj bind.obj buffer.obj crypt.obj dg10.obj \ X display.obj eval.obj exec.obj file.obj fileio.obj \ X hp110.obj hp150.obj ibmpc.obj input.obj isearch.obj line.obj \ X lock.obj main.obj random.obj region.obj search.obj spawn.obj \ X st520.obj tcap.obj termio.obj tipc.obj vmsvt.obj vt52.obj \ X window.obj word.obj z309.obj X XSRCS = ansi.c basic.c bind.c buffer.c crypt.c dg10.c \ X display.c eval.c exec.c file.c fileio.c \ X hp110.c hp150.c ibmpc.c input.c isearch.c line.c \ X lock.c main.c random.c region.c search.c spawn.c \ X st520.c tcap.c termio.c tipc.c vmsvt.c vt52.c \ X window.c word.c z309.c X XHDRS = estruct.h edef.h efunc.h epath.h ebind.h evar.h X Xemacs.exe: $(OBJS) X $(LINK) $(LFLAGS) @emacs.lnk X -del emacs.unp X ren emacs.exe emacs.unp X exepack emacs.unp emacs.exe X# copy emacs.exe $(BIN) X X$(OBJS): $(HDRS) SHAR_EOF if test 1115 -ne "`wc -c < 'Makefile.msc'`" then echo shar: error transmitting "'Makefile.msc'" '(should have been 1115 characters)' fi fi if test -f 'patch.msc' then echo shar: will not over-write existing "'patch.msc'" else echo extracting "'patch.msc'" sed 's/^X//' > patch.msc <<'SHAR_EOF' XIndex: buffer.c X*** archive/buffer.c Sat Dec 19 15:20:41 1987 X--- msdos/buffer.c Sat Dec 19 15:21:45 1987 X*************** X*** 336,338 **** X } X! ltoa(b, 7, nbytes); /* 6 digit buffer size. */ X cp2 = &b[0]; X X--- 336,338 ---- X } X! fmtlong(b, 7, nbytes); /* 6 digit buffer size. */ X cp2 = &b[0]; X*************** X*** 361,363 **** X X! ltoa(buf, width, num) X X X--- 361,363 ---- X X! fmtlong(buf, width, num) X X*************** X*** 443,445 **** X register LINE *lp; X- char *malloc(); X X X--- 443,444 ---- X register LINE *lp; X XIndex: display.c X*** archive/display.c Sat Dec 19 15:20:43 1987 X--- msdos/display.c Sat Dec 19 15:21:47 1987 X*************** X*** 45,47 **** X register VIDEO *vp; X- char *malloc(); X X X--- 45,46 ---- X register VIDEO *vp; X XIndex: edef.h X*** archive/edef.h Sat Dec 19 15:20:46 1987 X--- msdos/edef.h Sat Dec 19 15:21:48 1987 X*************** X*** 17,19 **** X char *gtusr(); X! char *itoa(); X char *ltos(); X X--- 17,19 ---- X char *gtusr(); X! char *itods(); X char *ltos(); X*************** X*** 19,20 **** X char *ltos(); X char *malloc(); X X--- 19,24 ---- X char *ltos(); X+ #if MSC X+ #include <stdlib.h> X+ #include <string.h> X+ #else X char *malloc(); X*************** X*** 20,23 **** X char *malloc(); X- char *mklower(); X- char *mkupper(); X char *strcat(); X X--- 24,25 ---- X char *malloc(); X char *strcat(); X*************** X*** 24,26 **** X char *strcpy(); X! char *strncpy(); X char *token(); X X--- 26,31 ---- X char *strcpy(); X! #endif X! char *xstrncpy(); X! char *mklower(); X! char *mkupper(); X char *token(); X*************** X*** 29,30 **** X unsigned int stock(); X X X--- 34,36 ---- X unsigned int stock(); X+ char *xtmpnam(); X X*************** X*** 87,88 **** X int restflag = FALSE; /* restricted use? */ X int lastkey = 0; /* last keystoke */ X X--- 93,97 ---- X int restflag = FALSE; /* restricted use? */ X+ #if DOSBAK X+ int backupflag = FALSE; /* create .BAK files? */ X+ #endif X int lastkey = 0; /* last keystoke */ X*************** X*** 227,228 **** X extern int restflag; /* restricted use? */ X extern int lastkey; /* last keystoke */ X X--- 236,240 ---- X extern int restflag; /* restricted use? */ X+ #if DOSBAK X+ extern int backupflag; /* create .BAK files? */ X+ #endif X extern int lastkey; /* last keystoke */ XIndex: estruct.h X*** archive/estruct.h Sat Dec 19 15:20:51 1987 X--- msdos/estruct.h Sat Dec 19 15:21:51 1987 X*************** X*** 54,57 **** X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X! #define AZTEC 1 /* Aztec C 3.20e */ X! #define MSC 0 /* MicroSoft C compile version 3 & 4 */ X #define TURBO 0 /* Turbo C/MSDOS */ X X--- 54,60 ---- X #define LATTICE 0 /* Lattice 2.14 thruough 3.0 compilers */ X! #define AZTEC 0 /* Aztec C 3.20e */ X! #define MSC3 0 /* MicroSoft C compiler version 3 */ X! #define MSC4 0 /* MicroSoft C compiler version 4 */ X! #define MSC5 1 /* MicroSoft C compiler version 5 */ X! #define MSC (MSC3 | MSC4 | MSC5) /* MicroSoft C version 3, 4 or 5 */ X #define TURBO 0 /* Turbo C/MSDOS */ X*************** X*** 92,94 **** X #define CTRLZ 0 /* add a ^Z at end of files under MSDOS only */ X! #define ADDCR 0 /* ajout d'un CR en fin de chaque ligne (ST520) */ X #define NBRACE 1 /* new style brace matching command */ X X--- 95,98 ---- X #define CTRLZ 0 /* add a ^Z at end of files under MSDOS only */ X! #define ADDCR (1 & (ST520 | MSDOS)) /* add a CR at the end of each line X! (ST520/MSDOS) */ X #define NBRACE 1 /* new style brace matching command */ X*************** X*** 94,95 **** X #define NBRACE 1 /* new style brace matching command */ X X X--- 98,100 ---- X #define NBRACE 1 /* new style brace matching command */ X+ #define DOSBAK (1 & MSDOS) /* create .BAK file on save (MSDOS) */ X X*************** X*** 665,666 **** X #endif X- X X--- 670,670 ---- X #endif XIndex: eval.c X*** archive/eval.c Sat Dec 19 15:20:53 1987 X--- msdos/eval.c Sat Dec 19 15:21:52 1987 X*************** X*** 68,75 **** X switch (fnum) { X! case UFADD: return(itoa(atoi(arg1) + atoi(arg2))); X! case UFSUB: return(itoa(atoi(arg1) - atoi(arg2))); X! case UFTIMES: return(itoa(atoi(arg1) * atoi(arg2))); X! case UFDIV: return(itoa(atoi(arg1) / atoi(arg2))); X! case UFMOD: return(itoa(atoi(arg1) % atoi(arg2))); X! case UFNEG: return(itoa(-atoi(arg1))); X case UFCAT: strcpy(result, arg1); X X--- 68,75 ---- X switch (fnum) { X! case UFADD: return(itods(dstoi(arg1) + dstoi(arg2))); X! case UFSUB: return(itods(dstoi(arg1) - dstoi(arg2))); X! case UFTIMES: return(itods(dstoi(arg1) * dstoi(arg2))); X! case UFDIV: return(itods(dstoi(arg1) / dstoi(arg2))); X! case UFMOD: return(itods(dstoi(arg1) % dstoi(arg2))); X! case UFNEG: return(itods(-dstoi(arg1))); X case UFCAT: strcpy(result, arg1); X*************** X*** 76,78 **** X return(strcat(result, arg2)); X! case UFLEFT: return(strncpy(result, arg1, atoi(arg2))); X case UFRIGHT: return(strcpy(result, X X--- 76,78 ---- X return(strcat(result, arg2)); X! case UFLEFT: return(xstrncpy(result, arg1, dstoi(arg2))); X case UFRIGHT: return(strcpy(result, X*************** X*** 78,82 **** X case UFRIGHT: return(strcpy(result, X! &arg1[(strlen(arg1) - atoi(arg2))])); X! case UFMID: return(strncpy(result, &arg1[atoi(arg2)-1], X! atoi(arg3))); X case UFNOT: return(ltos(stol(arg1) == FALSE)); X X--- 78,82 ---- X case UFRIGHT: return(strcpy(result, X! &arg1[(strlen(arg1) - dstoi(arg2))])); X! case UFMID: return(xstrncpy(result, &arg1[dstoi(arg2)-1], X! dstoi(arg3))); X case UFNOT: return(ltos(stol(arg1) == FALSE)); X*************** X*** 82,86 **** X case UFNOT: return(ltos(stol(arg1) == FALSE)); X! case UFEQUAL: return(ltos(atoi(arg1) == atoi(arg2))); X! case UFLESS: return(ltos(atoi(arg1) < atoi(arg2))); X! case UFGREATER: return(ltos(atoi(arg1) > atoi(arg2))); X case UFSEQUAL: return(ltos(strcmp(arg1, arg2) == 0)); X X--- 82,86 ---- X case UFNOT: return(ltos(stol(arg1) == FALSE)); X! case UFEQUAL: return(ltos(dstoi(arg1) == dstoi(arg2))); X! case UFLESS: return(ltos(dstoi(arg1) < dstoi(arg2))); X! case UFGREATER: return(ltos(dstoi(arg1) > dstoi(arg2))); X case UFSEQUAL: return(ltos(strcmp(arg1, arg2) == 0)); X*************** X*** 91,93 **** X case UFOR: return(ltos(stol(arg1) || stol(arg2))); X! case UFLENGTH: return(itoa(strlen(arg1))); X case UFUPPER: return(mkupper(arg1)); X X--- 91,93 ---- X case UFOR: return(ltos(stol(arg1) || stol(arg2))); X! case UFLENGTH: return(itods(strlen(arg1))); X case UFUPPER: return(mkupper(arg1)); X*************** X*** 94,98 **** X case UFLOWER: return(mklower(arg1)); X! case UFTRUTH: return(ltos(atoi(arg1) == 42)); X! case UFASCII: return(itoa((int)arg1[0])); X! case UFCHR: result[0] = atoi(arg1); X result[1] = 0; X X--- 94,98 ---- X case UFLOWER: return(mklower(arg1)); X! case UFTRUTH: return(ltos(dstoi(arg1) == 42)); X! case UFASCII: return(itods((int)arg1[0])); X! case UFCHR: result[0] = dstoi(arg1); X result[1] = 0; X*************** X*** 102,106 **** X return(result); X! case UFRND: return(itoa((ernd() % abs(atoi(arg1))) + 1)); X! case UFABS: return(itoa(abs(atoi(arg1)))); X! case UFSINDEX: return(itoa(sindex(arg1, arg2))); X case UFENV: X X--- 102,106 ---- X return(result); X! case UFRND: return(itods((ernd() % abs(dstoi(arg1))) + 1)); X! case UFABS: return(itods(abs(dstoi(arg1)))); X! case UFSINDEX: return(itods(sindex(arg1, arg2))); X case UFENV: X*************** X*** 117,122 **** X return(tsp == NULL ? "" : tsp); X! case UFBAND: return(itoa(atoi(arg1) & atoi(arg2))); X! case UFBOR: return(itoa(atoi(arg1) | atoi(arg2))); X! case UFBXOR: return(itoa(atoi(arg1) ^ atoi(arg2))); X! case UFBNOT: return(itoa(~atoi(arg1))); X case UFXLATE: return(xlat(arg1, arg2, arg3)); X X--- 117,122 ---- X return(tsp == NULL ? "" : tsp); X! case UFBAND: return(itods(dstoi(arg1) & dstoi(arg2))); X! case UFBOR: return(itods(dstoi(arg1) | dstoi(arg2))); X! case UFBXOR: return(itods(dstoi(arg1) ^ dstoi(arg2))); X! case UFBNOT: return(itods(~dstoi(arg1))); X case UFXLATE: return(xlat(arg1, arg2, arg3)); X*************** X*** 166,172 **** X switch (vnum) { X! case EVFILLCOL: return(itoa(fillcol)); X! case EVPAGELEN: return(itoa(term.t_nrow + 1)); X! case EVCURCOL: return(itoa(getccol(FALSE))); X! case EVCURLINE: return(itoa(getcline())); X! case EVRAM: return(itoa((int)(envram / 1024l))); X case EVFLICKER: return(ltos(flickcode)); X X--- 166,172 ---- X switch (vnum) { X! case EVFILLCOL: return(itods(fillcol)); X! case EVPAGELEN: return(itods(term.t_nrow + 1)); X! case EVCURCOL: return(itods(getccol(FALSE))); X! case EVCURLINE: return(itods(getcline())); X! case EVRAM: return(itods((int)(envram / 1024l))); X case EVFLICKER: return(ltos(flickcode)); X*************** X*** 172,174 **** X case EVFLICKER: return(ltos(flickcode)); X! case EVCURWIDTH:return(itoa(term.t_ncol)); X case EVCBUFNAME:return(curbp->b_bname); X X--- 172,174 ---- X case EVFLICKER: return(ltos(flickcode)); X! case EVCURWIDTH:return(itods(term.t_ncol)); X case EVCBUFNAME:return(curbp->b_bname); X*************** X*** 179,183 **** X case EVPALETTE: return(palstr); X! case EVASAVE: return(itoa(gasave)); X! case EVACOUNT: return(itoa(gacount)); X! case EVLASTKEY: return(itoa(lastkey)); X case EVCURCHAR: X X--- 179,183 ---- X case EVPALETTE: return(palstr); X! case EVASAVE: return(itods(gasave)); X! case EVACOUNT: return(itods(gacount)); X! case EVLASTKEY: return(itods(lastkey)); X case EVCURCHAR: X*************** X*** 184,187 **** X return(curwp->w_dotp->l_used == X! curwp->w_doto ? itoa('\n') : X! itoa(lgetc(curwp->w_dotp, curwp->w_doto))); X case EVDISCMD: return(ltos(discmd)); X X--- 184,187 ---- X return(curwp->w_dotp->l_used == X! curwp->w_doto ? itods('\n') : X! itods(lgetc(curwp->w_dotp, curwp->w_doto))); X case EVDISCMD: return(ltos(discmd)); X*************** X*** 189,191 **** X case EVPROGNAME:return(PROGNAME); X! case EVSEED: return(itoa(seed)); X case EVDISINP: return(ltos(disinp)); X X--- 189,191 ---- X case EVPROGNAME:return(PROGNAME); X! case EVSEED: return(itods(seed)); X case EVDISINP: return(ltos(disinp)); X*************** X*** 191,194 **** X case EVDISINP: return(ltos(disinp)); X! case EVWLINE: return(itoa(curwp->w_ntrows)); X! case EVCWLINE: return(itoa(getwpos())); X case EVTARGET: saveflag = lastflag; X X--- 191,194 ---- X case EVDISINP: return(ltos(disinp)); X! case EVWLINE: return(itods(curwp->w_ntrows)); X! case EVCWLINE: return(itods(getwpos())); X case EVTARGET: saveflag = lastflag; X*************** X*** 194,196 **** X case EVTARGET: saveflag = lastflag; X! return(itoa(curgoal)); X case EVSEARCH: return(pat); X X--- 194,196 ---- X case EVTARGET: saveflag = lastflag; X! return(itods(curgoal)); X case EVSEARCH: return(pat); X*************** X*** 199,203 **** X case EVKILL: return(getkill()); X! case EVCMODE: return(itoa(curbp->b_mode)); X! case EVGMODE: return(itoa(gmode)); X! case EVTPAUSE: return(itoa(term.t_pause)); X case EVPENDING: X X--- 199,203 ---- X case EVKILL: return(getkill()); X! case EVCMODE: return(itods(curbp->b_mode)); X! case EVGMODE: return(itods(gmode)); X! case EVTPAUSE: return(itods(term.t_pause)); X case EVPENDING: X*************** X*** 208,210 **** X #endif X! case EVLWIDTH: return(itoa(llength(curwp->w_dotp))); X case EVLINE: return(getctext()); X X--- 208,210 ---- X #endif X! case EVLWIDTH: return(itods(llength(curwp->w_dotp))); X case EVLINE: return(getctext()); X*************** X*** 210,213 **** X case EVLINE: return(getctext()); X! case EVGFLAGS: return(itoa(gflags)); X! case EVRVAL: return(itoa(rval)); X } X X--- 210,216 ---- X case EVLINE: return(getctext()); X! case EVGFLAGS: return(itods(gflags)); X! case EVRVAL: return(itods(rval)); X! #if DOSBAK X! case EVBACKUP: return(ltos(backupflag)); X! #endif X } X*************** X*** 231,233 **** X size = NSTRING - 1; X! strncpy(value, kbufh->d_chunk, size); X } X X--- 234,236 ---- X size = NSTRING - 1; X! xstrncpy(value, kbufh->d_chunk, size); X } X*************** X*** 274,276 **** X if (f == TRUE) X! strcpy(value, itoa(n)); X else { X X--- 277,279 ---- X if (f == TRUE) X! strcpy(value, itods(n)); X else { X*************** X*** 424,426 **** X switch (vnum) { X! case EVFILLCOL: fillcol = atoi(value); X break; X X--- 427,429 ---- X switch (vnum) { X! case EVFILLCOL: fillcol = dstoi(value); X break; X*************** X*** 426,428 **** X break; X! case EVPAGELEN: status = newsize(TRUE, atoi(value)); X break; X X--- 429,431 ---- X break; X! case EVPAGELEN: status = newsize(TRUE, dstoi(value)); X break; X*************** X*** 428,430 **** X break; X! case EVCURCOL: status = setccol(atoi(value)); X break; X X--- 431,433 ---- X break; X! case EVCURCOL: status = setccol(dstoi(value)); X break; X*************** X*** 430,432 **** X break; X! case EVCURLINE: status = gotoline(TRUE, atoi(value)); X break; X X--- 433,435 ---- X break; X! case EVCURLINE: status = gotoline(TRUE, dstoi(value)); X break; X*************** X*** 435,437 **** X break; X! case EVCURWIDTH:status = newwidth(TRUE, atoi(value)); X break; X X--- 438,440 ---- X break; X! case EVCURWIDTH:status = newwidth(TRUE, dstoi(value)); X break; X*************** X*** 449,451 **** X break; X! case EVPALETTE: strncpy(palstr, value, 48); X spal(palstr); X X--- 452,454 ---- X break; X! case EVPALETTE: xstrncpy(palstr, value, 48); X spal(palstr); X*************** X*** 452,454 **** X break; X! case EVASAVE: gasave = atoi(value); X break; X X--- 455,457 ---- X break; X! case EVASAVE: gasave = dstoi(value); X break; X*************** X*** 454,456 **** X break; X! case EVACOUNT: gacount = atoi(value); X break; X X--- 457,459 ---- X break; X! case EVACOUNT: gacount = dstoi(value); X break; X*************** X*** 456,458 **** X break; X! case EVLASTKEY: lastkey = atoi(value); X break; X X--- 459,461 ---- X break; X! case EVLASTKEY: lastkey = dstoi(value); X break; X*************** X*** 459,461 **** X case EVCURCHAR: ldelete(1L, FALSE); /* delete 1 char */ X! c = atoi(value); X if (c == '\n') X X--- 462,464 ---- X case EVCURCHAR: ldelete(1L, FALSE); /* delete 1 char */ X! c = dstoi(value); X if (c == '\n') X*************** X*** 470,472 **** X case EVPROGNAME:break; X! case EVSEED: seed = atoi(value); X break; X X--- 473,475 ---- X case EVPROGNAME:break; X! case EVSEED: seed = dstoi(value); X break; X*************** X*** 474,476 **** X break; X! case EVWLINE: status = resize(TRUE, atoi(value)); X break; X X--- 477,479 ---- X break; X! case EVWLINE: status = resize(TRUE, dstoi(value)); X break; X*************** X*** 477,479 **** X case EVCWLINE: status = forwline(TRUE, X! atoi(value) - getwpos()); X break; X X--- 480,482 ---- X case EVCWLINE: status = forwline(TRUE, X! dstoi(value) - getwpos()); X break; X*************** X*** 479,481 **** X break; X! case EVTARGET: curgoal = atoi(value); X thisflag = saveflag; X X--- 482,484 ---- X break; X! case EVTARGET: curgoal = dstoi(value); X thisflag = saveflag; X*************** X*** 492,494 **** X case EVKILL: break; X! case EVCMODE: curbp->b_mode = atoi(value); X curwp->w_flag |= WFMODE; X X--- 495,497 ---- X case EVKILL: break; X! case EVCMODE: curbp->b_mode = dstoi(value); X curwp->w_flag |= WFMODE; X*************** X*** 495,497 **** X break; X! case EVGMODE: gmode = atoi(value); X break; X X--- 498,500 ---- X break; X! case EVGMODE: gmode = dstoi(value); X break; X*************** X*** 497,499 **** X break; X! case EVTPAUSE: term.t_pause = atoi(value); X break; X X--- 500,502 ---- X break; X! case EVTPAUSE: term.t_pause = dstoi(value); X break; X*************** X*** 502,504 **** X case EVLINE: putctext(value); X! case EVGFLAGS: gflags = atoi(value); X break; X X--- 505,507 ---- X case EVLINE: putctext(value); X! case EVGFLAGS: gflags = dstoi(value); X break; X*************** X*** 505,506 **** X case EVRVAL: break; X } X X--- 508,513 ---- X case EVRVAL: break; X+ #if DOSBAK X+ case EVBACKUP: backupflag = stol(value); X+ break; X+ #endif X } X*************** X*** 511,514 **** X X! /* atoi: ascii string to integer......This is too X! inconsistant to use the system's */ X X X--- 518,521 ---- X X! /* dstoi: decimal ascii string to integer......This is too X! inconsistant to use the system's atoi function */ X X*************** X*** 514,516 **** X X! atoi(st) X X X--- 521,523 ---- X X! dstoi(st) X X*************** X*** 548,551 **** X X! /* itoa: integer to ascii string.......... This is too X! inconsistant to use the system's */ X X X--- 555,558 ---- X X! /* itods: integer to decimal ascii string.......... This is too X! inconsistant to use the system itoa function */ X X*************** X*** 551,553 **** X X! char *itoa(i) X X X--- 558,560 ---- X X! char *itods(i) X X*************** X*** 553,555 **** X X! int i; /* integer to translate to a string */ X X X--- 560,562 ---- X X! int i; /* integer to translate to a decimal string */ X X*************** X*** 666,668 **** X blen = NSTRING; X! strncpy(buf, bp->b_dotp->l_text + bp->b_doto, X blen); X X--- 673,675 ---- X blen = NSTRING; X! xstrncpy(buf, bp->b_dotp->l_text + bp->b_doto, X blen); X*************** X*** 707,709 **** X /* check for numeric truth (!= 0) */ X! return((atoi(val) != 0)); X } X X--- 714,716 ---- X /* check for numeric truth (!= 0) */ X! return((dstoi(val) != 0)); X } X*************** X*** 753,754 **** X X int abs(x) /* take the absolute value of an integer */ X X--- 760,762 ---- X X+ #if !MSC5 X int abs(x) /* take the absolute value of an integer */ X*************** X*** 760,761 **** X } X X X--- 768,770 ---- X } X+ #endif X X*************** X*** 767,768 **** X } X X X--- 776,778 ---- X } X+ X XIndex: evar.h X*** archive/evar.h Sat Dec 19 15:20:53 1987 X--- msdos/evar.h Sat Dec 19 15:21:53 1987 X*************** X*** 59,60 **** X "rval", /* child process return value */ X }; X X--- 59,63 ---- X "rval", /* child process return value */ X+ #if DOSBAK X+ "backup", /* Create .BAK files when saving */ X+ #endif X }; X*************** X*** 102,103 **** X #define EVRVAL 36 X X X--- 105,109 ---- X #define EVRVAL 36 X+ #if DOSBAK X+ #define EVBACKUP 37 X+ #endif X XIndex: exec.c X*** archive/exec.c Sat Dec 19 15:20:55 1987 X--- msdos/exec.c Sat Dec 19 15:21:55 1987 X*************** X*** 515,517 **** X } X! strncpy(eline, lp->l_text, linlen); X eline[linlen] = 0; /* make sure it ends */ X X--- 515,517 ---- X } X! xstrncpy(eline, lp->l_text, linlen); X eline[linlen] = 0; /* make sure it ends */ X*************** X*** 539,541 **** X /* debug if levels */ X! strcat(outline, itoa(execlevel)); X strcat(outline, ":"); X X--- 539,541 ---- X /* debug if levels */ X! strcat(outline, itods(execlevel)); X strcat(outline, ":"); XIndex: file.c X*** archive/file.c Sat Dec 19 15:20:56 1987 X--- msdos/file.c Sat Dec 19 15:21:56 1987 X*************** X*** 143,145 **** X X! #if MSDOS X mklower(fname); /* msdos isn't case sensitive */ X X--- 143,145 ---- X X! #if MSDOS & !MSC X mklower(fname); /* msdos isn't case sensitive */ X*************** X*** 147,148 **** X for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) { X if ((bp->b_flag&BFINVS)==0 && strcmp(bp->b_fname, fname)==0) { X X--- 147,151 ---- X for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) { X+ #if MSDOS & MSC /* neither are we */ X+ if ((bp->b_flag&BFINVS)==0 && strcmpi(bp->b_fname, fname)==0) { X+ #else X if ((bp->b_flag&BFINVS)==0 && strcmp(bp->b_fname, fname)==0) { X*************** X*** 148,149 **** X if ((bp->b_flag&BFINVS)==0 && strcmp(bp->b_fname, fname)==0) { X swbuffer(bp); X X--- 151,153 ---- X if ((bp->b_flag&BFINVS)==0 && strcmp(bp->b_fname, fname)==0) { X+ #endif X swbuffer(bp); X*************** X*** 455,456 **** X register int nline; X X X--- 459,463 ---- X register int nline; X+ #if DOSBAK X+ char fntemp[NFILEN], fnback[NFILEN]; X+ #endif X X*************** X*** 464,466 **** X X! if ((s=ffwopen(fn)) != FIOSUC) { /* Open writes message. */ X TTkopen(); X X--- 471,479 ---- X X! #if DOSBAK X! if (backupflag) X! s = fftopen(fntemp, fn); X! else X! #endif X! s = ffwopen(fn); X! if (s != FIOSUC) { /* Open writes message. */ X TTkopen(); X*************** X*** 479,480 **** X s = ffclose(); X if (s == FIOSUC) { /* No close error. */ X X--- 492,518 ---- X s = ffclose(); X+ #if DOSBAK X+ if (backupflag) { register char *p, *q; X+ strcpy(fnback, fn); X+ p = q = &fnback[strlen(fnback)]; X+ while (--q >= &fnback[0]) { X+ if (*q == '.') X+ p = q; X+ if ((*q == '.') X+ || (*q == '/') X+ || (*q == '\\') X+ || (*q == ':') ) X+ break; X+ } X+ strcpy(p, ".BAK"); X+ unlink(fnback); X+ #if MSC3 X+ rename(fnback, fn); X+ if(rename(fn, fntemp)) X+ #else X+ rename(fn, fnback); X+ if(rename(fntemp, fn)) X+ #endif X+ s = FIOERR; X+ } X+ #endif X if (s == FIOSUC) { /* No close error. */ XIndex: fileio.c X*** archive/fileio.c Sat Dec 19 15:20:56 1987 X--- msdos/fileio.c Sat Dec 19 15:21:56 1987 X*************** X*** 8,9 **** X #include "edef.h" X X X--- 8,12 ---- X #include "edef.h" X+ #if DOSBAK X+ #include <string.h> X+ #endif X X*************** X*** 37,38 **** X #else X if ((ffp=fopen(fn, "w")) == NULL) { X X--- 40,44 ---- X #else X+ #if MSDOS X+ if ((ffp=fopen(fn, "wb")) == NULL) { X+ #else X if ((ffp=fopen(fn, "w")) == NULL) { X*************** X*** 39,40 **** X #endif X mlwrite("Cannot open file for writing"); X X--- 45,47 ---- X #endif X+ #endif X mlwrite("Cannot open file for writing"); X*************** X*** 45,46 **** X X /* X X--- 52,77 ---- X X+ #if DOSBAK X+ char *xtmpnam(p) X+ char *p; X+ { X+ static unsigned short ix = 0; X+ register unsigned short u; X+ register char *q; X+ char tmp[8]; X+ if (p == NULL) X+ if ((p = malloc(8)) == NULL) X+ return p; X+ if (++ix == 0) ++ix; X+ tmp[7] = '\0'; X+ q = &tmp[7]; X+ u = ix; X+ while (u) { X+ *(--q) = (u % 10) + '0'; X+ u /= 10; X+ } X+ return strcpy(p, q); X+ } X+ #endif X+ X+ #if DOSBAK X /* X*************** X*** 46,47 **** X /* X * Close a file. Should look at the status in all systems. X X--- 77,114 ---- X /* X+ * Open a temporary file for writing. Return TRUE if all is well, and X+ * FALSE on error (cannot create). X+ */ X+ fftopen(fn, fnpath) X+ char *fn, *fnpath; X+ { X+ char *p, *q, ch; X+ p = strrchr(fnpath, '/'); X+ q = strrchr(fnpath, '\\'); X+ if ((p == NULL) || ((q != NULL) && (q > p))) p = q; X+ q = fn; X+ if (p != NULL) { X+ while (fnpath <= p) X+ *q++ = *fnpath++; X+ } X+ else if ((fnpath[1] == ':') X+ && ((ch = toupper(fnpath[0])) >= 'A') && (ch <= 'Z')) { X+ *q++ = fnpath[0]; X+ *q++ = ':'; X+ } X+ *q = '\0'; X+ strcat(fn, "em"); X+ p = xtmpnam(NULL); X+ strcat(fn, p); X+ free(p); X+ strcat(fn, ".tmp"); X+ if ((ffp=fopen(fn, "wb")) == NULL) { X+ mlwrite("Cannot open file for writing"); X+ return (FIOERR); X+ } X+ mlwrite(fn); X+ return (FIOSUC); X+ } X+ #endif X+ X+ /* X * Close a file. Should look at the status in all systems. X*************** X*** 98,100 **** X X! #if ST520 & ADDCR X fputc('\r', ffp); X X--- 165,167 ---- X X! #if ADDCR X fputc('\r', ffp); X*************** X*** 147,149 **** X return(FIOMEM); X! strncpy(tmpline, fline, flen); X flen += NSTRING; X X--- 214,216 ---- X return(FIOMEM); X! xstrncpy(tmpline, fline, flen); X flen += NSTRING; XIndex: isearch.c X*** archive/isearch.c Sat Dec 19 15:21:01 1987 X--- msdos/isearch.c Sat Dec 19 15:21:58 1987 X*************** X*** 138,140 **** X cmd_buff[0] = '\0'; /* Init the command buffer */ X! strncpy (pat_save, pat, NPAT); /* Save the old pattern string */ X curline = curwp->w_dotp; /* Save the current line pointer */ X X--- 138,140 ---- X cmd_buff[0] = '\0'; /* Init the command buffer */ X! xstrncpy (pat_save, pat, NPAT); /* Save the old pattern string */ X curline = curwp->w_dotp; /* Save the current line pointer */ X*************** X*** 221,223 **** X n = init_direction; /* Reset the search direction */ X! strncpy (pat, pat_save, NPAT); /* Restore the old search str */ X cmd_reexecute = 0; /* Start the whole mess over */ X X--- 221,223 ---- X n = init_direction; /* Reset the search direction */ X! xstrncpy (pat, pat_save, NPAT); /* Restore the old search str */ X cmd_reexecute = 0; /* Start the whole mess over */ XIndex: line.c X*** archive/line.c Sat Dec 19 15:21:04 1987 X--- msdos/line.c Sat Dec 19 15:21:59 1987 X*************** X*** 33,35 **** X register int size; X- char *malloc(); X X X--- 33,34 ---- X register int size; X XIndex: search.c X*** archive/search.c Sat Dec 19 15:21:14 1987 X--- msdos/search.c Sat Dec 19 15:22:02 1987 X*************** X*** 1275,1277 **** X } X! strncpy(rmcptr->rstr, patptr - mj, mj); X rmcptr++; X X--- 1275,1277 ---- X } X! xstrncpy(rmcptr->rstr, patptr - mj, mj); X rmcptr++; X*************** X*** 1298,1300 **** X X! strncpy(rmcptr->rstr, patptr - mj, mj + 1); X X X--- 1298,1300 ---- X X! xstrncpy(rmcptr->rstr, patptr - mj, mj + 1); X X*************** X*** 1327,1329 **** X } X! strncpy(rmcptr->rstr, patptr - mj, mj); X rmcptr++; X X--- 1327,1329 ---- X } X! xstrncpy(rmcptr->rstr, patptr - mj, mj); X rmcptr++; X*************** X*** 1535,1537 **** X { X- char *malloc(); X X X--- 1535,1536 ---- X { X XIndex: spawn.c X*** archive/spawn.c Sat Dec 19 15:21:16 1987 X--- msdos/spawn.c Sat Dec 19 15:22:06 1987 X*************** X*** 71,73 **** X #if CPM X! mlwrite("Not in CP/M-86"); X #endif X X--- 71,73 ---- X #if CPM X! mlwrite("Not available in CP/M-86"); X #endif X*************** X*** 75,76 **** X movecursor(term.t_nrow, 0); /* Seek to last line. */ X TTflush(); X X--- 75,77 ---- X movecursor(term.t_nrow, 0); /* Seek to last line. */ X+ mlputs("\n"); X TTflush(); X*************** X*** 180,182 **** X #if CPM X! mlwrite("Not in CP/M-86"); X return (FALSE); X X--- 181,183 ---- X #if CPM X! mlwrite("Not available in CP/M-86"); X return (FALSE); X*************** X*** 186,187 **** X return(s); X movecursor(term.t_nrow - 1, 0); X X--- 187,189 ---- X return(s); X+ #if !MSDOS X movecursor(term.t_nrow - 1, 0); X*************** X*** 187,188 **** X movecursor(term.t_nrow - 1, 0); X TTkclose(); X X--- 189,191 ---- X movecursor(term.t_nrow - 1, 0); X+ #endif X TTkclose(); X*************** X*** 274,276 **** X #if CPM X! mlwrite("Not in CP/M-86"); X return (FALSE); X X--- 277,279 ---- X #if CPM X! mlwrite("Not available in CP/M-86"); X return (FALSE); X*************** X*** 280,281 **** X return(s); X movecursor(term.t_nrow - 1, 0); X X--- 283,285 ---- X return(s); X+ #endif X movecursor(term.t_nrow - 1, 0); X*************** X*** 281,282 **** X movecursor(term.t_nrow - 1, 0); X TTkclose(); X X--- 285,288 ---- X movecursor(term.t_nrow - 1, 0); X+ #if MSDOS X+ mlputs("\n"); X TTkclose(); X*************** X*** 282,283 **** X TTkclose(); X execprog(line); X X--- 288,303 ---- X TTkclose(); X+ #if MSC X+ { X+ register char *p = line; X+ while (*p && (*p != ' ') && (*p != '\t')) p++; X+ if (*p == '\0') X+ p = NULL; X+ else X+ { X+ *p++ = '\0'; X+ if (*p == '\0') p = NULL; X+ } X+ spawnlp(P_WAIT, line, line, p, NULL); X+ } X+ #else X execprog(line); X*************** X*** 283,284 **** X execprog(line); X TTkopen(); X X--- 303,305 ---- X execprog(line); X+ #endif X TTkopen(); X*************** X*** 334,336 **** X char line[NLINE]; /* command line send to shell */ X! static char bname[] = "command"; X X X--- 355,357 ---- X char line[NLINE]; /* command line send to shell */ X! static char bname[] = "command.tmp"; X X*************** X*** 345,346 **** X char *tmp; X char *getenv(); X X--- 366,368 ---- X char *tmp; X+ #if !MSC X char *getenv(); X*************** X*** 346,348 **** X char *getenv(); X- FILE *fp; X FILE *fopen(); X X--- 368,369 ---- X char *getenv(); X FILE *fopen(); X*************** X*** 349,350 **** X #endif X X X--- 370,373 ---- X #endif X+ FILE *fp; X+ #endif X X*************** X*** 356,358 **** X if ((tmp = getenv("TMP")) == NULL) X! strcpy(filnam, "command"); X else { X X--- 379,381 ---- X if ((tmp = getenv("TMP")) == NULL) X! strcpy(filnam, "command.tmp"); X else { X*************** X*** 359,361 **** X strcpy(filnam, tmp); X! strcat(filnam,"\\command"); X } X X--- 382,384 ---- X strcpy(filnam, tmp); X! strcat(filnam,"\\command.tmp"); X } X*************** X*** 364,366 **** X #if VMS X! mlwrite("Not availible under VMS"); X return(FALSE); X X--- 387,389 ---- X #if VMS X! mlwrite("Not available under VMS"); X return(FALSE); X*************** X*** 368,370 **** X #if CPM X! mlwrite("Not availible under CP/M-86"); X return(FALSE); X X--- 391,393 ---- X #if CPM X! mlwrite("Not available under CP/M-86"); X return(FALSE); X*************** X*** 487,489 **** X #if VMS X! mlwrite("Not availible under VMS"); X return(FALSE); X X--- 510,512 ---- X #if VMS X! mlwrite("Not available under VMS"); X return(FALSE); X*************** X*** 491,493 **** X #if CPM X! mlwrite("Not availible under CP/M-86"); X return(FALSE); X X--- 514,516 ---- X #if CPM X! mlwrite("Not available under CP/M-86"); X return(FALSE); X*************** X*** 689,691 **** X X! #if MSDOS & (TURBO | LATTICE | AZTEC) X /* SHELLPROG: Execute a command in a subshell */ X X--- 712,714 ---- X X! #if MSDOS & (TURBO | MSC | LATTICE | AZTEC) X /* SHELLPROG: Execute a command in a subshell */ X*************** X*** 711,713 **** X /* get name of system shell */ X! if ((shell = getenv("COMSPEC")) == NULL) { X return(FALSE); /* No shell located */ X X--- 734,738 ---- X /* get name of system shell */ X! if ((shell = getenv("SHELL")) == NULL) X! shell = getenv("COMSPEC"); X! if (shell == NULL) { X return(FALSE); /* No shell located */ X*************** X*** 724,725 **** X if (*cmd) { X strcpy(comline, shell); X X--- 749,759 ---- X if (*cmd) { X+ #if MSC X+ register char *p = comline; X+ *p++ = swchar; X+ *p++ = 'c'; X+ *p++ = '\0'; X+ return(spawnlp(P_WAIT, shell, shell, comline, cmd, NULL)); X+ } else X+ return(spawnlp(P_WAIT, shell, NULL)); X+ #else X strcpy(comline, shell); X*************** X*** 733,734 **** X return(execprog(shell)); X } X X--- 767,769 ---- X return(execprog(shell)); X+ #endif X } X*************** X*** 735,736 **** X X /* EXECPROG: A function to execute a named program X X--- 770,772 ---- X X+ #if !MSC X /* EXECPROG: A function to execute a named program X*************** X*** 835,836 **** X } X #endif X X--- 871,873 ---- X } X+ #endif X #endif XIndex: window.c X*** archive/window.c Sat Dec 19 15:21:22 1987 X--- msdos/window.c Sat Dec 19 15:22:07 1987 X*************** X*** 333,335 **** X register WINDOW *wp2; X- char *malloc(); X X X--- 333,334 ---- X register WINDOW *wp2; X SHAR_EOF if test 30655 -ne "`wc -c < 'patch.msc'`" then echo shar: error transmitting "'patch.msc'" '(should have been 30655 characters)' fi fi # end of shell archive exit 0 -- Daniel A. Norton nortond@mosys.UUCP c/o Momentum Systems Corporation ...uunet!mosys!nortond 2 Keystone Avenue Cherry Hill, NJ 08003 609/424-0734