*** orig.src/tcap.c Fri Jun 9 22:00:25 1989 --- tcap.c Fri Jun 9 11:12:22 1989 *************** *** 1,4 **** ! /* tcap: Unix V5, SUN OS, SCO XENIX, V7 and BS4.2 Termcap video driver for MicroEMACS 3.10 12-10-88 - Modifications made by Guy Turcotte to accomodate --- 1,4 ---- ! /* tcap: Unix V5, SUN OS, SCO XENIX, V7 and BS4.2 Termcap video driver for MicroEMACS 3.10 12-10-88 - Modifications made by Guy Turcotte to accomodate *************** *** 70,75 **** --- 70,174 ---- */ + /* + * a non-portable but generally usable USG option for get1key() is suggested; + * it allows use of the function keys needed to handle menus, specifically + * those of .emacsrc and the *.cmd files; + * + * it assumes typeahead() is enabled; + * + * the ttable[] bindings include shifted function and keypad keys; + * + * following is a sample ansi terminfo file, which has strings for the + * normal and shifted keys, and which adheres more-or-less to the + * ansi standard; + * + * a user without write permission on the system terminfo files likely + * will have to set up a local TERMINFO environment by use of .profile, + * and perhaps reprogram the function and keypad strings of the terminal; + * + * j.a. rupley, tucson, az - rupley!local@megaron.arizona.edu + */ + + /*- + ansi|modified terminfo description + # DELETE #...# COMMENTS #...# BEFORE #...# TIC'ING # + # standard stuff # + am, xon, cols#80, lines#24, bel=^G, cr=\r, clear=\E[H\E[J, + el=\E[K, ed=\E[J, cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, + cub1=\b, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, dl1=\E[M, blink=\E[5m, + bold=\E[1m, smir=\E[4h, invis=\E[8m, rev=\E[7m, smso=\E[7m, + smul=\E[4m, sgr0=\E[m, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, + is2=\E[=h, ich1=\E[@, il1=\E[L, + dl=\E[%p1%dM, cud=\E[%p1%dB, + ich=\E[%p1%d@, il=\E[%p1%dL, cub=\E[%p1%dD, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, ind=\n, ht=\t, + # function keys - kf0=kf10 # + kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, + kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, + kf0=\EOl, kf10=\EOl, + # shifted function keys - lf0=lf10 # + # tricky - store and recover strings as labels # + lf1=\EOC, lf2=\EOD, lf3=\EOE, lf4=\EOF, + lf5=\EOG, lf6=\EOH, lf7=\EOI, lf8=\EOJ, lf9=\EOK, + lf0=\EOL, lf10=\EOL, + # keypad keys # + khome=\E[H, kcuu1=\E[A, kpp=\E[U, + kcub1=\E[D, kcuf1=\E[C, + kll=\E[E, kcud1=\E[B, knp=\E[V, + # ins # + kich1=\E[@, + # shifted keypad keys # + ka1=\E[!H, kri=\E[S, ka3=\E[!U, + kclr=\E[!@, kel=\E[!A, + kc1=\E[!E, kind=\E[T, kc3=\E[!V, + # shifted ins and shifted del # + kil1=\E[L, kdch1=\E[P, + # miscellaneous # + kdl1=\E[M, + cbt=\E[Z, + kbs=\b, + */ + + /* + * The following is a fleshed-out ansi terminfo file as needed by + * the SCO Xenix console. + * Jonathan Bayer, Roselle Park, NJ. ...!uunet!ispi!jbayer or + * jbayer@ispi.uucp + * + + # ======================================================== + ansi|Ansi standard crt, + cr=^M, cud1=^J, ind=^J, bel=^G, + kich1=\E[L, am, cub1=^H, ed=\E[J, el=\E[K, + clear=\E[2J\E[H, cup=\E[%i%p1%d;%p2%dH, cols#80, + dch1=\E[P, dl1=\E[M, cud1=\E[B, cbt=\E[Z, rmir=, + khome=\E[H, ich1=\E[@, smir=, lines#25, + cuf1=\E[C, ht=^I, smso=\E[7m, rmso=\E[m, smul=\E[4m, + rmul=\E[m, cuu1=\E[A, + kbs=^h, kcuu1=\E[A, kcud1=\E[B, kcub1=\E[D, + kcuf1=\E[C, eo, ind=\E[S, ri=\E[T, + # added keys here + # function keys + kf1=\E[M, kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, + kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, kf0=\E[V, + knp=\E[G, kpp=\E[I, kll=\E[F, + # shifted function keys - lf0=lf10 # + # tricky - store and recover strings as labels # + lf1=\E[Y, + lf2=\E[Z, lf3=\E[a, lf4=\E[b, lf5=\E[c, + lf6=\E[d, lf7=\E[e, lf8=\E[f, lf9=\E[g, lf0=\E[h, + # keypad keys # + ka1=\E[H, ka3=\E[I, + kc1=\E[F, kc3=\E[G, + # ins + kil1=\E[L, + # miscellaneous #, delete line + kdl1=\E[M, + + * + */ + #define termdef 1 /* don't define "term" external */ #include *************** *** 78,83 **** --- 177,184 ---- #include "edef.h" #include "elang.h" + char *mgetstr (); + #if TERMCAP #if USG | HPUX *************** *** 102,108 **** char p_seq[10]; /* terminal escape sequence */ } TBIND; ! TBIND ttable[] = { "bt", SHFT | CTRL | 'i', "", /* backtab */ "k1", SPEC | '1', "", /* function key 1 */ "k2", SPEC | '2', "", /* function key 2 */ --- 203,209 ---- char p_seq[10]; /* terminal escape sequence */ } TBIND; ! TBIND ttable[] = { "bt", SHFT | CTRL | 'i', "", /* backtab */ "k1", SPEC | '1', "", /* function key 1 */ "k2", SPEC | '2', "", /* function key 2 */ *************** *** 130,140 **** "kP", SPEC | 'Z', "", /* previous page */ "kR", CTRL | 'Z', "", /* scroll down */ "kr", SPEC | 'F', "", /* right cursor */ ! "ku", SPEC | 'P', "", /* up cursor */ ! }; ! #define NTBINDS sizeof(ttable)/sizeof(TBIND) extern int ttopen(); extern int ttgetc(); extern int ttputc(); --- 231,276 ---- "kP", SPEC | 'Z', "", /* previous page */ "kR", CTRL | 'Z', "", /* scroll down */ "kr", SPEC | 'F', "", /* right cursor */ ! "ku", SPEC | 'P', "", /* up */ ! /* the following are additions to the standard table */ + "l1", SHFT | SPEC | '1', "", /* shift-function key 1 */ + "l2", SHFT | SPEC | '2', "", /* shift-function key 2 */ + "l3", SHFT | SPEC | '3', "", /* shift-function key 3 */ + "l4", SHFT | SPEC | '4', "", /* shift-function key 4 */ + "l5", SHFT | SPEC | '5', "", /* shift-function key 5 */ + "l6", SHFT | SPEC | '6', "", /* shift-function key 6 */ + "l7", SHFT | SPEC | '7', "", /* shift-function key 7 */ + "l8", SHFT | SPEC | '8', "", /* shift-function key 8 */ + "l9", SHFT | SPEC | '9', "", /* shift-function key 9 */ + "l0", SHFT | SPEC | '0', "", /* shift-function key 10 */ + + /* the following are less obvious */ + + /* shift left # kC kclr clear screen */ /* bound to backword */ + /* "kC", META | 'B', "", /* kclr /* clear screen */ + "kC", SPEC | CTRL | 'B', "", /* kclr /* clear screen */ + /* shift right # kE kel clear to eol */ /* bound to forwword */ + /* "kE", META | 'F', "", /* kel /* clear to eol */ + "kE", SPEC | CTRL | 'F', "", /* kel /* clear to eol */ + /* shift pgup # K3 ka3 pad upper right */ /* bound to gotobop */ + /* "K3", META | 'P', "", /* ka3 /* pad upper right */ + "K3", SPEC | CTRL | 'Z', "", /* ka3 /* pad upper right */ + /* shift pgdn # K5 kc3 pad lower right */ /* bound to gotoeop */ + /* "K5", META | 'N', "", /* kc3 /* pad lower right */ + "K5", SPEC | CTRL | 'V', "", /* kc3 /* pad lower right */ + /* shift home # K1 ka1 pad upper left */ /* unbound key */ + "K1", SPEC | CTRL | '<', "", /* ka1 /* pad upper left */ + /* shift end # K4 kc1 pad lower left */ /* unbound key */ + "K4", SPEC | CTRL | '>', "", /* kc1 /* pad lower left */ + + }; + + #define NTBINDS sizeof(ttable)/sizeof(TBIND) + + + extern int ttopen(); extern int ttgetc(); extern int ttputc(); *************** *** 308,313 **** --- 444,467 ---- fixnull(tgetstr(ttable[index].p_name, &p))); } + + #ifndef M_TERMINFO + + /* read definitions of local function keys into ttable */ + /* this is used for those terminals which support more */ + /* than 10 function keys. */ + + if (mgetent(tcbuf,tv_stype)) { + for (index = 0; index < NTBINDS; index++) { + if (mgetstr(ttable[index].p_name,&p, tcbuf)) + strcpy(ttable[index].p_seq, + fixnull(mgetstr(ttable[index].p_name, &p, tcbuf))); + } + } + + #endif + + /* tell unix we are goint to use the terminal */ ttopen(); *************** *** 440,446 **** #if XENIX | SUNOS if ((kbdmode != PLAY) && (rdchk(0) <= 0)) { ! nap(35000L); if (rdchk(0) <= 0) return(CTRL | '['); } --- 594,600 ---- #if XENIX | SUNOS if ((kbdmode != PLAY) && (rdchk(0) <= 0)) { ! nap(33L); if (rdchk(0) <= 0) return(CTRL | '['); } *************** *** 450,462 **** /* we don't know how to do this check for a pending char within 1/30th of a second machine independantly in the general System V case.... so we don't */ ! if (kbdmode != PLAY) ! return(CTRL | '['); #endif /* a key is pending within 1/30 of a sec... its an escape sequence */ cseq[0] = 27; sp = &cseq[1]; while (sp < &cseq[6]) { c = ttgetc(); *sp++ = c; --- 604,650 ---- /* we don't know how to do this check for a pending char within 1/30th of a second machine independantly in the general System V case.... so we don't */ ! /* ! * or... maybe we try it; ! * very non-portable solution; ! * hardware-dependent timing loop; ! * set upper-limit on loop by testing hardware, to get 30 ms; ! * use typahead() to check for waiting input on exit from loop; ! */ ! { int i; ! if (kbdmode != PLAY && typahead() <= 0) { ! /* loop limit set by hardware test */ ! /* for 30 ms or a bit less */ ! for (i = 0; i < 1500; i++) ! ; ! if (typahead() <= 0) ! return(CTRL | '['); ! } ! } ! /*- ! * another way -- using blocking read; ! * problem... when used as terminator, as in setup for ! * searches, need to give it twice, or whatever; ! * non-portable... assumes ansi standard for function keys and ! * keypad; ! */ ! /* ! { ! extern char kbdq; ! extern int kbdqp; ! ! kbdq = ttgetc(); ! kbdqp = 1; ! if ((kbdq & 255) != '[' && (kbdq & 255) != 'O') ! return(CTRL | '['); ! } ! */ #endif /* a key is pending within 1/30 of a sec... its an escape sequence */ cseq[0] = 27; sp = &cseq[1]; + *sp = 0; while (sp < &cseq[6]) { c = ttgetc(); *sp++ = c; *************** *** 554,559 **** --- 742,945 ---- hello() { + } + + #endif + + + + #ifndef M_TERMINFO + + char *TERMEXP = "/etc/termcap.exp"; + + static isent (ent, name) + char *ent; + char *name; + { + char buf[16]; + register int i; + + while (*ent != ':' && *ent != 0) { + for (i = 0;*ent != ':' && *ent != '|' && *ent != 0 && i < 15;i++) + buf[i] = *ent++; + + if (*ent == '|') + ent++; + + buf[i] = 0; + if (strcmp (buf, name) == 0) + return (1); + } + return (0); + } + + /* + ** reads the termcap.exp file or the environment and returns the + ** record + */ + + mgetent (bp, name) + char *bp; + char *name; + { + char *buf = bp; + register char *cp; + register FILE *f; + register int i; + char *getenv (); + + + if ((cp = getenv ("TERMEXP")) != NULL) { + if (*cp != '/') { + if (isent (cp, name)) { + strcpy (buf, cp); + return (1); + } + } + TERMEXP = cp; + } + if ((f = fopen (TERMEXP, "r")) == (FILE *)0) + return (-1); + + while (fgets (buf, 512, f) != NULL) { + if (buf[0] == '#') /* skip all comment lines */ + continue; + + i = strlen (buf) - 1; /* find last character in line */ + buf[i] = 0; /* remove trailing newline */ + if (i == 0) /* ignore blank lines */ + continue; + + while (buf[(i = strlen (buf) - 1)] == '\\') { /* is last character a \\, still more */ + cp = &buf[i]; /* find last character */ + cp[0] = 0; /* nullify, end of this part */ + if (fgets (cp, 512, f) == NULL) /* end of file? ... */ + break; /* ... end of entry */ + + cp[strlen (cp) - 1] = 0; /* remove trailing newline */ + if (cp[0] == '#') { /* comment line? ... */ + cp[0] = 0; /* remove that line */ + continue; /* go get another line */ + } + } + if (isent (buf, name)) { + strcpy (bp, buf); + fclose (f); + return (1); + } + } + fclose (f); + return (0); + } + + /* + ** searches the buffer looking for a string flag + */ + + char *mgetstr (id, area, bfr) + register char *id; + register char **area; + char *bfr; + { + register char *str = *area; /* start of current string */ + register char *cp = bfr; + + if (bfr == (char *) 0) /* has a valid buffer been passed? */ + return ((char *) 0); /* ... no, can't find string */ + + while (*cp != ':' && *cp != 0) /* find first entry in cap */ + cp++; + + if (*cp == 0) /* empty entry??? */ + return ((char *) 0); /* ... yes, bad acucap entry */ + else + cp++; /* point to first character in next */ + + while (*cp != 0) { /* until entry found or end of entry */ + if (strncmp(cp,id, strlen(id)) == 0) { + if (cp[strlen(id)] != '=') /* is it a string value??? */ + return ((char *) 0); /* no, something else */ + else + break; /* yes, entry was found */ + } else { /* not entry, skip this entire entry */ + while (*cp != ':' && *cp != 0) + cp++; /* search for end of current entry */ + + if (*cp != 0) + cp++; /* skip terminating character */ + } + } + if (*cp == 0) /* end of buffer */ + return ((char *) 0); + + cp += strlen(id) + 1; /* point to actual string */ + while (*cp != ':' && *cp != 0) { /* for every character in string ... */ + if (*cp == '\\') { /* translate escaped character */ + cp++; + switch (*cp) { + case 'n': /* newline */ + **area = '\n'; + (*area)++; + cp++; + break; + case 'r': /* carriage return */ + **area = '\r'; + (*area)++; + cp++; + break; + case 'b': /* backspace */ + **area = '\b'; + (*area)++; + cp++; + break; + case 'f': /* form feed */ + **area = '\f'; + (*area)++; + cp++; + break; + case 't': /* tab */ + **area = '\t'; + (*area)++; + cp++; + break; + case 'E': /* Escape character */ + **area = 033; + (*area)++; + cp++; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + **area = ((cp[0] - '0') << 6) + + ((cp[1] - '0') << 3) + + (cp[2] - '0'); + (*area)++; + cp += 3; + break; + default: + **area = *cp++; + (*area)++; + break; + } + } else if (*cp == '^') { /* some control character */ + cp++; + if (*cp >= '@' && *cp <= '_') { + **area = *cp - '@'; + (*area)++; + } + cp++; + } else { /* some normal character */ + **area = *cp++; /* put character in area */ + (*area)++; + } + } + *((*area)++) = 0; /* null terminate area and string */ + return (str); /* return pointer to start of string */ } #endif *** orig.src/file.c Fri Jun 9 22:00:12 1989 --- file.c Thu Jun 1 12:21:37 1989 *************** *** 12,17 **** --- 12,23 ---- #include "edef.h" #include "elang.h" + /* jbayer, added for stat function below */ + #if V7 | USG | HPUX | BSD | SUN | XENIX + #include + #include + #endif + /* * Read a file into the current * buffer. This is really easy; all you do is *************** *** 231,236 **** --- 237,245 ---- if ((s=bclear(bp)) != TRUE) /* Might be old. */ return(s); bp->b_flag &= ~(BFINVS|BFCHG); + #if BACKUP + curbp->b_bupflg = FALSE; /* no backup file yet */ + #endif strcpy(bp->b_fname, fname); /* let a user macro get hold of things...if he wants */ *************** *** 427,432 **** --- 436,444 ---- if ((s=writeout(fname)) == TRUE) { strcpy(curbp->b_fname, fname); curbp->b_flag &= ~BFCHG; + #if BACKUP + curbp->b_bupflg = TRUE; + #endif /* Update mode lines. */ upmode(); } *************** *** 477,482 **** --- 489,497 ---- if ((s=writeout(curbp->b_fname)) == TRUE) { curbp->b_flag &= ~BFCHG; + #if BACKUP + curbp->b_bupflg = TRUE; + #endif /* Update mode lines. */ upmode(); } *************** *** 487,493 **** * This function performs the details of file writing. It uses * the file management routines in the "fileio.c" package. The * number of lines written is displayed. Several errors are ! * posible, and cause writeout to return a FALSE result. When * $ssave is TRUE, the buffer is written out to a temporary * file, and then the old file is unlinked and the temporary * renamed to the original name. Before the file is written, --- 502,508 ---- * This function performs the details of file writing. It uses * the file management routines in the "fileio.c" package. The * number of lines written is displayed. Several errors are ! * possible, and cause writeout to return a FALSE result. When * $ssave is TRUE, the buffer is written out to a temporary * file, and then the old file is unlinked and the temporary * renamed to the original name. Before the file is written, *************** *** 507,512 **** --- 522,530 ---- char tname[NSTRING]; /* temporary file name */ char buf[NSTRING]; /* message buffer */ + int fstatus; /* jbayer, added to stat the old file */ + struct stat statbuf; /* jbayer, added to stat the old file */ + /* let a user macro get hold of things...if he wants */ execkey(&writehook, FALSE, 1); *************** *** 581,591 **** /* " line" */ if (nline > 1) strcat(buf, "s"); - if (sflag) { /* erase original file */ /* rename temporary file to original name */ if (unlink(fn) == 0 && rename(tname, fn) == 0) ; else { strcat(buf, TEXT150); --- 599,617 ---- /* " line" */ if (nline > 1) strcat(buf, "s"); if (sflag) { /* erase original file */ /* rename temporary file to original name */ + + /* J. Bayer */ + fstatus = stat(fn,&statbuf); + #if !BACKUP + /* -- ZU */ if (unlink(fn) == 0 && rename(tname, fn) == 0) + #else + if (makebackup(fn) == TRUE && rename(tname, fn) == 0) + /* -- UZ */ + #endif ; else { strcat(buf, TEXT150); *************** *** 593,598 **** --- 619,631 ---- strcat(buf, tname); status = FIODEL; /* failed */ } + /* following added by j.bayer */ + if (status == FIOSUC && fstatus == 0) { + chmod(fn, statbuf.st_mode); + #if V7 | USG | HPUX | BSD | SUN | XENIX + chown(fn, statbuf.st_uid, statbuf.st_gid); + #endif + } } strcat(buf, "]"); mlwrite(buf); *************** *** 742,744 **** --- 775,886 ---- return(FALSE); return(TRUE); } + + /* -- ZU */ + /* Make a backup file. + * This is done by renaming the original file to a new name. + * The name of the backup file is defined as follows: + * + * MSDOS: The base file name remains untouched, the extension has a tilde (~) + * as its first character and the other characters moved one place + * to the right. + * UNIX: The first character is a '#'. The rest of the name is moved one + * place to the right. The length of the filename may not exceed 14 + * characters (for BSD the limit is 255). + * + * No other operating system supported by now. + */ + #if BACKUP + + PASCAL NEAR makebackup( filename ) + char *filename; + { + char backupname[NFILEN]; + #if MSDOS | V7 | USG | HPUX | BSD | SUN | XENIX + if ( curbp->b_bupflg || /* already backed up */ + !bakfile /* no backup file wanted */ + ) { + if( unlink( filename ) == 0 ) + return( TRUE ); + else + return( FALSE ); + } + + getbackupname( backupname, filename ); + + if( !fexist( filename )) /* no original file - */ + return( TRUE ); /* nothing to backup */ + + if( fexist( backupname )) + if( unlink( backupname )) /* file is readonly */ + return( FALSE ); + + if( rename( filename, backupname ) != 0 ) + return( FALSE ); + + return( TRUE ); + #else /* for all other operating systems return fail */ + return( FALSE ); + #endif /* MSDOS | V7 | USG | HPUX | BSD | SUN | XENIX */ + } + + /* Make the name of the backup file according to the original file name + * This routines knows about the filename possibilities of the different + * operating systems. + */ + PASCAL NEAR getbackupname( backup, file ) + char *backup; + char *file; + { + char temp[NFILEN]; + int index; + char *dotpos; + + strcpy( backup, file ); + #if MSDOS + for( index = strlen( backup ) -1; index >= 0 && backup[index] != '.'; + index-- ) + ; + if( index < 0 ) + strcat( backup, ".~" ); + else { + strcpy( temp, &backup[index +1] ); + backup[index +1] = '~'; /* first char of new extension */ + temp[2] = '\0'; /* extension is at most 3 chars */ + strcpy( &backup[index +2], temp ); + } + #endif /* MSDOS */ + + #if V7 | USG | HPUX | BSD | SUN | XENIX + /* strcpy( temp, "#" ); */ + *temp = 0; + for( index = strlen( backup ) -1; index >= 0 && backup[index] != '/'; + index-- ) + ; + if( index >= 0 ) + strcat( temp, &backup[index +1] ); + else + strncat( temp, backup, NFILEN -1 ); + + #if BSD /* BSD allows filenames up to 255 characters */ + #if NFILEN < 255 + if( strlen( temp ) > NFILEN ) + temp[NFILEN] = '\0'; + #else + if( strlen( temp ) > 254 ) + temp[255] = '\0'; + #endif + #else /* other Unixes allow only 14 characters */ + if( strlen( temp ) > 12 ) + temp[ 13] = '\0'; + #endif + strcat(temp,"-"); + if( index >= 0 ) + strncpy( &backup[index +1], temp, NFILEN - strlen( backup ) -1 ); + else + strncpy( backup, temp, NFILEN - strlen( backup ) -1 ); + #endif /* V7 | USG | HPUX | BSD | SUN | XENIX */ + } + + #endif /* BACKUP */ + /* -- UZ */ *** orig.src/fileio.c Fri Jun 9 22:00:12 1989 --- fileio.c Thu Jun 1 11:58:17 1989 *************** *** 24,29 **** --- 24,30 ---- PASCAL NEAR ffropen(fn) char *fn; { + if ((ffp=fopen(fn, "r")) == NULL) return(FIOFNF); eofflag = FALSE; *************** *** 38,43 **** --- 39,45 ---- PASCAL NEAR ffwopen(fn) char *fn; { + if ((ffp=fopen(fn, "w")) == NULL) { mlwrite(TEXT155); /* "Cannot open file for writing" */ *************** *** 68,73 **** --- 70,76 ---- /* "Error closing file" */ return(FIOERR); } + return(FIOSUC); #else fclose(ffp); *** orig.src/estruct.h Fri Jun 9 22:00:34 1989 --- estruct.h Fri May 26 12:45:36 1989 *************** *** 44,50 **** #define V7 0 /* V7 UNIX or Coherent or BSD4.2*/ #define BSD 0 /* UNIX BSD 4.2 and ULTRIX */ #define USG 0 /* UNIX system V */ ! #define XENIX 0 /* IBM-PC SCO XENIX */ #define SUN 0 /* SUN v4.0 */ #define HPUX 0 /* HPUX HP 9000 minicomputer */ #define VMS 0 /* VAX/VMS */ --- 44,50 ---- #define V7 0 /* V7 UNIX or Coherent or BSD4.2*/ #define BSD 0 /* UNIX BSD 4.2 and ULTRIX */ #define USG 0 /* UNIX system V */ ! #define XENIX 1 /* IBM-PC SCO XENIX */ #define SUN 0 /* SUN v4.0 */ #define HPUX 0 /* HPUX HP 9000 minicomputer */ #define VMS 0 /* VAX/VMS */ *************** *** 54,60 **** /* Compiler definitions */ /* [Set one of these!!] */ ! #define UNIX 0 /* a random UNIX compiler */ #define MWC 0 /* Mark Williams C */ #define ALCYON 0 /* ALCYON Atari ST compiler */ #define LATTICE 0 /* Lattice 2.14 through 3.0 compilers */ --- 54,60 ---- /* Compiler definitions */ /* [Set one of these!!] */ ! #define UNIX 1 /* a random UNIX compiler */ #define MWC 0 /* Mark Williams C */ #define ALCYON 0 /* ALCYON Atari ST compiler */ #define LATTICE 0 /* Lattice 2.14 through 3.0 compilers */ *************** *** 92,98 **** #define VMSVT 0 /* various VMS terminal entries */ #define VT52 0 /* VT52 terminal (Zenith). */ #define RAINBOW 0 /* Use Rainbow fast video. */ ! #define TERMCAP 0 /* Use TERMCAP */ #define IBMPC 0 /* IBM-PC CGA/MONO/EGA/VGA drvr */ #define OS2NPM 0 /* OS/2 non-Presentation Mgr. */ #define DG10 0 /* Data General system/10 */ --- 92,98 ---- #define VMSVT 0 /* various VMS terminal entries */ #define VT52 0 /* VT52 terminal (Zenith). */ #define RAINBOW 0 /* Use Rainbow fast video. */ ! #define TERMCAP 1 /* Use TERMCAP */ #define IBMPC 0 /* IBM-PC CGA/MONO/EGA/VGA drvr */ #define OS2NPM 0 /* OS/2 non-Presentation Mgr. */ #define DG10 0 /* Data General system/10 */ *************** *** 130,147 **** #define BINARY 1 /* using new binary searches? */ #define REVSTA 1 /* Status line appears in reverse video */ ! #define COLOR 1 /* color commands and windows */ #define FILOCK 0 /* file locking under unix BSD 4.2 */ #define ISRCH 1 /* Incremental searches like ITS EMACS */ #define WORDPRO 1 /* Advanced word processing features */ #define FLABEL 0 /* function key label code [HP150] */ #define APROP 1 /* Add code for Apropos command */ #define CRYPT 1 /* file encryption enabled? */ #define MAGIC 1 /* include regular expression matching? */ #define AEDIT 1 /* advanced editing options: en/detabbing */ #define PROC 1 /* named procedures */ ! #define MOUSE 1 /* Include routines for mouse actions */ #define NOISY 1 /* Use a fancy BELL if it exists */ #define DIACRIT 1 /* diacritical marks processed? */ #define SPEECH 0 /* spoken EMACS, for the sight impared [not ready] */ --- 130,154 ---- #define BINARY 1 /* using new binary searches? */ #define REVSTA 1 /* Status line appears in reverse video */ ! #define COLOR 0 /* color commands and windows */ #define FILOCK 0 /* file locking under unix BSD 4.2 */ + /* -- ZU */ + #define BACKUP 1 /* retain original file as backup (MSDOS, UNIX) */ + /* -- UZ */ #define ISRCH 1 /* Incremental searches like ITS EMACS */ #define WORDPRO 1 /* Advanced word processing features */ #define FLABEL 0 /* function key label code [HP150] */ #define APROP 1 /* Add code for Apropos command */ #define CRYPT 1 /* file encryption enabled? */ + + #define SOFTAB 1 /* in OVER mode, are tabs and returns soft? */ + #define KEEPPOS 1 /* Maintain cursor position when paging */ + #define MAGIC 1 /* include regular expression matching? */ #define AEDIT 1 /* advanced editing options: en/detabbing */ #define PROC 1 /* named procedures */ ! #define MOUSE 0 /* Include routines for mouse actions */ #define NOISY 1 /* Use a fancy BELL if it exists */ #define DIACRIT 1 /* diacritical marks processed? */ #define SPEECH 0 /* spoken EMACS, for the sight impared [not ready] */ *************** *** 186,192 **** #define ETYPE struct #endif ! #if MSDOS & (TURBO | MSC) #define NEAR #define DNEAR #define PASCAL pascal --- 193,199 ---- #define ETYPE struct #endif ! #if (MSDOS & (TURBO | MSC)) #define NEAR #define DNEAR #define PASCAL pascal *************** *** 306,312 **** #define MEMMAP 0 #endif ! #if MSDOS | OS2 | V7 | USG | HPUX | BSD | (ST520 & MWC) | WMCS #define ENVFUNC 1 #else #define ENVFUNC 0 --- 313,319 ---- #define MEMMAP 0 #endif ! #if MSDOS | OS2 | V7 | USG | HPUX | BSD | (ST520 & MWC) | WMCS | XENIX #define ENVFUNC 1 #else #define ENVFUNC 0 *************** *** 417,423 **** #define BELL 0x07 /* a bell character */ #define TAB 0x09 /* a tab character */ ! #if V7 | USG | HPUX | BSD #define PATHCHR ':' #else #if WMCS --- 424,430 ---- #define BELL 0x07 /* a bell character */ #define TAB 0x09 /* a tab character */ ! #if V7 | BSD | USG | HPUX | XENIX #define PATHCHR ':' #else #if WMCS *************** *** 554,559 **** --- 561,569 ---- #if CRYPT char b_key[NPAT]; /* current encrypted key */ #endif + #if BACKUP /* -- ZU */ + short b_bupflg; /* true if file was backed up */ + #endif } BUFFER; #define BFINVS 0x01 /* Internal invisable buffer */ *************** *** 578,584 **** * The starting position of a region, and the size of the region in * characters, is kept in a region structure. Used by the region commands. */ ! typedef struct { struct LINE *r_linep; /* Origin LINE address. */ short r_offset; /* Origin LINE offset. */ long r_size; /* Length in characters. */ --- 588,594 ---- * The starting position of a region, and the size of the region in * characters, is kept in a region structure. Used by the region commands. */ ! typedef struct REGION { struct LINE *r_linep; /* Origin LINE address. */ short r_offset; /* Origin LINE offset. */ long r_size; /* Length in characters. */ *************** *** 669,675 **** BUFFER *buf; /* buffer to execute */ }; ! typedef struct { short k_code; /* Key code */ short k_type; /* binding type (C function or EMACS buffer) */ ETYPE EPOINTER k_ptr; /* ptr to thing to execute */ --- 679,685 ---- BUFFER *buf; /* buffer to execute */ }; ! typedef struct KEYTAB { short k_code; /* Key code */ short k_type; /* binding type (C function or EMACS buffer) */ ETYPE EPOINTER k_ptr; /* ptr to thing to execute */ *************** *** 785,791 **** */ typedef char *BITMAP; ! typedef struct { short int mc_type; union { int lchar; --- 795,801 ---- */ typedef char *BITMAP; ! typedef struct MC { short int mc_type; union { int lchar; *** orig.src/bind.c Fri Jun 9 22:00:07 1989 --- bind.c Thu May 25 13:14:41 1989 *************** *** 11,17 **** #include "elang.h" #include "epath.h" ! PASCAL NEAR help(f, n) /* give me some help!!!! bring up a fake buffer and read the help file into it with view mode */ { --- 11,20 ---- #include "elang.h" #include "epath.h" ! PASCAL NEAR help(f, n) ! int f,n; ! ! /* give me some help!!!! bring up a fake buffer and read the help file into it with view mode */ { *************** *** 593,599 **** { char *fname; /* resulting file name to execute */ - /* look up the startup file */ if (*sfname != 0) fname = flook(sfname, TRUE); --- 596,601 ---- *************** *** 632,638 **** register int i; /* index */ static char fspec[NFILEN]; /* full path spec to search */ char *getenv(); - /* if we have an absolute path.. check only there! */ sp = fname; while (*sp) { --- 634,639 ---- *** orig.src/msdos.c Fri Jun 9 22:00:19 1989 --- msdos.c Thu May 25 13:01:19 1989 *************** *** 11,16 **** --- 11,17 ---- #ifdef MSDOS #include "edef.h" #include "elang.h" + #include /* The Mouse driver only works with typeahead defined */ #if MOUSE *************** *** 26,31 **** --- 27,38 ---- struct ffblk fileblock; /* structure for directory searches */ #endif + #if MSC + #include + + struct find_t fileblock; + #endif + #if LATTICE | MSC | DTL | TURBO | AZTEC | MWC union REGS rg; /* cpu register for use of DOS calls */ struct SREGS segreg; /* cpu segment registers */ *************** *** 358,371 **** --- 365,389 ---- PASCAL NEAR spawncli(f, n) { + char OldScreenResolution[NBUFN]; /* -- ZU */ + /* don't allow this command if restricted */ if (restflag) return(resterr()); + strcpy( OldScreenResolution, sres ); /* -- ZU */ + movecursor(term.t_nrow, 0); /* Seek to last line. */ TTflush(); TTkclose(); + + TTclose(); /* -- ZU */ shellprog(""); + + TTopen(); /* -- ZU */ + strcpy( sres, OldScreenResolution ); /* . */ + TTrez( sres ); /* -- UZ */ + TTkopen(); sgarbf = TRUE; return(TRUE); *************** *** 412,427 **** --- 430,454 ---- { register int s; char line[NLINE]; + char OldScreenResolution[NBUFN]; /* -- ZU */ + /* don't allow this command if restricted */ if (restflag) return(resterr()); if ((s=mlreply("$", line, NLINE)) != TRUE) return(s); + + strcpy( OldScreenResolution, sres ); /* -- ZU */ + movecursor(term.t_nrow - 1, 0); TTkclose(); + TTclose(); /* -- ZU */ execprog(line); + TTopen(); /* -- ZU */ + strcpy( sres, OldScreenResolution ); /* . */ + TTrez( sres ); /* -- UZ */ TTkopen(); /* if we are interactive, pause here */ if (clexec == FALSE) { *************** *** 661,666 **** --- 688,694 ---- char f2[38]; /* FCB2 area (not initialized */ char prog[NSTRING]; /* program filespec */ char tail[NSTRING]; /* command tail with length byte */ + char curdir[NFILEN]; /* current directory save space */ union REGS regs; /* parameters for dos call */ #if MWC == 0 struct SREGS segreg; /* segment registers for dis call */ *************** *** 694,699 **** --- 722,729 ---- } strcpy(prog, sp); + getcwd( curdir, 66 ); /* save current directory */ + #if MWC == 0 /* get a pointer to this PSPs environment segment number */ segread(&segreg); *************** *** 760,765 **** --- 790,797 ---- } else rval = -_doserrno; /* failed child call */ #endif + chdir( curdir ); /* restore current directory */ + return((rval < 0) ? FALSE : TRUE); } *************** *** 879,885 **** return(ALTD | c); } ! #if COMPLET & (TURBO) /* FILE Directory routines */ char path[NFILEN]; /* path of file to find */ --- 911,917 ---- return(ALTD | c); } ! #if COMPLET & (TURBO | MSC) /* FILE Directory routines */ char path[NFILEN]; /* path of file to find */ *************** *** 924,935 **** --- 956,979 ---- strcat(fname, ".*"); /* and call for the first file */ + #if TURBO if (findfirst(fname, &fileblock, 0) == -1) return(NULL); + #endif + #if MSC + if (_dos_findfirst(fname, _A_NORMAL, &fileblock) != 0) + return(NULL); + #endif + /* return the first file name! */ strcpy(rbuf, path); + #if TURBO strcat(rbuf, fileblock.ff_name); + #endif + #if MSC + strcat(rbuf, fileblock.name); + #endif mklower(rbuf); return(rbuf); } *************** *** 943,954 **** --- 987,1009 ---- char fname[NFILEN]; /* file/path for DOS call */ /* and call for the first file */ + #if TURBO if (findnext(&fileblock) == -1) return(NULL); + #endif + #if MSC + if (_dos_findnext(&fileblock) != 0) + return(NULL); + #endif /* return the first file name! */ strcpy(rbuf, path); + #if TURBO strcat(rbuf, fileblock.ff_name); + #endif + #if MSC + strcat(rbuf, fileblock.name); + #endif mklower(rbuf); return(rbuf); } *** orig.src/ibmpc.c Fri Jun 9 22:00:15 1989 --- ibmpc.c Thu May 25 11:56:02 1989 *************** *** 195,201 **** --- 195,203 ---- /* we must scroll the screen */ rg.h.ah = 6; /* scroll up */ rg.h.al = 1; /* # of lines to scroll by */ + #if COLOR rg.h.bh = cfcolor; /* attribute for blank line */ + #endif rg.x.cx = 0; /* upper left corner of scroll */ rg.x.dx = 0x184f;/* lower right */ int86(0x10, &rg, &rg); *************** *** 298,306 **** --- 300,313 ---- ttclose(); } + static CtrlC_State; /* -- ZU */ + PASCAL NEAR ibmkopen() /* open the keyboard */ { + rg.x.ax = 0x3300; /* -- ZU */ + intdos( &rg, &rg ); /* . */ + CtrlC_State = rg.h.dl; /* -- UZ */ rg.x.ax = 0x3301; rg.h.dl = 0x00; intdos(&rg, &rg); *************** *** 309,314 **** --- 316,324 ---- PASCAL NEAR ibmkclose() /* close the keyboard */ { + rg.x.ax = 0x3301; /* -- ZU */ + rg.h.dl = CtrlC_State; /* . */ + intdos(&rg, &rg); /* -- UZ */ } PASCAL NEAR scinit(type) /* initialize the screen head pointers */ *** orig.src/main.c Fri Jun 9 22:00:18 1989 --- main.c Thu May 25 09:31:23 1989 *************** *** 209,218 **** #if WMCS if (argv[carg][0] == ':') { #else ! if (argv[carg][0] == '-') { #endif switch (argv[carg][1]) { /* Process Startup macroes */ case 'c': /* -c for changable file */ case 'C': viewflag = FALSE; --- 209,236 ---- #if WMCS if (argv[carg][0] == ':') { #else ! if (argv[carg][0] == '-' || argv[carg][0] == '+') { ! /* ^^^^^^^^^^^^^^^^^^^^^^^ */ ! /* added by J.Bayer to allow */ ! /* compatability with vi */ #endif + /* J.Bayer, 9/22/88 */ + if (argv[carg][0] == '+') { /* + to emulate vi */ + gotoflag = TRUE; + gline = asc_int(&argv[carg][1]); + } else + switch (argv[carg][1]) { /* Process Startup macroes */ + #ifdef BACKUP + /* J. Bayer 9/22/88 */ + case 'b': /* -b for no bakfile creation */ + case 'B': + bakfile = FALSE; + break; + #endif + + case 'c': /* -c for changable file */ case 'C': viewflag = FALSE; *************** *** 812,817 **** --- 830,837 ---- prefix |= META; prenum = n; predef = f; + + thisflag = lastflag; /* jbayer */ return(TRUE); } *************** *** 821,826 **** --- 841,848 ---- prefix |= CTLX; prenum = n; predef = f; + + thisflag = lastflag; /* jbayer */ return(TRUE); } *** orig.src/edef.h Fri Jun 9 22:00:33 1989 --- edef.h Thu May 25 09:31:22 1989 *************** *** 77,82 **** --- 77,87 ---- NOSHARE int DNEAR kbdmode = STOP; /* current keyboard macro mode */ NOSHARE int DNEAR kbdrep = 0; /* number of repetitions */ NOSHARE int DNEAR restflag = FALSE; /* restricted use? */ + + #ifdef BACKUP + NOSHARE int DNEAR bakfile = TRUE; /* save the bakfile */ + #endif + NOSHARE int DNEAR lastkey = 0; /* last keystoke */ NOSHARE int DNEAR seed = 0; /* random number seed */ NOSHARE long envram = 0l; /* # of bytes current in use by malloc */ *************** *** 243,248 **** --- 248,258 ---- NOSHARE extern int kbdmode; /* current keyboard macro mode */ NOSHARE extern int kbdrep; /* number of repetitions */ NOSHARE extern int restflag; /* restricted use? */ + + #ifdef BACKUP + NOSHARE extern int bakfile; /* save the bakfile */ + #endif + NOSHARE extern int lastkey; /* last keystoke */ NOSHARE extern int seed; /* random number seed */ NOSHARE extern long envram; /* # of bytes current in use by malloc */ *** orig.src/etype.h Fri Jun 9 22:00:34 1989 --- etype.h Thu May 25 08:29:16 1989 *************** *** 205,210 **** --- 205,211 ---- PASCAL NEAR forwsearch(); PASCAL NEAR forwword(); PASCAL NEAR freewhile(); + PASCAL NEAR getbackupname(); /* -- ZU */ PASCAL NEAR getccol(); PASCAL NEAR getcline(); PASCAL NEAR getcmd(); *************** *** 254,259 **** --- 255,261 ---- PASCAL NEAR lowrite(); PASCAL NEAR macarg(); PASCAL NEAR macrotokey(); + PASCAL NEAR makebackup(); /* -- ZU */ PASCAL NEAR makelist(); PASCAL NEAR makelit(); PASCAL NEAR mcclear(); *************** *** 393,398 **** --- 395,408 ---- KEYTAB *getbind(); WINDOW *PASCAL NEAR mousewindow(); WINDOW *PASCAL NEAR wpopup(); + + PASCAL NEAR toggleovermode(); + PASCAL NEAR delline(); + + #if KEEPPOS + PASCAL NEAR gotobos(); /* goto beginning of screen */ + PASCAL NEAR gotoeos(); /* goto end of screen */ + #endif #if MSDOS & TURBO PASCAL NEAR binary(char *, char *(PASCAL NEAR *)(), int); *** orig.src/dg10.c Fri Jun 9 22:00:08 1989 --- dg10.c Wed May 24 23:55:51 1989 *** orig.src/efunc.h Fri Jun 9 22:00:33 1989 --- efunc.h Wed May 24 23:32:05 1989 *************** *** 25,30 **** --- 25,33 ---- {"begin-macro", ctlxlp}, {"beginning-of-file", gotobob}, {"beginning-of-line", gotobol}, + #if KEEPPOS + {"beginning-of-screen", gotobos}, + #endif {"bind-to-key", bindtokey}, {"buffer-position", showcpos}, {"case-region-lower", lowerregion}, *************** *** 45,50 **** --- 48,54 ---- {"delete-blank-lines", deblank}, {"delete-buffer", killbuffer}, {"delete-global-mode", delgmode}, + {"delete-line", delline}, {"delete-mode", delmode}, {"delete-next-character", forwdel}, {"delete-next-word", delfword}, *************** *** 70,75 **** --- 74,82 ---- {"end-macro", ctlxrp}, {"end-of-file", gotoeob}, {"end-of-line", gotoeol}, + #ifdef KEEPPOS + {"end-of-screen", gotoeos}, + #endif {"end-of-word", endword}, #if AEDIT {"entab-line", entab}, *************** *** 232,237 **** --- 239,245 ---- #if BSD {"suspend-emacs", bktoshell}, #endif + {"toggle-over-mode", toggleovermode}, {"transpose-characters", twiddle}, #if AEDIT {"trim-line", trim}, *** orig.src/basic.c Fri Jun 9 22:00:07 1989 --- basic.c Wed May 24 23:32:05 1989 *************** *** 135,141 **** --- 135,177 ---- return(TRUE); } + #if KEEPPOS + /* + * Move to the top of the screen. The standsrd screen code does most of the + * hard parts of update. + * + */ + PASCAL NEAR gotobos(f, n) + { + curwp->w_dotp = curwp->w_linep; + curwp->w_doto = 0; + curwp->w_flag |= WFHARD; + return(TRUE); + } /* gotobos */ + + + /* + * Goto the end of the screen. + */ + PASCAL NEAR gotoeos(f, n) + { + register LINE *lp; + int currow; + + lp = curwp->w_linep; + currow = curwp->w_ntrows - 1; + while (currow-- && lp!=curbp->b_linep) lp = lforw(lp); + curwp->w_dotp = lp; + curwp->w_doto = 0; + curwp->w_flag |= WFHARD; + return(TRUE); + } /* gotoeos */ + + #endif + + + /* * Move forward by full lines. If the number of lines to move is less than * zero, call the backward line function to actually do it. The last command * controls how the goal column is set. Bound to "C-N". No errors are *************** *** 337,342 **** --- 373,383 ---- { register LINE *lp; + #if KEEPPOS + int currow; + register LINE *lp1; + #endif + if (f == FALSE) { n = curwp->w_ntrows - 2; /* Default scroll. */ if (n <= 0) /* Forget the overlap */ *************** *** 348,358 **** n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; while (n-- && lp!=curbp->b_linep) lp = lforw(lp); curwp->w_linep = lp; ! curwp->w_dotp = lp; curwp->w_doto = 0; curwp->w_flag |= WFHARD; return(TRUE); } --- 389,420 ---- n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; + + #if KEEPPOS + if ((lastflag&CFCPCN) == 0) + curgoal = getccol(FALSE); + /* flag this command as a line move */ + thisflag |= CFCPCN; + lp1 = lp; + currow = 0; + while (lp1 != curwp->w_dotp ) { + currow++; + lp1 = lforw(lp1); + } + #endif + while (n-- && lp!=curbp->b_linep) lp = lforw(lp); curwp->w_linep = lp; ! ! #if KEEPPOS ! while (currow-- && lp!=curbp->b_linep) lp = lforw(lp); ! curwp->w_doto = getgoal(lp); ! #else curwp->w_doto = 0; + #endif + + curwp->w_dotp = lp; curwp->w_flag |= WFHARD; return(TRUE); } *************** *** 370,375 **** --- 432,442 ---- { register LINE *lp; + + #if KEEPPOS + int currow; + register LINE *lp1; + #endif if (f == FALSE) { n = curwp->w_ntrows - 2; /* Default scroll. */ *************** *** 382,392 **** n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; while (n-- && lback(lp)!=curbp->b_linep) lp = lback(lp); curwp->w_linep = lp; ! curwp->w_dotp = lp; curwp->w_doto = 0; curwp->w_flag |= WFHARD; return(TRUE); } --- 449,480 ---- n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; + + #if KEEPPOS + if ((lastflag&CFCPCN) == 0) + curgoal = getccol(FALSE); + /* flag this command as a line move */ + thisflag |= CFCPCN; + lp1 = lp; + currow = 0; + while (lp1 != curwp->w_dotp ) { + currow++; + lp1 = lforw(lp1); + } + #endif + while (n-- && lback(lp)!=curbp->b_linep) lp = lback(lp); curwp->w_linep = lp; ! ! #if KEEPPOS ! while (currow-- && lp!=curbp->b_linep) lp = lforw(lp); ! curwp->w_doto = getgoal(lp); ! #else curwp->w_doto = 0; + #endif + + curwp->w_dotp = lp; curwp->w_flag |= WFHARD; return(TRUE); } *** orig.src/window.c Fri Jun 9 22:00:31 1989 --- window.c Wed May 24 09:51:25 1989 *************** *** 30,37 **** */ PASCAL NEAR refresh(f, n) { ! if (f == FALSE) sgarbf = TRUE; else { curwp->w_force = 0; /* Center dot. */ --- 30,41 ---- */ PASCAL NEAR refresh(f, n) { ! if (f == FALSE) { sgarbf = TRUE; + + thisflag = lastflag; /* jbayer */ + + } else { curwp->w_force = 0; /* Center dot. */ *** orig.src/line.c Fri Jun 9 22:00:16 1989 --- line.c Wed May 24 09:47:07 1989 *************** *** 569,574 **** --- 569,613 ---- return(TRUE); } + + + /* + * Delete the line the cursor is on + */ + PASCAL NEAR delline(f, n) + { + + /* Use the lines associated with i in order to keep the + cursor in the same column when deleting a line. If you + comment these lines out then the cursor will revert to + the first column. */ + + int i,i1; + + i1 = lastflag; + i = getccol(FALSE); + gotobol(f,n); + + lastflag = thisflag; + thisflag = 0; + setmark(f,n); + + lastflag = thisflag; + thisflag = 0; + forwline(f,n); + + lastflag = i1; /* This so if several lines are killed at the */ + thisflag = 0; /* same time, they will all go into the same */ + killregion(f); /* kill buffer */ + + curgoal = i; + curwp->w_doto = getgoal(curwp->w_dotp); + + lastflag = i1; + return(TRUE); + } + + /* * Delete all of the text saved in the kill buffer. Called by commands when a * new kill context is being created. The kill buffer array is released, just *** orig.src/random.c Fri Jun 9 22:00:23 1989 --- random.c Wed May 24 09:41:40 1989 *************** *** 237,242 **** --- 237,261 ---- stabsize = n; return(TRUE); } + + #if SOFTAB + + if (curwp->w_bufp->b_mode & MDOVER) { + if (! tabsize) { + curgoal = getccol(FALSE) | 0x07; + curgoal++; + } + else { + curgoal = tabsize - (getccol(FALSE) % tabsize) + getccol(FALSE); + } + + curwp->w_doto = getgoal(curwp->w_dotp); + return(TRUE); + } + + #endif + + if (!stabsize) return(linsert(1, '\t')); return(linsert(stabsize - (getccol(FALSE) % stabsize), ' ')); *************** *** 433,445 **** --- 452,490 ---- return(s); } + /* + * Toggle overwrite mode. Bound to the ins key. + */ + PASCAL NEAR toggleovermode(f, n) /* toggle overwrite mode */ + + int f, n; /* default and argument */ + + { + if (curwp->w_bufp->b_mode & MDOVER) + curwp->w_bufp->b_mode &= ~MDOVER; + else + curwp->w_bufp->b_mode |= MDOVER; + upmode(); + } + + + /* * Insert a newline. Bound to "C-M". If we are in CMODE, do automatic * indentation as specified. */ PASCAL NEAR newline(f, n) { register int s; + + #if SOFTAB + + if (curwp->w_bufp->b_mode & MDOVER) { + gotobol(f,1); + thisflag = 0; + return(forwline(f,1)); + } + #endif if (curbp->b_mode&MDVIEW) /* don't allow this command if */ return(rdonly()); /* we are in read only mode */ *************** *** 1120,1126 **** --- 1165,1176 ---- yet to solve......... */ if (count == 0) { forwchar(FALSE, 1); + #if XENIX + update(TRUE); + nap(500L); + #else for (i = 0; i < term.t_pause; i++) + #endif update(FALSE); } *** orig.src/unix.c Fri Jun 9 22:03:35 1989 --- unix.c Tue Apr 11 14:24:26 1989 *************** *** 15,21 **** #include #include #include ! #include int kbdflgs; /* saved keyboard fd flags */ int kbdpoll; /* in O_NDELAY mode */ int kbdqp; /* there is a char in kbdq */ --- 15,23 ---- #include #include #include ! #include ! #include ! #include int kbdflgs; /* saved keyboard fd flags */ int kbdpoll; /* in O_NDELAY mode */ int kbdqp; /* there is a char in kbdq */ *************** *** 217,223 **** if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll) return(FALSE); kbdpoll = TRUE; ! kbdqp = (1 == read(0, kbdq, 1)); } return(kbdqp); #endif --- 219,225 ---- if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll) return(FALSE); kbdpoll = TRUE; ! kbdqp = (1 == read(0, &kbdq, 1)); } return(kbdqp); #endif *************** *** 531,543 **** register int extflag; /* does the file have an extention? */ /* first parse the file path off the file spec */ strcpy(path, fspec); index = strlen(path) - 1; while (index >= 0 && (path[index] != '/' && path[index] != '\\' && path[index] != ':')) --index; path[index+1] = 0; ! /* check for an extension */ point = strlen(fspec) - 1; extflag = FALSE; --- 533,546 ---- register int extflag; /* does the file have an extention? */ /* first parse the file path off the file spec */ + strcpy(path, fspec); index = strlen(path) - 1; while (index >= 0 && (path[index] != '/' && path[index] != '\\' && path[index] != ':')) --index; path[index+1] = 0; ! /* check for an extension */ point = strlen(fspec) - 1; extflag = FALSE; *************** *** 554,561 **** closedir(dirptr); dirptr = NULL; } ! dirptr = opendir(path); ! if (dirptr == NULL) return(NULL); strcpy(rbuf, path); --- 557,566 ---- closedir(dirptr); dirptr = NULL; } ! if (strlen(path) == 0) /* modified 4/10/89 by j. bayer */ ! dirptr = opendir("./"); ! else dirptr = opendir(path); ! if (dirptr == NULL) return(NULL); strcpy(rbuf, path); *** orig.src/epath.h Fri Jun 9 22:00:33 1989 --- epath.h Mon Apr 10 17:27:45 1989 *************** *** 54,60 **** }; #endif ! #if V7 | BSD | USG | HPUX { ".emacsrc", "emacs.hlp", --- 54,60 ---- }; #endif ! #if V7 | BSD | USG | HPUX | XENIX { ".emacsrc", "emacs.hlp",