home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / text_ed / elv16b2 / diffs < prev    next >
Text File  |  1992-08-18  |  90KB  |  3,820 lines

  1. diff -c ./alias.c ../src/alias.c
  2. *** ./alias.c    Tue May 12 14:18:48 1992
  3. --- ../src/alias.c    Thu May 14 01:28:50 1992
  4. ***************
  5. *** 27,32 ****
  6. --- 27,41 ----
  7.   #define ELVIS    "elvis"
  8.   #endif
  9.   
  10. + #if __STDC__
  11. + #include <string.h>
  12. + #include <stdlib.h>
  13. + #endif
  14. + #if MINT
  15. + extern char *getenv();
  16. + #endif
  17.   extern char **environ;
  18.   extern int errno;
  19.   
  20. ***************
  21. *** 40,45 ****
  22. --- 49,57 ----
  23.   #if OSK
  24.       extern int chainc();
  25.   #endif
  26. + #if TOS || MINT
  27. +     extern char myname[];
  28. + #endif
  29.   
  30.       /* allocate enough space for a copy of the argument list, plus a
  31.        * terminating NULL, plus maybe an added flag.
  32. ***************
  33. *** 55,63 ****
  34.           exit(2);
  35.       }
  36.   
  37.       /* find the last letter in the invocation name of this program */
  38.       i = strlen(argv[0]);
  39. ! #if MSDOS || TOS
  40.       /* we almost certainly must bypass ".EXE" or ".TTP" from argv[0] */
  41.       if (i > 4 && argv[0][i - 4] == '.')
  42.           i -= 4;
  43. --- 67,81 ----
  44.           exit(2);
  45.       }
  46.   
  47. + #if TOS || MINT
  48. +     /* some stupid TOS shells haven't heared about argv[0]  -nox */
  49. +     if (!**argv)
  50. +         *argv = myname;    /* (see myname.c) */
  51. + #endif
  52.       /* find the last letter in the invocation name of this program */
  53.       i = strlen(argv[0]);
  54. ! #if MSDOS || TOS || MINT
  55.       /* we almost certainly must bypass ".EXE" or ".TTP" from argv[0] */
  56.       if (i > 4 && argv[0][i - 4] == '.')
  57.           i -= 4;
  58. ***************
  59. *** 65,70 ****
  60. --- 83,96 ----
  61.       letter = argv[0][i - 1];
  62.   
  63.       /* copy argv to argblk, possibly inserting a flag such as "-R" */
  64. + #if MINT
  65. +     /* see if elvis is the $EDITOR and has a path, so that execvp()
  66. +        doesn't have to search $PATH (yes, GEMDOS is slow...)  -nox */
  67. +     if (strpbrk(ELVIS, "/\\") || !(argblk[0]=getenv("EDITOR")) ||
  68. +         !strpbrk(argblk[0], "/\\") ||
  69. +         (strcmp(argblk[0]+strlen(argblk[0])-sizeof(ELVIS)+1, ELVIS) &&
  70. +          strcmp(argblk[0]+strlen(argblk[0])-sizeof(ELVIS)-3, ELVIS ".ttp")))
  71. + #endif
  72.       argblk[0] = ELVIS;
  73.       i = j = 1;
  74.       switch (letter)
  75. ***************
  76. *** 98,101 ****
  77. --- 124,128 ----
  78.       (void)execvp(argblk[0], argblk);
  79.       perror(ELVIS);
  80.   #endif
  81. +     exit(2);
  82.   }
  83. diff -c ./atari.c ../src/atari.c
  84. *** ./atari.c    Tue May 12 14:18:50 1992
  85. --- ../src/atari.c    Thu May 14 01:10:26 1992
  86. ***************
  87. *** 16,24 ****
  88.   #include "config.h"
  89.   #include "vi.h"
  90.   
  91. ! #if TOS
  92.   #include <osbind.h>
  93.   
  94.   /* vi uses mode==0 only ... */
  95.   int access(file, mode)
  96.       char *file;
  97. --- 16,26 ----
  98.   #include "config.h"
  99.   #include "vi.h"
  100.   
  101. ! #if TOS || MINT
  102.   #include <osbind.h>
  103.   
  104. + # if !MINT /* MiNT's library is a little more complete :-) */
  105.   /* vi uses mode==0 only ... */
  106.   int access(file, mode)
  107.       char *file;
  108. ***************
  109. *** 36,42 ****
  110.       return template;
  111.   }
  112.   
  113. ! #ifndef __GNUC__
  114.   char *getcwd(buf, size)
  115.       char *buf;
  116.   {
  117. --- 38,46 ----
  118.       return template;
  119.   }
  120.   
  121. ! # endif
  122. ! # ifndef __GNUC__
  123.   char *getcwd(buf, size)
  124.       char *buf;
  125.   {
  126. ***************
  127. *** 47,56 ****
  128.       Dgetpath(buf + 2, 0);
  129.       return buf;
  130.   }
  131. ! #endif
  132.   
  133.   /* read -- text mode, compress \r\n to \n
  134.    * warning: might fail when maxlen==1 and at eol
  135.    */
  136.   
  137.   int tread(fd, buf, maxlen)
  138. --- 51,61 ----
  139.       Dgetpath(buf + 2, 0);
  140.       return buf;
  141.   }
  142. ! # endif
  143.   
  144.   /* read -- text mode, compress \r\n to \n
  145.    * warning: might fail when maxlen==1 and at eol
  146. +  * ...no longer :-)  -nox
  147.    */
  148.   
  149.   int tread(fd, buf, maxlen)
  150. ***************
  151. *** 61,68 ****
  152.       int i, j, nread=read(fd, buf, (unsigned)maxlen);
  153.   
  154.       if (nread && buf[nread-1]=='\r')
  155. !     {    nread--;
  156. !         lseek(fd, -1l, 1);
  157.       }
  158.       for (i=j=0; j<nread; i++,j++)
  159.       {    if (buf[j]=='\r' && buf[j+1]=='\n')
  160. --- 66,81 ----
  161.       int i, j, nread=read(fd, buf, (unsigned)maxlen);
  162.   
  163.       if (nread && buf[nread-1]=='\r')
  164. !     {
  165. !         if (--nread)
  166. !             lseek(fd, -1l, 1);
  167. !         else {
  168. !             if (read(fd, buf, 1) && *buf != '\n') {
  169. !                 *buf = '\r';
  170. !                 lseek(fd, -1l, 1);
  171. !             }
  172. !             return 1;
  173. !         }
  174.       }
  175.       for (i=j=0; j<nread; i++,j++)
  176.       {    if (buf[j]=='\r' && buf[j+1]=='\n')
  177. ***************
  178. *** 77,82 ****
  179. --- 90,113 ----
  180.       char *buf;
  181.       int maxlen;
  182.   {
  183. + # if 1
  184. +     int i, j;
  185. +     /* uh, we can have that easier...  -nox */
  186. +     static char writbuf[BLKSIZE*2];
  187. +     for (i=j=0; j<maxlen; )
  188. +     {
  189. +         if ((writbuf[i++]=buf[j++])=='\n')
  190. +         {    writbuf[i-1]='\r';
  191. +             writbuf[i++]='\n';
  192. +         }
  193. +     }
  194. +     /* ...and make the result a little bit more reasonable too :-)  */
  195. +     if (!i || !(maxlen = write(fd, writbuf, (unsigned)i)))
  196. +         return 0;
  197. +     return j - i + maxlen;
  198. + }
  199. + # else
  200.       int i, j, nwritten=0, hadnl=0;
  201.       char writbuf[BLKSIZE];
  202.   
  203. ***************
  204. *** 104,122 ****
  205.           write(fd, writbuf, (unsigned)i);
  206.       return j;
  207.   }
  208.   
  209.   /* The "timer" variable is used as a shadow of the system's timer.  Since the
  210.    * system's timer can only be accessed in Supervisor mode, we are forced to
  211.    * do a Supexec(gettime) to copy the system's timer in to the User-mode "timer"
  212.    * variable.
  213.    */
  214. ! static int timer;
  215. ! static gettime()
  216.   {
  217.       timer = *(long *)(0x4ba);
  218.   }
  219.   
  220.   /* This function implements a read-with-timeout from the keyboard. */
  221.   /*ARGSUSED*/
  222.   int ttyread(buf, len, time)
  223. --- 135,155 ----
  224.           write(fd, writbuf, (unsigned)i);
  225.       return j;
  226.   }
  227. + # endif
  228.   
  229.   /* The "timer" variable is used as a shadow of the system's timer.  Since the
  230.    * system's timer can only be accessed in Supervisor mode, we are forced to
  231.    * do a Supexec(gettime) to copy the system's timer in to the User-mode "timer"
  232.    * variable.
  233.    */
  234. ! static long timer;
  235. ! static void gettime()
  236.   {
  237.       timer = *(long *)(0x4ba);
  238.   }
  239. + #endif /* TOS || MINT */
  240.   
  241. + #if TOS
  242.   /* This function implements a read-with-timeout from the keyboard. */
  243.   /*ARGSUSED*/
  244.   int ttyread(buf, len, time)
  245. ***************
  246. *** 129,139 ****
  247.       long    endtime;
  248.   
  249.       /* compute the ending time, in increments of 1/200th seconds */
  250. !     Supexec(gettime);
  251.       endtime = time * 20 + timer;
  252.   
  253.       /* wait until time runs out, or we get a keystroke */
  254. !     while (!pos && (!time || timer < endtime))
  255.       {
  256.           if (Bconstat(2))
  257.           {
  258. --- 162,172 ----
  259.       long    endtime;
  260.   
  261.       /* compute the ending time, in increments of 1/200th seconds */
  262. !     (void) Supexec(gettime);
  263.       endtime = time * 20 + timer;
  264.   
  265.       /* wait until time runs out, or we get a keystroke */
  266. !     while (!pos && (!time || (timer-endtime) < 0))
  267.       {
  268.           if (Bconstat(2))
  269.           {
  270. ***************
  271. *** 145,151 ****
  272.                   buf[pos++] = l >> 16;
  273.               }
  274.           }
  275. !         Supexec(gettime);
  276.       }
  277.       return pos;
  278.   }
  279. --- 178,184 ----
  280.                   buf[pos++] = l >> 16;
  281.               }
  282.           }
  283. !         (void) Supexec(gettime);
  284.       }
  285.       return pos;
  286.   }
  287. ***************
  288. *** 158,161 ****
  289. --- 191,360 ----
  290.       while (len--)
  291.           Bconout(2, *buf++);
  292.   }
  293. + #endif /* TOS */
  294. + #if MINT
  295. + extern int __mint;
  296. + # include <signal.h>
  297. + # include <setjmp.h>
  298. + static jmp_buf env;
  299. + /* ctputs(): same as tputs(), but recognizes #blink / #noblink to
  300. +    set the cursormode (have to do it this way because those are not
  301. +    available thru the ST's `VT52' emulator...) */
  302. + void ctputs(cp, affcnt, outfn)
  303. +     char    *cp;
  304. +     int    affcnt;
  305. +     int    (*outfn)();
  306. + {
  307. +     if (!strcmp(cp, "#blink")) {
  308. +         (void) Cursconf(2, 0);
  309. +         return;
  310. +     }
  311. +     if (!strcmp(cp, "#noblink")) {
  312. +         (void) Cursconf(3, 0);
  313. +         return;
  314. +     }
  315. +     tputs(cp, affcnt, outfn);
  316. + }
  317. + /* this turns those shifted cursor- / insert / home keys into
  318. +    something useful (without this, they would return digits...) */
  319. + static long fixkey(l)
  320. +     long    l;
  321. + {
  322. +     if (l < 0 || !(char) l)
  323. +         return l;
  324. +     switch ((unsigned char) (l >> 16)) {
  325. +         case 72:        /* shift- ^    -> PgUp */
  326. +             return 73l << 16;
  327. +         case 80:        /* shift- v    -> PgDn */
  328. +             return 81l << 16;
  329. +         case 71:        /* shift-Home    -> End */
  330. +             return 79l << 16;
  331. +         case 75:        /* shift- <-    -> ctrl- <- */
  332. +             return 115l << 16;
  333. +         case 77:        /* shift- ->    -> ctrl- -> */
  334. +             return 116l << 16;
  335. +         case 82:        /* shift-Insert    -> Printscreen */
  336. +             return 55l << 16;
  337. +     }
  338. +     return l;
  339. + }
  340. + /*ARGSUSED*/
  341. + static void dummy(signo)
  342. +     int    signo;
  343. + {
  344. +     longjmp(env, 1);
  345. + }
  346. + /* This function implements a read-with-timeout from the keyboard. */
  347. + /*ARGSUSED*/
  348. + int ttyread(buf, len, time)
  349. +     char    *buf;    /* where to store the gotten characters */
  350. +     int    len;    /* maximum number of characters to get -- ignored on terminals */
  351. +     int    time;    /* maximum time to allow for reading */
  352. + {
  353. +     int    pos=0;
  354. +     long    l;
  355. +     long    endtime;
  356. +     static    tty;    /* 'y' if reading from tty, or 'n' if not a tty */
  357. +     extern    int got_winch;    /* flag from our getsize() SIGWINCH handler */
  358. +     /* do we know whether this is a tty or not? */
  359. +     if (!tty)
  360. +         tty = (isatty(0) ? 'y' : 'n');
  361. +     if (tty != 'y')
  362. +         return read(0, buf, (unsigned) len);
  363. +     if (!__mint) {
  364. +         /* no MiNT -> eat cycles :-)  */
  365. +         /* compute the ending time, in increments of 1/200th seconds */
  366. +         (void) Supexec(gettime);
  367. +         endtime = time * 20 + timer;
  368. +         /* wait until time runs out, or we get a keystroke */
  369. +         while (!pos && (!time || (timer-endtime) < 0))
  370. +         {
  371. +             if (*o_stbios ? Bconstat(2) : Cconis())
  372. +             {
  373. +                 l = fixkey(*o_stbios ? Bconin(2) : Crawcin());
  374. +                 if (l < 0)
  375. +                     return l;
  376. +                 buf[pos] = l;
  377. +                 if (buf[pos++] == '\0')
  378. +                 {
  379. +                     buf[pos-1] = '#';
  380. +                     buf[pos++] = l >> 16;
  381. +                 }
  382. +             }
  383. +             (void) Supexec(gettime);
  384. +         }
  385. +         return pos;
  386. +     }
  387. +     /* MiNT is there -> do it with alarm()
  388. +        [yes MiNT also has select(), but as of MiNT version 0.94
  389. +         that won't yet work over e.g. a serial line...] */
  390. +     /* arrange for timeout */
  391. + # if __GNUC__
  392. +     signal(SIGALRM, (void (*)()) dummy);
  393. + # else
  394. +     signal(SIGALRM, dummy);
  395. + # endif
  396. +     alarm(time);
  397. +     if (setjmp(env))
  398. +         return 0;
  399. +     do {
  400. +         l = fixkey(*o_stbios ? Bconin(2) : Crawcin());
  401. +         if (got_winch) {
  402. +             got_winch = 0;
  403. +             if (*o_lines != LINES || *o_columns != COLS) {
  404. +                 *o_lines = LINES;
  405. +                 *o_columns = COLS;
  406. + #ifndef CRUNCH
  407. +                 if (!wset)
  408. +                 {
  409. +                     *o_window = LINES - 1;
  410. +                 }
  411.   #endif
  412. +                 if (mode != MODE_EX && mode != MODE_COLON)
  413. +                     /* pretend the user hit ^L */
  414. +                     buf[pos++] = ctrl('L');
  415. +             }
  416. +         }
  417. +         if (l > 0 && (buf[pos++]=l) == '\0')
  418. +         {
  419. +             buf[pos-1] = '#';
  420. +             buf[pos++] = l>>16;
  421. +         }
  422. +     } while (!pos);
  423. +     /* cancel the alarm */
  424. +     alarm(0);
  425. +     /* return the number of bytes read */
  426. +     return pos;
  427. + }
  428. + void ttywrite(buf, len)
  429. +     char    *buf;
  430. +     int    len;
  431. + {
  432. +     if (!*o_stbios) {
  433. +         write(1, buf, (unsigned) len);
  434. +         return;
  435. +     }
  436. +     while (len--)
  437. +         (void) Bconout(2, *buf++);
  438. + }
  439. + #endif /* MINT */
  440. diff -c ./cmd1.c ../src/cmd1.c
  441. *** ./cmd1.c    Tue May 12 14:18:52 1992
  442. --- ../src/cmd1.c    Wed May 13 23:26:24 1992
  443. ***************
  444. *** 17,22 ****
  445. --- 17,26 ----
  446.   #include "vi.h"
  447.   #include "regexp.h"
  448.   
  449. + #if MINT
  450. + extern    int __mint;
  451. + #endif
  452.   #ifdef DEBUG
  453.   /* print the selected lines with info on the blocks */
  454.   /*ARGSUSED*/
  455. ***************
  456. *** 197,203 ****
  457.       }
  458.   
  459.       /* either the file must not exist, or we must have a ! or be appending */
  460. !     if (access(extra, 0) == 0 && !bang && !append)
  461.       {
  462.           msg("File already exists - Use :w! to overwrite");
  463.           return;
  464. --- 201,207 ----
  465.       }
  466.   
  467.       /* either the file must not exist, or we must have a ! or be appending */
  468. !     if (*extra && access(extra, 0) == 0 && !bang && !append)
  469.       {
  470.           msg("File already exists - Use :w! to overwrite");
  471.           return;
  472. ***************
  473. *** 238,244 ****
  474. --- 242,252 ----
  475.           scan[i++] = '\n';
  476.   
  477.           /* print the line */
  478. + #if MINT
  479. +         if ((*o_crlf ? twrite : write)(fd, scan, i) < i)
  480. + #else
  481.           if (twrite(fd, scan, i) < i)
  482. + #endif
  483.           {
  484.               msg("Write failed");
  485.               break;
  486. ***************
  487. *** 1247,1253 ****
  488.       }
  489.   
  490.       /* if the number is part of a larger word, then ignore this line */
  491. !     if (*text && isalpha(text[-1]))
  492.       {
  493.           return (char *)0;
  494.       }
  495. --- 1255,1262 ----
  496.       }
  497.   
  498.       /* if the number is part of a larger word, then ignore this line */
  499. !     /* '_' included so it catches `...in function v_1ex:'  -nox */
  500. !     if (*text && (isalpha(text[-1]) || text[-1]=='_'))
  501.       {
  502.           return (char *)0;
  503.       }
  504. ***************
  505. *** 1431,1436 ****
  506. --- 1440,1448 ----
  507.       char    *extra;
  508.   {
  509.       BLK    buf;
  510. + #if MINT
  511. +     int    fd, old2;
  512. + #endif
  513.   
  514.       /* if the file hasn't been saved, then complain unless ! */
  515.       if (tstflag(file, MODIFIED) && !bang)
  516. ***************
  517. *** 1440,1447 ****
  518. --- 1452,1467 ----
  519.       }
  520.   
  521.       /* build the command */
  522. + #if MINT
  523. +     /* some stupid shells won't grok `2>' :-(  -nox */
  524. +     sprintf(buf.c, "%s %s ", (cmd == CMD_CC ? o_cc : o_make), extra);
  525. +     qaddstr(buf.c);
  526. +     qaddstr(REDIRECT);
  527. +     qaddstr(ERRLIST);
  528. + #else
  529.       sprintf(buf.c, "%s %s %s%s", (cmd == CMD_CC ? o_cc : o_make), extra, REDIRECT, ERRLIST);
  530.       qaddstr(buf.c);
  531. + #endif
  532.       addch('\n');
  533.   
  534.       /* close the old errlist file, if any */
  535. ***************
  536. *** 1451,1465 ****
  537. --- 1471,1510 ----
  538.           errfd = -3;
  539.       }
  540.   
  541. + #if MINT
  542. +     close(creat(ERRLIST, 0666));
  543. +     if ((fd=open(ERRLIST, O_RDWR))==-1)
  544. +     {
  545. +         unlink(ERRLIST);
  546. +         return;
  547. +     }
  548. +     suspend_curses();
  549. +     old2=dup(2);
  550. +     dup2(fd, 2);
  551. +     system(buf.c);
  552. +     dup2(old2, 2); close(old2);
  553. +     close(fd);
  554. + #else
  555.       /* run the command, with curses temporarily disabled */
  556.       suspend_curses();
  557.       system(buf.c);
  558. + #endif
  559.       resume_curses(mode == MODE_EX);
  560.       if (mode == MODE_COLON)
  561. + #if 1
  562. +         /* `:' hit instead of CR, so let him escape...  -nox */
  563. +         return;
  564. + #else
  565.           mode = MODE_VI;
  566. + #endif
  567.   
  568.       /* run the "errlist" command */
  569.       cmd_errlist(MARK_UNSET, MARK_UNSET, cmd, bang, ERRLIST);
  570. +     /* avoid spurious `Hit <RETURN>' after 1st error message  -nox */
  571. +     /* (wich happened when cmd_errlist didn't have to change files...)  */
  572. +     if (mode == MODE_VI)
  573. +         refresh();
  574.   }
  575.   #endif
  576.   
  577. ***************
  578. *** 1748,1753 ****
  579. --- 1793,1802 ----
  580.           return;
  581.       }
  582.   #endif
  583. + #if MINT
  584. +     if (!__mint)
  585. +         return;
  586. + #endif
  587.   
  588.       move(LINES - 1, 0);
  589.       if (tstflag(file, MODIFIED))
  590. ***************
  591. *** 1760,1766 ****
  592. --- 1809,1820 ----
  593.       refresh();
  594.       suspend_curses();
  595.       func = signal(SIGTSTP, SIG_DFL);
  596. + #if MINT
  597. +     /* earlier versions of MiNT had a problem with kill(0, ...)  -nox */
  598. +     killpg(getpgrp(), SIGTSTP);
  599. + #else
  600.       kill (0, SIGTSTP);
  601. + #endif
  602.   
  603.       /* the process stops and resumes here */
  604.   
  605. diff -c ./cmd2.c ../src/cmd2.c
  606. *** ./cmd2.c    Tue May 12 14:18:52 1992
  607. --- ../src/cmd2.c    Wed May 13 18:28:12 1992
  608. ***************
  609. *** 649,655 ****
  610. --- 649,659 ----
  611.           add(tomark, "\n");
  612.   
  613.           /* for each chunk of text... */
  614. + #if MINT
  615. +         while ((rc = (*o_crlf ? tread : read)(fd, tmpblk.c, BLKSIZE - 1)) > 0)
  616. + #else
  617.           while ((rc = tread(fd, tmpblk.c, BLKSIZE - 1)) > 0)
  618. + #endif
  619.           {
  620.               /* count newlines, convert NULs, etc. ... */
  621.               for (lines = 0, scan = tmpblk.c; rc > 0; rc--, scan++)
  622. diff -c ./config.h ../src/config.h
  623. *** ./config.h    Tue May 12 14:18:54 1992
  624. --- ../src/config.h    Wed May 13 18:33:10 1992
  625. ***************
  626. *** 82,87 ****
  627. --- 82,93 ----
  628.   # endif
  629.   #endif
  630.   
  631. + #if MINT
  632. + # ifdef TOS
  633. + #  undef TOS
  634. + # endif
  635. + #endif
  636.   /* OS9/68000 */
  637.   #ifdef    OSK
  638.   # define COMPILED_BY    "Microware C V2.3 Edition 40"
  639. ***************
  640. *** 125,130 ****
  641. --- 131,140 ----
  642.   # define TOS    0        /* Atari ST    */
  643.   #endif
  644.   
  645. + #ifndef    MINT
  646. + # define MINT    0        /* Atari ST, gcc, MiNT    */
  647. + #endif
  648.   #ifndef    AMIGA
  649.   # define AMIGA    0        /* Commodore Amiga */
  650.   #endif
  651. ***************
  652. *** 146,152 ****
  653.   #endif
  654.   
  655.                   /* Minix has no predefines */
  656. ! #if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS
  657.   # define MINIX    1
  658.   #else
  659.   # define MINIX    0
  660. --- 156,162 ----
  661.   #endif
  662.   
  663.                   /* Minix has no predefines */
  664. ! #if !BSD && !UNIXV && !UNIX7 && !MSDOS && !TOS && !AMIGA && !OSK && !COHERENT && !VMS && !MINT
  665.   # define MINIX    1
  666.   #else
  667.   # define MINIX    0
  668. ***************
  669. *** 229,235 ****
  670.    * a true function on all systems.  The ttywrite() function is almost always
  671.    * just a macro...
  672.    */
  673. ! #if !TOS && !AMIGA
  674.   # define ttywrite(buf, len)    write(1, buf, (unsigned)(len))    /* raw write */
  675.   #endif
  676.   
  677. --- 239,245 ----
  678.    * a true function on all systems.  The ttywrite() function is almost always
  679.    * just a macro...
  680.    */
  681. ! #if !TOS && !AMIGA && !MINT
  682.   # define ttywrite(buf, len)    write(1, buf, (unsigned)(len))    /* raw write */
  683.   #endif
  684.   
  685. ***************
  686. *** 259,273 ****
  687.   extern char *getcwd();
  688.   
  689.   /* text versa binary mode for read/write */
  690. ! #if !TOS
  691.   #define    tread(fd,buf,n)        read(fd,buf,(unsigned)(n))
  692.   #define twrite(fd,buf,n)    write(fd,buf,(unsigned)(n))
  693.   #endif
  694.   
  695.   /**************************** Compiler quirks *********************************/
  696.   
  697.   /* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
  698. ! #if UNIX7 || TOS
  699.   # define void int
  700.   #endif
  701.   
  702. --- 269,290 ----
  703.   extern char *getcwd();
  704.   
  705.   /* text versa binary mode for read/write */
  706. ! #if !TOS && !MINT
  707.   #define    tread(fd,buf,n)        read(fd,buf,(unsigned)(n))
  708.   #define twrite(fd,buf,n)    write(fd,buf,(unsigned)(n))
  709.   #endif
  710.   
  711. + #if MINT
  712. + extern int read();
  713. + extern int tread();
  714. + extern int write();
  715. + extern int twrite();
  716. + #endif
  717.   /**************************** Compiler quirks *********************************/
  718.   
  719.   /* the UNIX version 7 and (some) TOS compilers, don't allow "void" */
  720. ! #if (UNIX7 || TOS) && !NEWSTYLE
  721.   # define void int
  722.   #endif
  723.   
  724. ***************
  725. *** 378,393 ****
  726.   # endif
  727.   #endif
  728.   
  729. ! #if MSDOS || TOS
  730.   /* do not change TMPNAME and SCRATCH*: they MUST begin with '%s\\'! */
  731. ! # ifndef TMPDIR
  732. ! #  define TMPDIR    "C:\\tmp"    /* directory where temp files live */
  733. ! # endif
  734. ! # ifndef PRSVDIR
  735. ! #  define PRSVDIR    "C:\\preserve"    /* directory where preserved file live */
  736. ! # endif
  737. ! # ifndef PRSVINDEX
  738. ! #  define PRSVINDEX    "C:\\preserve\\Index" /* index of files in PRSVDIR */
  739.   # endif
  740.   # define TMPNAME    "%s\\elv_%x.%x" /* temp file */
  741.   # if MSDOS
  742. --- 395,422 ----
  743.   # endif
  744.   #endif
  745.   
  746. ! #if MSDOS || TOS || MINT
  747.   /* do not change TMPNAME and SCRATCH*: they MUST begin with '%s\\'! */
  748. ! # if !MINT
  749. ! #  ifndef TMPDIR
  750. ! #   define TMPDIR    "C:\\tmp"    /* directory where temp files live */
  751. ! #  endif
  752. ! #  ifndef PRSVDIR
  753. ! #   define PRSVDIR    "C:\\preserve"    /* directory where preserved file live */
  754. ! #  endif
  755. ! #  ifndef PRSVINDEX
  756. ! #   define PRSVINDEX    "C:\\preserve\\Index" /* index of files in PRSVDIR */
  757. ! #  endif
  758. ! # else
  759. ! #  ifndef TMPDIR
  760. ! #   define TMPDIR    "/tmp"        /* directory where temp files live */
  761. ! #  endif
  762. ! #  ifndef PRSVDIR
  763. ! #   define PRSVDIR    "/usr/preserve"    /* directory where preserved file live */
  764. ! #  endif
  765. ! #  ifndef PRSVINDEX
  766. ! #   define PRSVINDEX    "/usr/preserve/Index" /* index of files in PRSVDIR */
  767. ! #  endif
  768.   # endif
  769.   # define TMPNAME    "%s\\elv_%x.%x" /* temp file */
  770.   # if MSDOS
  771. ***************
  772. *** 405,413 ****
  773.   # endif        /* MSDOS */
  774.   # define SCRATCHIN    "%s\\siXXXXXX"    /* DOS ONLY - output of filter program */
  775.   # define SCRATCHOUT    "%s\\soXXXXXX"    /* temp file used as input to filter */
  776. ! # define SLASH        '\\'
  777.   # ifndef SHELL
  778. ! #  if TOS
  779.   #   define SHELL    "shell.ttp"    /* default shell */
  780.   #  else
  781.   #   define SHELL    "command.com"    /* default shell */
  782. --- 434,446 ----
  783.   # endif        /* MSDOS */
  784.   # define SCRATCHIN    "%s\\siXXXXXX"    /* DOS ONLY - output of filter program */
  785.   # define SCRATCHOUT    "%s\\soXXXXXX"    /* temp file used as input to filter */
  786. ! # if !MINT
  787. ! #  define SLASH        '\\'
  788. ! # else
  789. ! #  define SLASH        '/'
  790. ! # endif
  791.   # ifndef SHELL
  792. ! #  if TOS || MINT
  793.   #   define SHELL    "shell.ttp"    /* default shell */
  794.   #  else
  795.   #   define SHELL    "command.com"    /* default shell */
  796. ***************
  797. *** 414,420 ****
  798.   #  endif
  799.   # endif
  800.   # define NEEDSYNC    TRUE        /* assume ":se sync" by default */
  801. ! # if TOS && __GNUC__            /* probably on other systems, too */
  802.   #  define REDIRECT    "2>"        /* GNUC reports on 2, others on 1 */
  803.   #  define CC_COMMAND    "gcc -c"
  804.   # else
  805. --- 447,453 ----
  806.   #  endif
  807.   # endif
  808.   # define NEEDSYNC    TRUE        /* assume ":se sync" by default */
  809. ! # if (TOS || MINT) && __GNUC__        /* probably on other systems, too */
  810.   #  define REDIRECT    "2>"        /* GNUC reports on 2, others on 1 */
  811.   #  define CC_COMMAND    "gcc -c"
  812.   # else
  813. diff -c ./ctags.c ../src/ctags.c
  814. *** ./ctags.c    Tue May 12 14:18:54 1992
  815. --- ../src/ctags.c    Wed May 13 22:13:48 1992
  816. ***************
  817. *** 85,91 ****
  818.       /* try to open the file for reading.  The file must be opened in
  819.        * "binary" mode because otherwise fseek() would misbehave under DOS.
  820.        */
  821. ! #if MSDOS || TOS
  822.       file_fp = fopen(name, "rb");
  823.   #else
  824.       file_fp = fopen(name, "r");
  825. --- 85,91 ----
  826.       /* try to open the file for reading.  The file must be opened in
  827.        * "binary" mode because otherwise fseek() would misbehave under DOS.
  828.        */
  829. ! #if MSDOS || TOS || MINT
  830.       file_fp = fopen(name, "rb");
  831.   #else
  832.       file_fp = fopen(name, "r");
  833. ***************
  834. *** 764,770 ****
  835.       char    **argv;
  836.   {
  837.       int    i, j;
  838. ! #if MSDOS || TOS
  839.       char    **wildexpand();
  840.   #endif
  841.   
  842. --- 764,770 ----
  843.       char    **argv;
  844.   {
  845.       int    i, j;
  846. ! #if MSDOS || TOS || MINT
  847.       char    **wildexpand();
  848.   #endif
  849.   
  850. ***************
  851. *** 771,777 ****
  852.       /* build the tables used by the ctype macros */
  853.       _ct_init("");
  854.   
  855. ! #if MSDOS || TOS
  856.       argv = wildexpand(&argc, argv);
  857.   #endif
  858.   
  859. --- 771,777 ----
  860.       /* build the tables used by the ctype macros */
  861.       _ct_init("");
  862.   
  863. ! #if MSDOS || TOS || MINT
  864.       argv = wildexpand(&argc, argv);
  865.   #endif
  866.   
  867. ***************
  868. *** 845,851 ****
  869.       /*NOTREACHED*/
  870.   }
  871.   
  872. ! #if MSDOS || TOS
  873.   # define WILDCARD_NO_MAIN
  874.   # include "wildcard.c"
  875.   #endif
  876. --- 845,851 ----
  877.       /*NOTREACHED*/
  878.   }
  879.   
  880. ! #if MSDOS || TOS || MINT
  881.   # define WILDCARD_NO_MAIN
  882.   # include "wildcard.c"
  883.   #endif
  884. diff -c ./curses.c ../src/curses.c
  885. *** ./curses.c    Tue May 12 14:18:56 1992
  886. --- ../src/curses.c    Wed May 13 18:28:26 1992
  887. ***************
  888. *** 38,43 ****
  889. --- 38,46 ----
  890.   #if TOS
  891.   # include    <osbind.h>
  892.   #endif
  893. + #if MINT
  894. + # include    <ioctl.h>
  895. + #endif
  896.   
  897.   #if OSK
  898.   # include    <sgstat.h>
  899. ***************
  900. *** 206,212 ****
  901.       if (!termtype)
  902.   #endif
  903.       {
  904. ! #if ANY_UNIX
  905.           write(2, "Environment variable TERM must be set\n", (unsigned)38);
  906.           exit(2);
  907.   #endif
  908. --- 209,215 ----
  909.       if (!termtype)
  910.   #endif
  911.       {
  912. ! #if ANY_UNIX || MINT
  913.           write(2, "Environment variable TERM must be set\n", (unsigned)38);
  914.           exit(2);
  915.   #endif
  916. ***************
  917. *** 276,284 ****
  918.   #endif
  919.   }
  920.   
  921.   static int curses_active = FALSE;
  922.   
  923.   /* Send any required termination strings.  Turn off "raw" mode. */
  924.   void suspend_curses()
  925.   {
  926. --- 279,288 ----
  927.   #endif
  928.   }
  929.   
  930.   static int curses_active = FALSE;
  931.   
  932. + extern int oldcurs;
  933.   /* Send any required termination strings.  Turn off "raw" mode. */
  934.   void suspend_curses()
  935.   {
  936. ***************
  937. *** 292,297 ****
  938. --- 296,302 ----
  939.       if (has_CQ)
  940.       {
  941.           do_CQ();
  942. +         oldcurs = 0;
  943.       }
  944.   #endif
  945.       if (has_TE)                    /* GB */
  946. ***************
  947. *** 726,731 ****
  948. --- 731,740 ----
  949.   
  950.   }
  951.   
  952. + #if MINT
  953. + extern int __mint;
  954. + int got_winch;
  955. + #endif
  956.   
  957.   /* This function gets the window size.  It uses the TIOCGWINSZ ioctl call if
  958.    * your system has it, or tgetnum("li") and tgetnum("co") if it doesn't.
  959. ***************
  960. *** 743,755 ****
  961. --- 752,780 ----
  962.   
  963.   #ifdef SIGWINCH
  964.       /* reset the signal vector */
  965. + # if __GNUC__
  966. +     signal(SIGWINCH, (void(*)()) getsize);
  967. + # else
  968.       signal(SIGWINCH, getsize);
  969. + # endif
  970.   #endif
  971.   
  972.       /* get the window size, one way or another. */
  973.       lines = cols = 0;
  974.   #ifdef TIOCGWINSZ
  975. + # if !MINT
  976.       if (ioctl(2, TIOCGWINSZ, &size) >= 0)
  977. + # else
  978. +     if (signo)
  979. +         got_winch = 1;
  980. +     /* only MiNT versions >= 0.9 know TIOCGWINSZ; for older versions
  981. +        and when running under vanilla TOS mntlib would return the
  982. +        settings of the ST BIOS screeen driver, and that at least
  983. +        doesn't help when we're not running on the console.  -nox */
  984. +     if (__mint >= 9 && ioctl(2, TIOCGWINSZ, &size) >= 0)
  985. + # endif
  986.       {
  987.           lines = size.ws_row;
  988.           cols = size.ws_col;
  989. diff -c ./curses.h ../src/curses.h
  990. *** ./curses.h    Tue May 12 14:18:56 1992
  991. --- ../src/curses.h    Wed May 13 18:28:30 1992
  992. ***************
  993. *** 205,215 ****
  994.   #define    do_TI()        VOIDBIOS(;, (void)ttywrite(TI, (unsigned)strlen(TI)))
  995.   #define    do_TE()        VOIDBIOS(;, (void)ttywrite(TE, (unsigned)strlen(TE)))
  996.   #ifndef NO_CURSORSHAPE
  997. ! # define do_CQ()    VOIDBIOS(v_cs(), tputs(CQ, 1, faddch))
  998. ! # define do_CX()    VOIDBIOS(v_cs(), tputs(CX, 1, faddch))
  999. ! # define do_CV()    VOIDBIOS(v_cs(), tputs(CV, 1, faddch))
  1000. ! # define do_CI()    VOIDBIOS(v_cb(), tputs(CI, 1, faddch))
  1001. ! # define do_CR()    VOIDBIOS(v_cb(), tputs(CR, 1, faddch))
  1002.   #endif
  1003.   #ifndef NO_COLOR
  1004.   # define do_aend()    VOIDBIOS((vmode=A_NORMAL), endcolor())
  1005. --- 205,223 ----
  1006.   #define    do_TI()        VOIDBIOS(;, (void)ttywrite(TI, (unsigned)strlen(TI)))
  1007.   #define    do_TE()        VOIDBIOS(;, (void)ttywrite(TE, (unsigned)strlen(TE)))
  1008.   #ifndef NO_CURSORSHAPE
  1009. ! # if MINT /* ctputs() knows about #blink / #noblink and calling ST BIOS... */
  1010. ! #  define do_CQ()    VOIDBIOS(v_cs(), ctputs(CQ, 1, faddch))
  1011. ! #  define do_CX()    VOIDBIOS(v_cs(), ctputs(CX, 1, faddch))
  1012. ! #  define do_CV()    VOIDBIOS(v_cs(), ctputs(CV, 1, faddch))
  1013. ! #  define do_CI()    VOIDBIOS(v_cb(), ctputs(CI, 1, faddch))
  1014. ! #  define do_CR()    VOIDBIOS(v_cb(), ctputs(CR, 1, faddch))
  1015. ! # else
  1016. ! #  define do_CQ()    VOIDBIOS(v_cs(), tputs(CQ, 1, faddch))
  1017. ! #  define do_CX()    VOIDBIOS(v_cs(), tputs(CX, 1, faddch))
  1018. ! #  define do_CV()    VOIDBIOS(v_cs(), tputs(CV, 1, faddch))
  1019. ! #  define do_CI()    VOIDBIOS(v_cb(), tputs(CI, 1, faddch))
  1020. ! #  define do_CR()    VOIDBIOS(v_cb(), tputs(CR, 1, faddch))
  1021. ! # endif
  1022.   #endif
  1023.   #ifndef NO_COLOR
  1024.   # define do_aend()    VOIDBIOS((vmode=A_NORMAL), endcolor())
  1025. diff -c ./cut.c ../src/cut.c
  1026. *** ./cut.c    Tue May 12 14:18:56 1992
  1027. --- ../src/cut.c    Wed May 13 18:28:34 1992
  1028. ***************
  1029. *** 117,123 ****
  1030.       /* if nobody else needs it, then discard the tmp file */
  1031.       if (i < 0)
  1032.       {
  1033. ! #if MSDOS || TOS
  1034.           strcpy(cutfname, o_directory);
  1035.           if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i - 1]))
  1036.               cutfname[i++] = SLASH;
  1037. --- 117,123 ----
  1038.       /* if nobody else needs it, then discard the tmp file */
  1039.       if (i < 0)
  1040.       {
  1041. ! #if MSDOS || TOS || MINT
  1042.           strcpy(cutfname, o_directory);
  1043.           if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i - 1]))
  1044.               cutfname[i++] = SLASH;
  1045. ***************
  1046. *** 424,430 ****
  1047.   {
  1048.       char        cutfname[50];/* name of an old temp file */
  1049.       int        fd;    /* either tmpfd or the result of open() */
  1050. ! #if MSDOS || TOS
  1051.       int        i;
  1052.   #endif
  1053.   
  1054. --- 424,430 ----
  1055.   {
  1056.       char        cutfname[50];/* name of an old temp file */
  1057.       int        fd;    /* either tmpfd or the result of open() */
  1058. ! #if MSDOS || TOS || MINT
  1059.       int        i;
  1060.   #endif
  1061.   
  1062. ***************
  1063. *** 435,441 ****
  1064.       }
  1065.       else
  1066.       {
  1067. ! #if MSDOS || TOS
  1068.           strcpy(cutfname, o_directory);
  1069.           if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i-1]))
  1070.               cutfname[i++]=SLASH;
  1071. --- 435,441 ----
  1072.       }
  1073.       else
  1074.       {
  1075. ! #if MSDOS || TOS || MINT
  1076.           strcpy(cutfname, o_directory);
  1077.           if ((i = strlen(cutfname)) && !strchr(":/\\", cutfname[i-1]))
  1078.               cutfname[i++]=SLASH;
  1079. diff -c ./elvprsv.c ../src/elvprsv.c
  1080. *** ./elvprsv.c    Tue May 12 14:18:58 1992
  1081. --- ../src/elvprsv.c    Wed May 13 18:28:38 1992
  1082. ***************
  1083. *** 71,77 ****
  1084.   # include "prsvunix.c"
  1085.   #endif
  1086.   
  1087. ! #if MSDOS || TOS
  1088.   # include "prsvdos.c"
  1089.   # define WILDCARD_NO_MAIN
  1090.   # include "wildcard.c"
  1091. --- 71,77 ----
  1092.   # include "prsvunix.c"
  1093.   #endif
  1094.   
  1095. ! #if MSDOS || TOS || MINT
  1096.   # include "prsvdos.c"
  1097.   # define WILDCARD_NO_MAIN
  1098.   # include "wildcard.c"
  1099. ***************
  1100. *** 256,264 ****
  1101.       int    i;
  1102.       char    *when = "the editor went away";
  1103.   
  1104. ! #if MSDOS || TOS
  1105. !     /* expand any wildcards in the command line */
  1106.       _ct_init("");
  1107.       argv = wildexpand(&argc, argv);
  1108.   #endif
  1109.   
  1110. --- 256,264 ----
  1111.       int    i;
  1112.       char    *when = "the editor went away";
  1113.   
  1114. ! #if MSDOS || TOS || MINT
  1115.       _ct_init("");
  1116. +     /* expand any wildcards in the command line */
  1117.       argv = wildexpand(&argc, argv);
  1118.   #endif
  1119.   
  1120. ***************
  1121. *** 291,294 ****
  1122. --- 291,295 ----
  1123.           preserve(argv[i], when);
  1124.           i++;
  1125.       }
  1126. +     exit(0);
  1127.   }
  1128. diff -c ./elvrec.c ../src/elvrec.c
  1129. *** ./elvrec.c    Tue May 12 14:18:58 1992
  1130. --- ../src/elvrec.c    Wed May 13 22:10:18 1992
  1131. ***************
  1132. *** 18,23 ****
  1133. --- 18,27 ----
  1134.   void main P_((int, char **));
  1135.   
  1136.   
  1137. + #if MINT
  1138. + extern    int __mint;
  1139. + #endif
  1140.   void recover(basename, outname)
  1141.       char    *basename;    /* the name of the file to recover */
  1142.       char    *outname;    /* the name of the file to write to */
  1143. ***************
  1144. *** 36,53 ****
  1145.       if (basename)
  1146.       {
  1147.   #ifndef CRUNCH
  1148. ! # if MSDOS || TOS
  1149.           if (!basename[0] || basename[1] != ':')
  1150.   # else
  1151.           if (basename[0] != SLASH)
  1152.   # endif
  1153.           {
  1154. !             ptr = getcwd(pathname, sizeof pathname);
  1155.               if (ptr != pathname)
  1156.               {
  1157.                   strcpy(pathname, ptr);
  1158.               }
  1159.               ptr = pathname + strlen(pathname);
  1160.               *ptr++ = SLASH;
  1161.               strcpy(ptr, basename);
  1162.           }
  1163. --- 40,62 ----
  1164.       if (basename)
  1165.       {
  1166.   #ifndef CRUNCH
  1167. ! # if MSDOS || TOS || MINT
  1168.           if (!basename[0] || basename[1] != ':')
  1169.   # else
  1170.           if (basename[0] != SLASH)
  1171.   # endif
  1172.           {
  1173. !             ptr = getcwd(pathname, (int) sizeof pathname);
  1174.               if (ptr != pathname)
  1175.               {
  1176.                   strcpy(pathname, ptr);
  1177.               }
  1178.               ptr = pathname + strlen(pathname);
  1179. + #if MINT
  1180. +             if (__mint && (*basename == '/' || *basename == '\\') &&
  1181. +                 (*pathname | 0x20) == 'u' && pathname[1] == ':')
  1182. +                 ptr = pathname;
  1183. + #endif
  1184.               *ptr++ = SLASH;
  1185.               strcpy(ptr, basename);
  1186.           }
  1187. ***************
  1188. *** 159,164 ****
  1189. --- 168,178 ----
  1190.   #if OSK
  1191.       fclose(from);
  1192.       setuid(0);
  1193. + #endif
  1194. + #if TOS || MINT
  1195. +     /* GEMDOS doesn't know how to unlink a file thats still open...
  1196. +      *  it might just trash the filesystem instead :-(  -nox */
  1197. +     fclose(from);
  1198.   #endif
  1199.       /* delete the /usr/preserve file */
  1200.       unlink(line);
  1201. diff -c ./ex.c ../src/ex.c
  1202. *** ./ex.c    Tue May 12 14:18:58 1992
  1203. --- ../src/ex.c    Sun Aug  9 23:05:02 1992
  1204. ***************
  1205. *** 301,309 ****
  1206.       {
  1207.           /* read a line */
  1208.   #ifdef CRUNCH
  1209. !         cmdlen = vgets(':', cmdbuf, sizeof(cmdbuf));
  1210.   #else
  1211. !         cmdlen = vgets(*o_prompt ? ':' : '\0', cmdbuf, sizeof(cmdbuf));
  1212.   #endif
  1213.           if (cmdlen < 0)
  1214.           {
  1215. --- 301,309 ----
  1216.       {
  1217.           /* read a line */
  1218.   #ifdef CRUNCH
  1219. !         cmdlen = vgets(':', cmdbuf, (int) sizeof(cmdbuf));
  1220.   #else
  1221. !         cmdlen = vgets(*o_prompt ? ':' : '\0', cmdbuf, (int) sizeof(cmdbuf));
  1222.   #endif
  1223.           if (cmdlen < 0)
  1224.           {
  1225. ***************
  1226. *** 665,670 ****
  1227. --- 665,672 ----
  1228.       int    len;        /* length of the ".exrc" file */
  1229.   
  1230.   #ifdef CRUNCH
  1231. + #undef TINYSTACK
  1232. + #define TINYSTACK 0
  1233.       /* small address space - we need to conserve space */
  1234.   
  1235.       /* !!! kludge: we use U_text as the buffer.  This has the side-effect
  1236. ***************
  1237. *** 675,684 ****
  1238. --- 677,695 ----
  1239.   # if TINYSTACK
  1240.       /* small stack - we need to conserve space */
  1241.   
  1242. + #  if TOS || MINT
  1243. +     /* TOS too has a limited stack, but enuf space on heap...  -nox */
  1244. +     char *U_text = malloc(4096);
  1245. +     if (!U_text)
  1246. +         /* ...well, usually. :-) */
  1247. +         return 0;
  1248. + #  else
  1249.       /* !!! kludge: we use U_text as the buffer.  This has the side-effect
  1250.        * of interfering with the shift-U visual command.  Disable shift-U.
  1251.        */
  1252.       U_line = 0L;
  1253. + #  endif
  1254.   # else
  1255.       /* This is how we would *like* to do it -- with a large buffer on the
  1256.        * stack, so we can handle large .exrc files and also recursion.
  1257. ***************
  1258. *** 693,704 ****
  1259. --- 704,722 ----
  1260.       {
  1261.           return 0;
  1262.       }
  1263. + #if TINYSTACK && (TOS || MINT)
  1264. +     len = tread(fd, U_text, 4096);
  1265. + #else
  1266.       len = tread(fd, U_text, sizeof U_text);
  1267. + #endif
  1268.       close(fd);
  1269.   
  1270.       /* execute the string */
  1271.       exstring(U_text, len, ctrl('V'));
  1272.   
  1273. + #if TINYSTACK && (TOS || MINT)
  1274. +     free(U_text);
  1275. + #endif
  1276.       return 1;
  1277.   }
  1278.   
  1279. diff -c ./input.c ../src/input.c
  1280. *** ./input.c    Tue May 12 14:19:00 1992
  1281. --- ../src/input.c    Wed May 13 21:11:16 1992
  1282. ***************
  1283. *** 338,344 ****
  1284. --- 338,349 ----
  1285.               key[0] = getkey(when);
  1286.   #endif
  1287.   #ifndef NO_VISIBLE
  1288. + #if 0
  1289. +             /* hmm :-)  -nox */
  1290.               if (key[0] != '\0' && V_from != MARK_UNSET)
  1291. + #else
  1292. +             if (*key && *key != ctrl('O') && V_from != MARK_UNSET)
  1293. + #endif
  1294.               {
  1295.                   msg("Can't modify text during a selection");
  1296.                   beep();
  1297. ***************
  1298. *** 575,581 ****
  1299. --- 580,591 ----
  1300.                   if (m != cursor)
  1301.                   {
  1302.                       m = adjmove(cursor, m, (*key == 'j' || *key == 'k' ? NCOL|FINL : FINL));
  1303. + #if 0
  1304. +                     /* try typing characters after <cursor right> on an empty line :-)  -nox */
  1305.                       if (*key == '$' || (*key == 'l' && m <= cursor))
  1306. + #else
  1307. +                     if (plen && (*key == '$' || (*key == 'l' && m <= cursor)))
  1308. + #endif
  1309.                       {
  1310.                           m++;
  1311.                       }
  1312. diff -c ./main.c ../src/main.c
  1313. *** ./main.c    Tue May 12 14:19:00 1992
  1314. --- ../src/main.c    Wed May 13 18:28:54 1992
  1315. ***************
  1316. *** 28,33 ****
  1317. --- 28,37 ----
  1318.   static init_digraphs();
  1319.   #endif
  1320.   
  1321. + #if MINT
  1322. + extern int    __mint;
  1323. + #endif
  1324.   /*---------------------------------------------------------------------*/
  1325.   
  1326.   #if AMIGA
  1327. ***************
  1328. *** 50,57 ****
  1329. --- 54,74 ----
  1330.       char    *str;
  1331.       char    *tag = (char *)0;
  1332.   
  1333. + #if MINT
  1334. +     if (!__mint && isatty(0))
  1335. +         *o_stbios = 1;
  1336. +     /* see if that helps against those strange redraw problems...  -nox */
  1337. +     _malloczero(1);
  1338. + #endif
  1339.       /* set mode to MODE_VI or MODE_EX depending on program name */
  1340. + #if TOS || MINT
  1341. +     /* some TOS shells know nothing about argv[0]...  -nox */
  1342. +     switch (**argv ? argv[0][strlen(argv[0]) - 1] : 's')
  1343. + #else
  1344.       switch (argv[0][strlen(argv[0]) - 1])
  1345. + #endif
  1346.       {
  1347.         case 'x':            /* "ex" */
  1348.           mode = MODE_EX;
  1349. ***************
  1350. *** 92,108 ****
  1351.       signal(SIGHUP, (void(*)()) deathtrap);
  1352.   # endif
  1353.   # ifndef DEBUG
  1354. ! #  ifdef SIGILL
  1355.       signal(SIGILL, (void(*)()) deathtrap);
  1356. ! #  endif
  1357. ! #  ifdef SIGBUS
  1358.       signal(SIGBUS, (void(*)()) deathtrap);
  1359. ! #  endif
  1360. ! #  ifdef SIGSEGV
  1361.       signal(SIGSEGV, (void(*)()) deathtrap);
  1362. ! #  endif
  1363. ! #  ifdef SIGSYS
  1364.       signal(SIGSYS, (void(*)()) deathtrap);
  1365.   #  endif
  1366.   # endif /* !DEBUG */
  1367.   # ifdef SIGPIPE
  1368. --- 109,129 ----
  1369.       signal(SIGHUP, (void(*)()) deathtrap);
  1370.   # endif
  1371.   # ifndef DEBUG
  1372. ! #  if !MINT
  1373. !     /* MiNT doesn't have memory protection, so trying to preserve files
  1374. !        after one of these would be a bit risky...  */
  1375. ! #   ifdef SIGILL
  1376.       signal(SIGILL, (void(*)()) deathtrap);
  1377. ! #   endif
  1378. ! #   ifdef SIGBUS
  1379.       signal(SIGBUS, (void(*)()) deathtrap);
  1380. ! #   endif
  1381. ! #   ifdef SIGSEGV
  1382.       signal(SIGSEGV, (void(*)()) deathtrap);
  1383. ! #   endif
  1384. ! #   ifdef SIGSYS
  1385.       signal(SIGSYS, (void(*)()) deathtrap);
  1386. + #   endif
  1387.   #  endif
  1388.   # endif /* !DEBUG */
  1389.   # ifdef SIGPIPE
  1390. ***************
  1391. *** 171,176 ****
  1392. --- 192,208 ----
  1393.       }
  1394.   # endif
  1395.   #endif
  1396. + #if MINT
  1397. +     if (!strcmp(has_KL, "#K") && !strcmp(has_KR, "#M")) {
  1398. +         *o_keytime = 1;
  1399. +         mapkey("#a", "u", WHEN_VICMD|WHEN_INMV,    "<Undo>");
  1400. +         mapkey("#b", "\\", WHEN_VICMD|WHEN_INMV, "<Help>");
  1401. +         mapkey("#s", "B", WHEN_VICMD|WHEN_INMV,    "^<Left>");
  1402. +         mapkey("#t", "W", WHEN_VICMD|WHEN_INMV,    "^<Right>");
  1403. +         mapkey("#7", "v", WHEN_VICMD|WHEN_INMV,    "sh-<Insrt>");
  1404. +     }
  1405. + #endif
  1406.   
  1407.   #ifndef NO_DIGRAPH
  1408.       init_digraphs();
  1409. ***************
  1410. *** 286,292 ****
  1411.               strcat(args, " ");
  1412.               strcat(args, argv[i]);
  1413.           }
  1414. ! #if MSDOS || TOS
  1415.           /* expand wildcard characters, if necessary */
  1416.           if (strchr(args, '*') || strchr(args, '?'))
  1417.           {
  1418. --- 318,324 ----
  1419.               strcat(args, " ");
  1420.               strcat(args, argv[i]);
  1421.           }
  1422. ! #if MSDOS || TOS || MINT
  1423.           /* expand wildcard characters, if necessary */
  1424.           if (strchr(args, '*') || strchr(args, '?'))
  1425.           {
  1426. ***************
  1427. *** 338,344 ****
  1428.       str = getenv(EXINIT);
  1429.       if (str)
  1430.       {
  1431. !         exstring(str, strlen(str), ctrl('V'));
  1432.       }
  1433.   #endif
  1434.   
  1435. --- 370,376 ----
  1436.       str = getenv(EXINIT);
  1437.       if (str)
  1438.       {
  1439. !         exstring(str, (int) strlen(str), ctrl('V'));
  1440.       }
  1441.   #endif
  1442.   
  1443. diff -c ./makefile ../src/makefile
  1444. *** ./makefile    Mon Aug 10 00:30:22 1992
  1445. --- ../src/makefile    Sun Aug  9 21:16:50 1992
  1446. ***************
  1447. *** 0 ****
  1448. --- 1,741 ----
  1449. + # combined Makefile for ELVIS - a clone of `vi`
  1450. + #
  1451. + # After editing this Makefile as described below, you should...
  1452. + #
  1453. + # Use `make` to compile all programs
  1454. + # Use `make install` to copy the programs to the BIN directory
  1455. + # Use `make clean` to remove all object files
  1456. + # Use `make clobber` to remove everything except source & documentation
  1457. + # Use `make uue` to produce uuencoded compressed tar archives of the source
  1458. + # Use `make sh` to produce shar archives of the source
  1459. + #
  1460. + # Several groups of Makefile settings are included below.  Choose *ONE* group
  1461. + # of settings for your particular system, and leave the others commented out.
  1462. + # The meanings of these settings are:
  1463. + #    OBJ    the filename extension for unlinked object files -- usually .o
  1464. + #    EXE    filename extension for elvis executable file -- .exe, .tpp or null
  1465. + #    COM    filename extension for executable support files -- .com, .tpp or null
  1466. + #    EXTRA    version-specific object files used in elvis
  1467. + #    EXTRA2    version-specific object files used in elvis & elvrec
  1468. + #    LIBS    any special libraries, such as "-ltermcap"
  1469. + #    BIN    directory where executables should be installed
  1470. + #    CC    the C compiler command, possibly with "memory model" flags
  1471. + #    CFLAGS    compiler flags used to select compile-time options
  1472. + #    LNK    the linker command needed to link OBJ files (if not cc)
  1473. + #    LFLAGS    linker flags used to select link-time options
  1474. + #    SMALL    flag for special small memory model compilation -- usually null
  1475. + #    OF    link flag to control the output file's name -- usually -o<space>
  1476. + #    RF    flag used to denote "compile but don't link" -- usually -c
  1477. + #    PROGS    the list of all programs
  1478. + #    CHMEM    any extra commands to be run after ELVIS is linked
  1479. + #    SORT    if the "tags" file must be sorted, then SORT=-DSORT
  1480. + #    RM    the name of a program that deletes files
  1481. + #    CP    name of a program that copies files -- copy or cp, usually
  1482. + #    SYS    type of system & compiler: unx/tos/os9/dos (maybe vms?)
  1483. + #    DUMMY    usually nothing, but OS9 needs "dummy"
  1484. + #    CFG    name of compiler configuration file -- usually null
  1485. + #---- These settings are recommended for System-V UNIX and SCO XENIX-386 ----
  1486. + #OBJ=    .o
  1487. + #EXE=
  1488. + #COM=
  1489. + #EXTRA=    unix$(OBJ)
  1490. + #EXTRA2=
  1491. + #LIBS=    -lterm
  1492. + #BIN=    /usr/local/bin
  1493. + #CC=    cc
  1494. + #CFLAGS=    -DM_SYSV -O -DNO_SHIFT_FKEYS
  1495. + #SMALL=
  1496. + #OF=    -o ""
  1497. + #RF=    -c
  1498. + #EVAL=    eval
  1499. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
  1500. + #    elvprsv$(COM)
  1501. + #CHMEM=
  1502. + #SORT=    -DSORT
  1503. + #RM=    rm -f
  1504. + #CP=    cp
  1505. + #SYS=    unx
  1506. + #DUMMY=
  1507. + #CFG=
  1508. + #---- These settings are recommended for SCO XENIX-286 ----
  1509. + #OBJ=    .o
  1510. + #EXE=
  1511. + #COM=
  1512. + #EXTRA=    unix$(OBJ)
  1513. + #EXTRA2=
  1514. + #LIBS=    -ltcap
  1515. + #BIN=    /usr/local/bin
  1516. + #CC=    cc -M2m -i
  1517. + #CFLAGS=    -Ox -DCS_IBMPC
  1518. + #SMALL=
  1519. + #OF=    -o ""
  1520. + #RF=    -c
  1521. + #EVAL=    eval
  1522. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
  1523. + #    elvprsv$(COM)
  1524. + #CHMEM=
  1525. + #SORT=    -DSORT
  1526. + #RM=    rm -f
  1527. + #CP=    cp
  1528. + #SYS=    unx
  1529. + #DUMMY=
  1530. + #CFG=    
  1531. + #---- These settings are recommended for BSD 4.3 UNIX and SunOS ----
  1532. + #OBJ=    .o
  1533. + #EXE=    
  1534. + #COM=    
  1535. + #EXTRA=    unix$(OBJ)
  1536. + #EXTRA2=
  1537. + #LIBS=    -ltermcap
  1538. + #BIN=    /usr/local/bin
  1539. + #CC=    cc
  1540. + #CFLAGS=    -Dbsd -O
  1541. + #SMALL=
  1542. + #OF=    -o ""
  1543. + #RF=    -c
  1544. + #EVAL=    eval
  1545. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) elvprsv$(COM)
  1546. + #CHMEM=
  1547. + #SORT=    -DSORT
  1548. + #RM=    rm -f
  1549. + #CP=    cp
  1550. + #SYS=    unx
  1551. + #DUMMY=
  1552. + #CFG=
  1553. + #---- These settings are recommended for Coherent ----
  1554. + #OBJ=.o
  1555. + #EXE=
  1556. + #COM=
  1557. + #EXTRA=    unix$(OBJ) tinyprnt$(OBJ)
  1558. + #EXTRA2=
  1559. + #LIBS=    -lterm
  1560. + #BIN=    /usr/bin
  1561. + #CC=    cc
  1562. + #CFLAGS=    -O -DCOHERENT -VSUVAR -DCRUNCH -DNO_CHARATTR -DNO_CURSORSHAPE \
  1563. + #    -DNO_DIGRAPH -DNO_MKEXRC -DNO_POPUP -DNO_FKEYS -DNO_ABBR
  1564. + #SMALL=
  1565. + #OF=    -o ""
  1566. + #RF=    -c
  1567. + #EVAL=    eval
  1568. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
  1569. + #    elvprsv$(COM)
  1570. + #CHMEM=    fixstack 2000 elvis$(EXE)
  1571. + #SORT=
  1572. + #RM=    rm -f
  1573. + #CP=    cp
  1574. + #SYS=    unx
  1575. + #DUMMY=
  1576. + #CFG=
  1577. + #---- These settings are recommended for Minix-ST ----
  1578. + #OBJ=    .o
  1579. + #EXE=
  1580. + #COM=
  1581. + #EXTRA=    unix$(OBJ)
  1582. + #EXTRA2=
  1583. + #LIBS=
  1584. + #BIN=    /usr/bin
  1585. + #CC=    cc
  1586. + ##CC=    gcc -s
  1587. + #CFLAGS=
  1588. + #SMALL=
  1589. + #OF=    -o ""
  1590. + #RF=    -c
  1591. + #EVAL=    eval
  1592. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
  1593. + #    elvprsv$(COM)
  1594. + #CHMEM=    chmem =18000 elvis$(EXE)
  1595. + #SORT=
  1596. + #RM=    rm -f
  1597. + #CP=    cp
  1598. + #SYS=    unx
  1599. + #DUMMY=
  1600. + #CFG=
  1601. + #---- These settings are recommended for Minix-PC ----
  1602. + #OBJ=    .s
  1603. + #EXE=
  1604. + #COM=
  1605. + #EXTRA=    tinytcap$(OBJ) unix$(OBJ) tinyprnt$(OBJ)
  1606. + #EXTRA2=
  1607. + #LIBS=
  1608. + #BIN=    /usr/bin
  1609. + #CC=    cc -i
  1610. + #CFLAGS=    -O -DCRUNCH \
  1611. + #    -DNO_MKEXRC -DNO_CURSORSHAPE -DNO_CHARATTR -DNO_SHOWMODE \
  1612. + #    -DNO_MODELINE -DNO_OPTCOLS -DNO_DIGRAPH -DNO_EXTENSIONS \
  1613. + #    -DNO_ERRLIST -DNO_FKEY -DNO_VISIBLE -DNO_COLOR -DNO_POPUP
  1614. + ###(not -NO_AT -DNO_SENTENCE -DNO_ABBR -DNO_RECYCLE -DNO_MAGIC -DNO_CHARSEARCH)
  1615. + #SMALL=
  1616. + #OF=    -o ""
  1617. + #RF=    -c
  1618. + #EVAL=    eval
  1619. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) \
  1620. + #    elvprsv$(COM)
  1621. + #CHMEM=
  1622. + #SORT=
  1623. + #RM=    rm -f
  1624. + #CP=    cp
  1625. + #SYS=    unx
  1626. + #DUMMY=
  1627. + #CFG=
  1628. + #---- These settings are recommended for Amiga port done using Aztec 5.2b ----
  1629. + #    For AmigaDOS 2.04, you're all set! Its the default target!
  1630. + #OBJ=    .o
  1631. + #EXE=
  1632. + #COM=
  1633. + #EXTRA=    amiga$(OBJ) amitty$(OBJ) amisysio$(OBJ)
  1634. + #EXTRA2= tinytcap$(OBJ)
  1635. + #LIBS=    -lc
  1636. + #BIN=    sys:utilities
  1637. + #CC=    cc
  1638. + #CFLAGS=    -sob -Damiga
  1639. + #LNK=    ln
  1640. + #LFLAGS=
  1641. + #SMALL=
  1642. + #OF=    -o 
  1643. + #RF=
  1644. + #EVAL=
  1645. + #PROGS1=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) fmt$(COM) 
  1646. + #PROGS2=    elvprsv$(COM) ex$(COM) vi$(COM) view$(COM) input$(COM)
  1647. + #PROGS=    $(PROGS1) $(PROGS2)
  1648. + #CHMEM=
  1649. + #SORT=
  1650. + #RM=    delete
  1651. + #CP=    copy
  1652. + #SYS=    ami
  1653. + #DUMMY=
  1654. + #CFG=
  1655. + #---- These settings are recommended for MS-DOS + MS-C + NDMAKE ----
  1656. + #OBJ=    .obj
  1657. + #EXE=    .exe
  1658. + #COM=    .exe    # .com might work, try it
  1659. + #EXTRA=    pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
  1660. + #EXTRA2=
  1661. + #LIBS=
  1662. + #BIN=    c:\dos
  1663. + #CC=    cl
  1664. + #CFLAGS=    -O -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS
  1665. + #SMALL= /AM
  1666. + #OF=    -o 
  1667. + #RF=    -c
  1668. + #EVAL=
  1669. + #PROGS1=    elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
  1670. + #PROGS2=    wildcard$(COM) fmt$(COM) elvprsv$(COM)
  1671. + #PROGS=    $(PROGS1) $(PROGS2)
  1672. + #CHMEM=
  1673. + #SORT=
  1674. + #RM=    del
  1675. + #CP=    copy
  1676. + #SYS=    dos
  1677. + #DUMMY=
  1678. + #CFG=
  1679. + ##---- These settings are recommended for MS-DOS + TURBO/BORLAND C ----
  1680. + ## CFG: name of the compiler config and response files
  1681. + ## TC_LIB & TC_INC: location of standard libraries and header files.
  1682. + #OBJ=    .obj
  1683. + #EXE=    .exe
  1684. + #COM=    .com
  1685. + #EXTRA=    pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
  1686. + #EXTRA2=
  1687. + #LIBS=@borland.rsp
  1688. + #BIN=    c:\bin
  1689. + #CFG=    borland.cfg borland.rsp
  1690. + #CC=    bcc
  1691. + #TC_LIB=    c:\bcc\lib
  1692. + #TC_INC=    c:\bcc\include
  1693. + #CFLAGS=    +borland.cfg
  1694. + ## uncomment next line iff using bcc, and you want to use pre-compiled headers
  1695. + #HDRS=    -H -H=borland.hdr
  1696. + ## uncomment next line to use med memory model for elvis
  1697. + ##CRNCH=    -DCRUNCH -mm
  1698. + #TC_CFLAGS1=    -ml -O -f- -w- -v -vi- -G- -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS
  1699. + #TC_CFLAGS2=    $(HDRS) $(CRNCH) -I$(TC_INC) -L$(TC_LIB)
  1700. + ## extra flags for compiling support programs
  1701. + #SMALL=    -mt -lt -H- -v-
  1702. + ## extra flags for linking elvis (strip symbols)
  1703. + #EFLAGS=    -v-
  1704. + #OF=    -e
  1705. + #RF=    -c
  1706. + #EVAL=
  1707. + #PROGS1=    elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
  1708. + #PROGS2=    wildcard$(COM) fmt$(COM) elvprsv$(COM)
  1709. + #PROGS=    $(PROGS1) $(PROGS2)
  1710. + #CHMEM=
  1711. + #SORT=
  1712. + #RM=    del
  1713. + #CP=    copy
  1714. + #SYS=    dos
  1715. + #DUMMY=
  1716. + ##source file compilation rule:
  1717. + #.c.obj:
  1718. + #    $(CC) $(CFLAGS) $(RF) {$< }
  1719. + #---- These settings can almost make DOS executables using the XENIX compiler
  1720. + #OBJ=    .o
  1721. + #EXE=    .exe
  1722. + #COM=    .exe    # .com might work, try it
  1723. + #EXTRA=    pc$(OBJ) sysdos$(OBJ) tinytcap$(OBJ)
  1724. + #EXTRA2=
  1725. + #LIBS=
  1726. + #BIN=    a:
  1727. + #CC=    cc -M2m -dos -F 4000
  1728. + #CFLAGS=    -O -DCS_IBMPC -DCS_SPECIAL -DINTERNAL_TAGS -Dvolatile= -Dconst=
  1729. + #SMALL=
  1730. + #OF=    -o ""
  1731. + #RF=    -c
  1732. + #EVAL=
  1733. + #PROGS1=    elvis$(EXE) ex$(COM) ctags$(COM) ref$(COM) elvrec$(COM)
  1734. + #PROGS2=    wildcard$(COM) fmt$(COM) elvprsv$(COM)
  1735. + #PROGS=    $(PROGS1) $(PROGS2)
  1736. + #CHMEM=
  1737. + #SORT=
  1738. + #RM=    rm -f
  1739. + #CP=    doscp -r
  1740. + #SYS=    xdos
  1741. + #DUMMY=
  1742. + #CFG=
  1743. + #--- These settings are recommended for Atari TOS + Mark Williams C or Gnu C ----
  1744. + #OBJ=    .o
  1745. + #EXE=    .ttp
  1746. + #COM=    .ttp
  1747. + #EXTRA=    sysdos$(OBJ) tinytcap$(OBJ)
  1748. + #EXTRA2=    atari$(OBJ)
  1749. + #LIBS=
  1750. + #BIN=    c:\ #
  1751. + #CC=    cc -VPEEP
  1752. + ##CC=    gcc -s
  1753. + #CFLAGS=    -O -DCS_IBMPC -DCS_SPECIAL
  1754. + #SMALL=
  1755. + #OF=    -o 
  1756. + #RF=    -c
  1757. + #EVAL=
  1758. + #PROGS=    elvis$(EXE) ctags$(COM) ref$(COM) elvrec$(COM) wildcard$(COM) \
  1759. + #    shell$(COM) fmt$(COM) elvprsv$(COM)
  1760. + #CHMEM=    @echo -n
  1761. + #SORT=
  1762. + #RM=    rm -f
  1763. + #CP=    copy
  1764. + #SYS=    tos
  1765. + #DUMMY=
  1766. + #CFG=
  1767. + #---- These settings are recommended for Atari TOS + gcc + MiNT libraries ----
  1768. + OBJ=.o
  1769. + EXE=.ttp
  1770. + COM=.ttp
  1771. + EXTRA=    sysdos$(OBJ) atari$(OBJ)
  1772. + EXTRA2=
  1773. + BIN=    c:\\bin
  1774. + CC=    gcc
  1775. + LIBS=    -ltermcap -liio
  1776. + LIBIIO=    -liio
  1777. + CFLAGS=    -O -Wall -fomit-frame-pointer -fcombine-regs -fstrength-reduce -DMINT -DCS_IBMPC -DCS_SPECIAL -DSMOOTHREDRAW
  1778. + SMALL=
  1779. + OF=    -o 
  1780. + RF=    -c
  1781. + MYNAME=    myname.c
  1782. + PROGS=    elvis$(EXE) ex$(COM) vi$(COM) view$(COM) input$(COM) \
  1783. +     ctags$(COM) ref$(COM) elvrec$(COM) wildcard$(COM) \
  1784. +     shell$(COM) fmt$(COM) elvprsv$(COM)
  1785. + CHMEM=    makefast elvis$(EXE) 
  1786. + SORT=
  1787. + RM=    rm -f
  1788. + CP=    cp
  1789. + SYS=    tos
  1790. + DUMMY=
  1791. + #---- These settings are recommended for OS-9/68K V2.3 ----
  1792. + #OBJ=    .r
  1793. + #EXE=
  1794. + #COM=
  1795. + #EXTRA=    tinyprnt$(OBJ)
  1796. + #EXTRA2=    osk$(OBJ)
  1797. + #LIBS=    -l=/dd/lib/termlib.l
  1798. + #BIN=    /dd/usr/cmds
  1799. + #CC=    cc
  1800. + #ODIR=    /dd/usr/src/elvis
  1801. + #CFLAGS=    -gq -m=2 -DNO_CURSORSHAPE
  1802. + #SMALL=
  1803. + #OF=    -f=$(ODIR)/
  1804. + #RF=    -r
  1805. + #EVAL=
  1806. + #PROGS=    elvis$(EXE) vi$(COM) view$(COM) input$(COM) ctags$(COM) ref$(COM) \
  1807. + #    elvrec$(COM) fmt$(COM) elvprsv$(COM)
  1808. + #PROGS1=
  1809. + #PROGS2=
  1810. + #CHMEM=    touch elvis$(EXE)
  1811. + #SORT=
  1812. + #RM=    del *.stb *.dbg
  1813. + #CP=    copy
  1814. + #SYS=    os9
  1815. + #DUMMY=    dummy
  1816. + #CFG=
  1817. + #TC_CFLAGS1=
  1818. + #TC_CFLAGS2=
  1819. + #EFLAGS=
  1820. + #LNK=
  1821. + #LFLAGS=
  1822. + ##---- These settings probably won't work for VAX/VMS, but they might ----
  1823. + #OBJ=    .obj
  1824. + #EXE=    .exe
  1825. + #COM=    .exe
  1826. + #EXTRA=    tinytcap$(OBJ)
  1827. + #EXTRA2=    vmsio$(OBJ)
  1828. + #LIBS=
  1829. + #BIN
  1830. + #CC=    cc
  1831. + #CFLAGS=    /define=NO_CURSORSHAPE /define=INTERNAL_TAGS
  1832. + #SMALL=
  1833. + #OF=    /exe=
  1834. + #RF=
  1835. + #PROGS=    elvis.exe elvprsv.exe elvrec.exe ctags.exe ref.exe
  1836. + #CHMEM=
  1837. + #SORT=
  1838. + #RM=    del
  1839. + #CP=    copy
  1840. + #SYS=    vms
  1841. + #DUMMY=    
  1842. + #CFG=    vmsopt.opt
  1843. + #
  1844. + ##compilation rules
  1845. + #.exe.c:
  1846. + #    $(CC) $<.c
  1847. + #    link $(OF)$<.exe,vmslink/opt
  1848. + #.obj.c:
  1849. + #    $(CC) $(CFLAGS) $<.c
  1850. + ###########################################################################
  1851. + ###########################################################################
  1852. + ###                                                                     ###
  1853. + ###     The rest of this Makefile contains no user-serviceable parts    ###
  1854. + ###                                                                     ###
  1855. + ###########################################################################
  1856. + ###########################################################################
  1857. + OBJS1=    blk$(OBJ) cmd1$(OBJ) cmd2$(OBJ) ctype$(OBJ) curses$(OBJ) cut$(OBJ)
  1858. + OBJS2=    ex$(OBJ) input$(OBJ) main$(OBJ) misc$(OBJ) modify$(OBJ) move1$(OBJ)
  1859. + OBJS3=    move2$(OBJ) move3$(OBJ) move4$(OBJ) move5$(OBJ) opts$(OBJ) recycle$(OBJ)
  1860. + OBJS4=    redraw$(OBJ) regexp$(OBJ) regsub$(OBJ) system$(OBJ) tio$(OBJ) tmp$(OBJ)
  1861. + OBJS5=    vars$(OBJ) vcmd$(OBJ) vi$(OBJ)
  1862. + OBJS=    $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5)
  1863. + ALIAS=    alias$(OBJ)
  1864. + SRC1=    Elvis.lnk Elvis.mak Elvis.prj Makefile.mix alias.c atari.c \
  1865. +     ctags.c pc.c ref.c shell.c sysdos.c myname.c
  1866. + SRC2=    elvrec.c wildcard.c fmt.c profile.sh osk.c osk.h elvprsv.c unix.c \
  1867. +     blk.c config.h
  1868. + SRC3=    cmd1.c cmd2.c curses.c
  1869. + SRC4=    curses.h cut.c ex.c input.c main.c misc.c
  1870. + SRC5=    modify.c move1.c move2.c move3.c move4.c move5.c opts.c recycle.c redraw.c
  1871. + SRC6=    regexp.c regexp.h regsub.c tinytcap.c tio.c tmp.c
  1872. + SRC7=    system.c vars.c vcmd.c vi.c vi.h tinyprnt.c
  1873. + SRC8=    ctype.c ctype.h borland.h novice.rc prsvdos.c prsvunix.c \
  1874. +     vmsbuild.com vmsio.c vmslink.opt vmsread.me vmssetup.com vmswild.c \
  1875. +     amiga.c amiprsv.c amistat.h amisysio.c amitty.c amiwild.c
  1876. + ###########################################################################
  1877. + all: $(PROGS)
  1878. +     @echo done.
  1879. + elvis$(EXE): linkelv.$(SYS)
  1880. +     @echo "elvis linked."
  1881. + ctags$(COM): $(CFG) ctags.c wildcard.c
  1882. +     $(CC) $(CFLAGS) $(SMALL) $(SORT) $(OF)ctags$(COM) ctags.c $(EXTRA2) $(LIBIIO)
  1883. + ref$(COM): $(CFG) ref.c
  1884. +     $(CC) $(CFLAGS) $(SMALL) $(OF)ref$(COM) ref.c $(LIBIIO)
  1885. + elvrec$(COM): $(CFG) elvrec.c
  1886. +     $(CC) $(CFLAGS) $(SMALL) $(OF)elvrec$(COM) elvrec.c $(EXTRA2) $(LIBIIO)
  1887. + ex$(COM): linkex.$(SYS)
  1888. +     @echo "ex done."
  1889. + vi$(COM): linkvi.$(SYS)
  1890. +     @echo "vi done."
  1891. + view$(COM): linkview.$(SYS)
  1892. +     @echo "view done."
  1893. + input$(COM): linkinput.$(SYS)
  1894. +     @echo "input done."
  1895. + shell$(COM): $(CFG) shell.c
  1896. +     $(CC) $(CFLAGS) $(SMALL) $(OF)shell$(COM) shell.c $(LIBIIO)
  1897. + wildcard$(COM): $(CFG) wildcard.c
  1898. +     $(CC) $(CFLAGS) $(SMALL) $(OF)wildcard$(COM) wildcard.c ctype$(OBJ) $(LIBIIO)
  1899. + fmt$(COM): $(CFG) fmt.c
  1900. +     $(CC) $(CFLAGS) $(SMALL) $(OF)fmt$(COM) fmt.c $(EXTRA2) $(LIBIIO)
  1901. + elvprsv$(COM): $(CFG) elvprsv.c amiprsv.c prsvunix.c prsvdos.c wildcard.c
  1902. +     $(CC) $(CFLAGS) $(SMALL) $(OF)elvprsv$(COM) elvprsv.c ctype$(OBJ) $(LIBIIO)
  1903. + ##############################################################################
  1904. + # "It all depends..."
  1905. + $(OBJS): vi.h curses.h config.h regexp.h ctype.h
  1906. + ##############################################################################
  1907. + # The way to link elvis is system dependent, and maybe compiler dependent too.
  1908. + # elvis executable compilation rule for: AmigaDOS
  1909. + linkelv.ami: $(OBJS) $(EXTRA) $(EXTRA2)
  1910. +     $(LNK) $(LFLAGS) $(OF)elvis$(EXE) $(OBJS) $(EXTRA) $(EXTRA2) $(LIBS)
  1911. +     $(CHMEM)
  1912. +     @touch $@
  1913. + # elvis executable compilation rule for: all unix, os9, tos, msc dos
  1914. + linkelv.unx linkelv.tos linkelv.os9 linkelv.cl: $(OBJS) $(EXTRA) $(EXTRA2)
  1915. +     $(CC) $(CFLAGS) $(OF)elvis$(EXE) $(OBJS) $(EXTRA) $(EXTRA2) $(LIBS)
  1916. +     $(CHMEM)
  1917. +     @touch $@
  1918. + linkelv.dos: linkelv.$(CC)
  1919. + # elvis executable compilation rule for: borland tcc, bcc
  1920. + linkelv.bcc linkelv.tcc: $(CFG) $(OBJS) $(EXTRA) $(EXTRA2)
  1921. +     $(CC) $(CFLAGS) $(LIBS)
  1922. +     @echo done > linkelv.$(CC)
  1923. + linkelv.vms: $(OBJS) $(EXTRA) $(EXTRA2)
  1924. +     link$(OF)elvis.exe main,$(CFG)/opt
  1925. + ##############################################################################
  1926. + # borland/turbo c config files
  1927. + borland.cfg: $(DUMMY)
  1928. +     echo $(TC_CFLAGS1)> borland.cfg
  1929. +     echo $(TC_CFLAGS2)>> borland.cfg
  1930. + borland.rsp: $(DUMMY)
  1931. +     echo $(EFLAGS) $(OF)elvis$(EXE) > borland.rsp
  1932. +     echo $(OBJS1)>> borland.rsp
  1933. +     echo $(OBJS2)>> borland.rsp
  1934. +     echo $(OBJS3)>> borland.rsp
  1935. +     echo $(OBJS4)>> borland.rsp
  1936. +     echo $(OBJS5)>> borland.rsp
  1937. +     echo $(EXTRA)>> borland.rsp
  1938. + ##############################################################################
  1939. + # elvis executable compilation rule for: AmigaDOS
  1940. + linkex.ami: alias.o
  1941. +     $(LNK) $(LFLAGS) $(OF)ex$(EXE) alias.o $(LIBS)
  1942. + linkex.unx linkex.xdos linkex.dos linkex.vms: $(CFG) alias.c
  1943. +     $(CC) $(CFLAGS) $(SMALL) $(OF)ex$(COM) alias.c
  1944. + linkex.tos: $(CFG) alias$(OBJ) $(MYNAME)
  1945. +     $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"ex\" $(OF)ex$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
  1946. +     @touch $@
  1947. + linkex.os9: $(DUMMY)
  1948. +     @echo done >/nil
  1949. + linkvi.ami linkvi.unx linkvi.xdos linkvi.dos linkvi.vms: ex$(COM)
  1950. +     $(CP) ex$(COM) vi$(COM)
  1951. + linkvi.tos: $(CFG) alias$(OBJ) $(MYNAME)
  1952. +     $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"vi\" $(OF)vi$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
  1953. +     @touch $@
  1954. + linkvi.os9: alias.r
  1955. +     $(CC) $(CFLAGS) $(OF)vi$(COM) alias.r
  1956. +     @touch $@
  1957. + linkview.ami linkview.unx linkview.xdos linkview.dos linkview.vms: ex$(COM)
  1958. +     $(CP) ex$(COM) view$(COM)
  1959. + linkview.tos: $(CFG) alias$(OBJ) $(MYNAME)
  1960. +     $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"view\" $(OF)view$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
  1961. +     @touch $@
  1962. + linkview.os9: alias.r
  1963. +     $(CC) $(CFLAGS) $(OF)view$(COM) alias.r
  1964. +     @touch $@
  1965. + linkinput.ami linkinput.unx linkinput.xdos linkinput.dos linkinput.vms: ex$(COM)
  1966. +     $(CP) ex$(COM) input$(COM)
  1967. + linkinput.tos: $(CFG) alias$(OBJ) $(MYNAME)
  1968. +     $(CC) $(CFLAGS) $(SMALL) -DMYNAME=\"input\" $(OF)input$(COM) alias$(OBJ) $(MYNAME) $(LIBIIO)
  1969. +     @touch $@
  1970. + linkinput.os9: alias.r
  1971. +     $(CC) $(CFLAGS) $(OF)input$(COM) alias.r
  1972. +     @touch $@
  1973. + ##############################################################################
  1974. + # installation is system-dependent
  1975. + install: $(PROGS) inst.$(SYS)
  1976. +     @echo Installation complete.
  1977. + inst.ami: $(DUMMY)
  1978. +     MakeDir $(BIN)/Elvis
  1979. +     Assign Elvis: $(BIN)/Elvis
  1980. +     $(CP) $(PROGS) Elvis:
  1981. +     @echo ::: YOU STILL NEED TO EDIT THE S:STARTUP-SEQUENCE FILE,
  1982. +     @echo ::: TO HAVE TEMP FILES PRESERVED AFTER A SYSTEM CRASH.
  1983. + inst.unx: $(DUMMY)
  1984. +     $(CP) $(PROGS) $(BIN)
  1985. +     (cd $(BIN); chmod 755 $(PROGS))
  1986. +     (cd $(BIN); chown bin $(PROGS))
  1987. +     (cd $(BIN); chown root elvprsv$(COM) elvrec$(COM))
  1988. +     (cd $(BIN); chmod 4755 elvprsv$(COM) elvrec$(COM))
  1989. +     -ln $(BIN)/elvis $(BIN)/vi
  1990. +     -ln $(BIN)/elvis $(BIN)/ex
  1991. +     -ln $(BIN)/elvis $(BIN)/view
  1992. +     -ln $(BIN)/elvis $(BIN)/input
  1993. +     @echo ::: YOU STILL NEED TO EDIT THE /ETC/RC FILE, OR WHATEVER,
  1994. +     @echo ::: TO HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
  1995. + inst.dos: $(DUMMY)
  1996. +     for %a in ($(PROGS1)) do copy %a $(BIN)
  1997. +     for %a in ($(PROGS2)) do copy %a $(BIN)
  1998. +     $(CP) $(BIN)\ex$(COM) $(BIN)\vi$(COM)
  1999. +     $(CP) $(BIN)\ex$(COM) $(BIN)\view$(COM)
  2000. +     $(CP) $(BIN)\ex$(COM) $(BIN)\input$(COM)
  2001. +     @echo ::: YOU STILL NEED TO EDIT YOUR AUTOEXEC.BAT FILE TO
  2002. +     @echo ::: HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
  2003. + inst.xdos: $(DUMMY)
  2004. +     $(CP) $(PROGS) $(BIN)
  2005. +     $(CP) ex$(COM) $(BIN)/vi$(COM)
  2006. +     $(CP) ex$(COM) $(BIN)/view$(COM)
  2007. +     $(CP) ex$(COM) $(BIN)/input$(COM)
  2008. +     @echo ::: YOU STILL NEED TO EDIT THE AUTOEXEC.BAT FILE TO
  2009. +     @echo ::: HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
  2010. + inst.tos: $(DUMMY)
  2011. +     $(CP) $(PROGS) $(BIN)
  2012. + inst.os9: $(DUMMY)
  2013. +     $(CP) $(PROGS) -rw=$(BIN)
  2014. +     chd $(BIN); attr -epenprnpw $(PROGS)
  2015. +     @echo ::: YOU STILL NEED TO EDIT THE /DD/STARTUP FILE, OR WHATEVER,
  2016. +     @echo ::: TO HAVE TEMP FILES BE PRESERVED AFTER A SYSTEM CRASH.
  2017. + inst.vms: $(DUMMY)
  2018. +     @echo how?
  2019. + ##############################################################################
  2020. + # clobbering is system dependent, because DOS's "copy" can't handle multiple
  2021. + # filenames
  2022. + clobber: clean clob.$(SYS)
  2023. +     @echo -n
  2024. + clean: $(DUMMY)
  2025. +     $(RM) *$(OBJ) 
  2026. +     $(RM) elvis?.uue 
  2027. +     $(RM) elvis?.sh 
  2028. +     $(RM) core
  2029. + clob.unx clob.tos clob.os9 clob.xdos clob.vms: $(DUMMY)
  2030. +     $(RM) tags refs $(PROGS)
  2031. + clob.dos : $(DUMMY)
  2032. +     for %a in ($(PROGS1)) do $(RM) %a
  2033. +     for %a in ($(PROGS2)) do $(RM) %a
  2034. +     for %a in (tags refs) do $(RM) %a
  2035. +     
  2036. + ##############################################################################
  2037. + uue: elvis1.uue elvis2.uue elvis3.uue elvis4.uue elvis5.uue elvis6.uue elvis7.uue elvis8.uue
  2038. + elvis1.uue: $(SRC1)
  2039. +     tar cf elvis1.tar $(SRC1)
  2040. +     compress -b13 elvis1.tar
  2041. +     uuencode elvis1.tar.Z <elvis1.tar.Z >elvis1.uue
  2042. +     $(RM) elvis1.tar*
  2043. + elvis2.uue: $(SRC2)
  2044. +     tar cf elvis2.tar $(SRC2)
  2045. +     compress -b13 elvis2.tar
  2046. +     uuencode elvis2.tar.Z <elvis2.tar.Z >elvis2.uue
  2047. +     $(RM) elvis2.tar*
  2048. + elvis3.uue: $(SRC3)
  2049. +     tar cf elvis3.tar $(SRC3)
  2050. +     compress -b13 elvis3.tar
  2051. +     uuencode elvis3.tar.Z <elvis3.tar.Z >elvis3.uue
  2052. +     $(RM) elvis3.tar*
  2053. + elvis4.uue: $(SRC4)
  2054. +     tar cf elvis4.tar $(SRC4)
  2055. +     compress -b13 elvis4.tar
  2056. +     uuencode elvis4.tar.Z <elvis4.tar.Z >elvis4.uue
  2057. +     $(RM) elvis4.tar*
  2058. + elvis5.uue: $(SRC5)
  2059. +     tar cf elvis5.tar $(SRC5)
  2060. +     compress -b13 elvis5.tar
  2061. +     uuencode elvis5.tar.Z <elvis5.tar.Z >elvis5.uue
  2062. +     $(RM) elvis5.tar*
  2063. + elvis6.uue: $(SRC6)
  2064. +     tar cf elvis6.tar $(SRC6)
  2065. +     compress -b13 elvis6.tar
  2066. +     uuencode elvis6.tar.Z <elvis6.tar.Z >elvis6.uue
  2067. +     $(RM) elvis6.tar*
  2068. + elvis7.uue: $(SRC7)
  2069. +     tar cf elvis7.tar $(SRC7)
  2070. +     compress -b13 elvis7.tar
  2071. +     uuencode elvis7.tar.Z <elvis7.tar.Z >elvis7.uue
  2072. +     $(RM) elvis7.tar*
  2073. + elvis8.uue: $(SRC8)
  2074. +     tar cf elvis8.tar $(SRC8)
  2075. +     compress -b13 elvis8.tar
  2076. +     uuencode elvis8.tar.Z <elvis8.tar.Z >elvis8.uue
  2077. +     $(RM) elvis8.tar*
  2078. + ##############################################################################
  2079. + sh: elvis1.sh elvis2.sh elvis3.sh elvis4.sh elvis5.sh elvis6.sh elvis7.sh elvis8.sh
  2080. + elvis1.sh: $(SRC1)
  2081. +     shar $(SRC1) >elvis1.sh
  2082. + elvis2.sh: $(SRC2)
  2083. +     shar $(SRC2) >elvis2.sh
  2084. + elvis3.sh: $(SRC3)
  2085. +     shar $(SRC3) >elvis3.sh
  2086. + elvis4.sh: $(SRC4)
  2087. +     shar $(SRC4) >elvis4.sh
  2088. + elvis5.sh: $(SRC5)
  2089. +     shar $(SRC5) >elvis5.sh
  2090. + elvis6.sh: $(SRC6)
  2091. +     shar $(SRC6) >elvis6.sh
  2092. + elvis7.sh: $(SRC7)
  2093. +     shar $(SRC7) >elvis7.sh
  2094. + elvis8.sh: $(SRC8)
  2095. +     shar $(SRC8) >elvis7.sh
  2096. + ##############################################################################
  2097. + elvis_t.Z: $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8)
  2098. +     tar cfbZ elvis_t.Z 20 $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6) $(SRC7) $(SRC8) Makefile
  2099. diff -c ./myname.c ../src/myname.c
  2100. *** ./myname.c    Mon Aug 10 00:30:14 1992
  2101. --- ../src/myname.c    Wed May 13 18:28:58 1992
  2102. ***************
  2103. *** 0 ****
  2104. --- 1,4 ----
  2105. + /* myname.c: default argv[0] value for alias.c on TOS/MINT */
  2106. + char myname[] = MYNAME;
  2107. diff -c ./opts.c ../src/opts.c
  2108. *** ./opts.c    Tue May 12 14:19:04 1992
  2109. --- ../src/opts.c    Wed May 13 18:29:02 1992
  2110. ***************
  2111. *** 124,129 ****
  2112. --- 124,134 ----
  2113.   char    o_smd[1] =        {FALSE};
  2114.   #endif
  2115.   
  2116. + #if MINT
  2117. + char    o_stbios[1] =        {FALSE};
  2118. + char    o_crlf[1] =        {TRUE};
  2119. + #endif
  2120.   
  2121.   /* The following describes the names & types of all options */
  2122.   #define BOOL    0
  2123. ***************
  2124. *** 160,165 ****
  2125. --- 165,173 ----
  2126.       { "charattr",    "ca",    BOOL,    CANSET|MR,    o_charattr    },
  2127.   #endif
  2128.       { "columns",    "co",    NUM,    SET|NOSAVE|MR,    o_columns    },
  2129. + #if MINT
  2130. +     { "crlf",    "cr",    BOOL,    CANSET    ,    o_crlf        },
  2131. + #endif
  2132.   #ifndef NO_DIGRAPH
  2133.       { "digraph",    "dig",    BOOL,    CANSET,        o_digraph    },
  2134.   #endif
  2135. ***************
  2136. *** 232,237 ****
  2137. --- 240,248 ----
  2138.   #endif
  2139.       { "shiftwidth",    "sw",    NUM,    CANSET,        o_shiftwidth    },
  2140.       { "sidescroll",    "ss",    NUM,    CANSET,        o_sidescroll    },
  2141. + #if MINT
  2142. +     { "stbios",    "st",    BOOL,    RCSET | SET ,    o_stbios    },
  2143. + #endif
  2144.       { "sync",    "sy",    BOOL,    CANSET,        o_sync        },
  2145.       { "tabstop",    "ts",    NUM,    CANSET|MR,    o_tabstop    },
  2146.   #ifndef CRUNCH
  2147. ***************
  2148. *** 253,259 ****
  2149.       { NULL, NULL, 0, CANSET, NULL }
  2150.   };
  2151.   
  2152.   /* This function initializes certain options from environment variables, etc. */
  2153.   void initopts()
  2154.   {
  2155. --- 264,269 ----
  2156. ***************
  2157. *** 282,288 ****
  2158.       }
  2159.   #endif
  2160.   
  2161. ! #if AMIGA || MSDOS || TOS
  2162.       if ((val = getenv("TMP")) /* yes, ASSIGNMENT! */
  2163.       ||  (val = getenv("TEMP")))
  2164.           strcpy(o_directory, val);
  2165. --- 292,298 ----
  2166.       }
  2167.   #endif
  2168.   
  2169. ! #if AMIGA || MSDOS || TOS || MINT
  2170.       if ((val = getenv("TMP")) /* yes, ASSIGNMENT! */
  2171.       ||  (val = getenv("TEMP")))
  2172.           strcpy(o_directory, val);
  2173. diff -c ./profile.sh ../src/profile.sh
  2174. *** ./profile.sh    Tue May 12 14:19:06 1992
  2175. --- ../src/profile.sh    Wed May 13 18:29:06 1992
  2176. ***************
  2177. *** 1,2 ****
  2178. ! set PATH=.,\bin
  2179.   set SHELL=shell.ttp
  2180. --- 1,3 ----
  2181. ! set TERMCAP=/dev/e/etc/termcap
  2182. ! set TERM=st
  2183.   set SHELL=shell.ttp
  2184. diff -c ./redraw.c ../src/redraw.c
  2185. *** ./redraw.c    Tue May 12 14:19:08 1992
  2186. --- ../src/redraw.c    Wed May 13 18:29:12 1992
  2187. ***************
  2188. *** 395,400 ****
  2189. --- 395,404 ----
  2190.       tabstop = *o_tabstop;
  2191.       abnormal = FALSE;
  2192.   
  2193. + #ifdef SMOOTHREDRAW
  2194. + #define CRUNCH
  2195. + #endif
  2196. + /* ...or was it meant the other way around? :-)  -nox */
  2197.   #ifndef CRUNCH
  2198.       if (clr)
  2199.           clrtoeol();
  2200. ***************
  2201. *** 532,537 ****
  2202. --- 536,546 ----
  2203.               }
  2204.               else /* tab ending after screen? next line! */
  2205.               {
  2206. + #ifdef CRUNCH
  2207. +                 /* needed atleast when scrolling the screen right  -nox */
  2208. +                 if (clr && col < limitcol)
  2209. +                     clrtoeol();
  2210. + #endif
  2211.                   col = limitcol;
  2212.                   if (has_AM)
  2213.                   {
  2214. ***************
  2215. *** 619,624 ****
  2216. --- 628,636 ----
  2217.       wqrefresh();
  2218.   }
  2219.   
  2220. + #ifdef SMOOTHREDRAW
  2221. + #undef CRUNCH
  2222. + #endif
  2223.   
  2224.   #ifndef CRUNCH
  2225.   static void nudgecursor(same, scan, new, lno)
  2226. diff -c ./ref.c ../src/ref.c
  2227. *** ./ref.c    Tue May 12 14:19:08 1992
  2228. --- ../src/ref.c    Wed May 13 21:53:50 1992
  2229. ***************
  2230. *** 24,30 ****
  2231. --- 24,32 ----
  2232.   extern void    usage P_((void));
  2233.   extern int    countcolons P_((char *));
  2234.   extern void    main P_((int, char **));
  2235. + #ifndef __STDC__
  2236.   extern char    *getenv P_((char *));
  2237. + #endif
  2238.   
  2239.   
  2240.   /* This is the default path that is searched for tags */
  2241. ***************
  2242. *** 34,41 ****
  2243.   # if ANY_UNIX
  2244.   #  define DEFTAGPATH ".:/usr/include:/usr/include/sys:/usr/src/lib:../lib:/usr/local/lib"
  2245.   # else
  2246. ! #  if MSDOS || TOS
  2247. ! #   define DEFTAGPATH ".;C:\\include;C:\\include\\sys;C:\\lib;..\\lib"
  2248.   #   define SEP ';'
  2249.   #  else
  2250.   #   if AMIGA
  2251. --- 36,47 ----
  2252.   # if ANY_UNIX
  2253.   #  define DEFTAGPATH ".:/usr/include:/usr/include/sys:/usr/src/lib:../lib:/usr/local/lib"
  2254.   # else
  2255. ! #  if MSDOS || TOS || MINT
  2256. ! #   if MINT
  2257. ! #    define DEFTAGPATH ".;/usr/include;/usr/include/sys;/usr/src/lib;../lib;/usr/local/lib"
  2258. ! #   else
  2259. ! #    define DEFTAGPATH ".;C:\\include;C:\\include\\sys;C:\\lib;..\\lib"
  2260. ! #   endif
  2261.   #   define SEP ';'
  2262.   #  else
  2263.   #   if AMIGA
  2264. ***************
  2265. *** 99,105 ****
  2266.   
  2267.       /* read lines until we get the one for this tag */
  2268.       found[0] = '\0';
  2269. !     while (fgets(buf, sizeof buf, tfile))
  2270.       {
  2271.           /* is this the one we want? */
  2272.           if (!strncmp(buf, tag, len) && buf[len] == '\t')
  2273. --- 105,111 ----
  2274.   
  2275.       /* read lines until we get the one for this tag */
  2276.       found[0] = '\0';
  2277. !     while (fgets(buf, (int) sizeof buf, tfile))
  2278.       {
  2279.           /* is this the one we want? */
  2280.           if (!strncmp(buf, tag, len) && buf[len] == '\t')
  2281. ***************
  2282. *** 144,150 ****
  2283.   
  2284.       for (bytes = 0, ch = 0; ch != '\n' && --limit > 0 && (ch = getc(fp)) != EOF; bytes++)
  2285.       {
  2286. ! #if MSDOS || TOS
  2287.           /* since this is a binary file, we'll need to manually strip CR's */
  2288.           if (ch == '\r')
  2289.           {
  2290. --- 150,156 ----
  2291.   
  2292.       for (bytes = 0, ch = 0; ch != '\n' && --limit > 0 && (ch = getc(fp)) != EOF; bytes++)
  2293.       {
  2294. ! #if MSDOS || TOS || MINT
  2295.           /* since this is a binary file, we'll need to manually strip CR's */
  2296.           if (ch == '\r')
  2297.           {
  2298. ***************
  2299. *** 217,223 ****
  2300.        * though we know it is a text file, because ftell() and fseek()
  2301.        * don't work on text files.
  2302.        */
  2303. ! #if MSDOS || TOS
  2304.       sfile = fopen(buf, "rb");
  2305.   #else
  2306.   # if AMIGA
  2307. --- 223,229 ----
  2308.        * though we know it is a text file, because ftell() and fseek()
  2309.        * don't work on text files.
  2310.        */
  2311. ! #if MSDOS || TOS || MINT
  2312.       sfile = fopen(buf, "rb");
  2313.   #else
  2314.   # if AMIGA
  2315. ***************
  2316. *** 236,242 ****
  2317.           else
  2318.   #endif
  2319.           sprintf(buf, "%s%crefs", dir, SLASH);
  2320. ! #if MSDOS || TOS
  2321.           sfile = fopen(buf, "rb");
  2322.   #else
  2323.   # if AMIGA
  2324. --- 242,248 ----
  2325.           else
  2326.   #endif
  2327.           sprintf(buf, "%s%crefs", dir, SLASH);
  2328. ! #if MSDOS || TOS || MINT
  2329.           sfile = fopen(buf, "rb");
  2330.   #else
  2331.   # if AMIGA
  2332. diff -c ./regexp.c ../src/regexp.c
  2333. *** ./regexp.c    Tue May 12 14:19:08 1992
  2334. --- ../src/regexp.c    Wed May 13 21:33:06 1992
  2335. ***************
  2336. *** 361,367 ****
  2337. --- 361,373 ----
  2338.       int        token;
  2339.       int        peek;
  2340.       char        *build;
  2341. + #ifdef __STDC__
  2342. +     /* tell compiler not to put re in a register so that longjmp()
  2343. +      *  can't affect it  -nox */
  2344. +     volatile regexp    *re;
  2345. + #else
  2346.       regexp        *re;
  2347. + #endif
  2348.   #ifndef CRUNCH
  2349.       int        from;
  2350.       int        to;
  2351. diff -c ./shell.c ../src/shell.c
  2352. *** ./shell.c    Tue May 12 14:19:10 1992
  2353. --- ../src/shell.c    Thu May 14 01:43:32 1992
  2354. ***************
  2355. *** 17,30 ****
  2356.    * shell: it implements the -c switch, which is required by Elvis, and
  2357.    * not supported by most other atari shells.
  2358.    */
  2359. !  
  2360.   #include <stdio.h>
  2361.   #include <string.h>
  2362.   #include <osbind.h>
  2363.   extern char *getenv(), *malloc();
  2364.   extern char **environ;
  2365.   long _stksize=16384;
  2366.   
  2367.   #define    MAXENV    50
  2368.   
  2369.   struct
  2370. --- 17,80 ----
  2371.    * shell: it implements the -c switch, which is required by Elvis, and
  2372.    * not supported by most other atari shells.
  2373.    */
  2374.   #include <stdio.h>
  2375.   #include <string.h>
  2376.   #include <osbind.h>
  2377. + #ifdef __STDC__
  2378. + #include <stdlib.h>
  2379. + #else
  2380.   extern char *getenv(), *malloc();
  2381. + #endif
  2382.   extern char **environ;
  2383.   long _stksize=16384;
  2384. +  
  2385. + #if MINT
  2386. + /* this is quite a bit MiNT library dependant... (although you
  2387. +    don't want to use this when actually _running_ under MiNT ->
  2388. +    use init.prg instead) */
  2389. + #define USEARGV 1
  2390. + /* ...especially it depends on system() no relying on $SHELL! */
  2391. + #include <unistd.h>
  2392. + int xsystem(const char *cmd)
  2393. + {
  2394. +     static int ret;
  2395. +     /* GEMDOS redirection bugs department... */
  2396. +     switch (vfork())
  2397. +     {
  2398. +       case -1:                        /* error */
  2399. +         ret = -1;
  2400. +         break;
  2401. +       case 0:                        /* child */
  2402. +         ret = system(cmd);
  2403. +         exit(0);
  2404. +       default:                        /* parent */
  2405. +         wait((int *) NULL);
  2406. +     }
  2407. +     return ret;
  2408. + }
  2409. + #endif
  2410. + #if USEARGV
  2411. + #define INITBUFSIZ 0x400
  2412. + #include <errno.h>
  2413. + size_t bufsiz = INITBUFSIZ;
  2414. + char *buf = (char *) NULL;
  2415.   
  2416. + #ifndef __STDC__
  2417. + extern char *putenv(), *realloc();
  2418. + #endif
  2419. + #else
  2420.   #define    MAXENV    50
  2421.   
  2422.   struct
  2423. ***************
  2424. *** 32,39 ****
  2425.       char *name;
  2426.       char *value;
  2427.   } myenv[MAXENV];
  2428.   
  2429. ! int cmd_set(), cmd_exit();
  2430.   
  2431.   struct buildins
  2432.   {
  2433. --- 82,91 ----
  2434.       char *name;
  2435.       char *value;
  2436.   } myenv[MAXENV];
  2437. + #endif
  2438.   
  2439. ! int cmd_set(), cmd_exit(), cmd_cd(), cmd_pwd();
  2440. ! char home[FILENAME_MAX];
  2441.   
  2442.   struct buildins
  2443.   {
  2444. ***************
  2445. *** 42,64 ****
  2446.   } buildins[]=
  2447.   {    "exit", cmd_exit,
  2448.       "set", cmd_set,
  2449.       0,
  2450.   };
  2451.   
  2452.   main(argc, argv)
  2453.       int argc;
  2454.       char **argv;
  2455.   {
  2456. -     char buf[128];
  2457.       int i;
  2458.   
  2459.       for (i=0; environ[i] && strncmp(environ[i],"ARGV=",5); i++)
  2460.           cmd_set(environ[i]);
  2461. !     script("profile.sh");
  2462.   
  2463.       if (argc>1 && !strcmp(argv[1], "-c"))
  2464.       {
  2465.           buf[0]='\0';
  2466.           for (i=2; i<argc; i++)
  2467.           {    if (i>2)
  2468.                   strcat(buf, " ");
  2469. --- 94,183 ----
  2470.   } buildins[]=
  2471.   {    "exit", cmd_exit,
  2472.       "set", cmd_set,
  2473. +     "cd", cmd_cd,
  2474. +     "pwd", cmd_pwd,
  2475.       0,
  2476.   };
  2477. +   
  2478. + #if USEARGV
  2479. + char *getbuf(needed)
  2480. +     size_t needed;
  2481. + {
  2482. +     if (buf && bufsiz >= needed)
  2483. +         return buf;
  2484. +     while (bufsiz < needed)
  2485. +         bufsiz *= 2;
  2486. +     if (!(buf = realloc(buf, bufsiz)))
  2487. +         exit(-ENOMEM);
  2488. +     return buf;
  2489. + }
  2490. + char *bufgets(fp)
  2491. +     FILE *fp;
  2492. + {
  2493. +     int c = EOF;
  2494. +     size_t p = 0, left = bufsiz-1;
  2495. +     while(((c = getc(fp)) != EOF)) {
  2496. +         if (!--left) {
  2497. +             buf = getbuf(bufsiz * 2);
  2498. +             left = bufsiz-p-1;
  2499. +         }
  2500. +         if((buf[p++] = c) == '\n')
  2501. +             break;
  2502. +     }
  2503. +     buf[p] = '\0';
  2504. +     if (!p && c == EOF)
  2505. +         return NULL;
  2506. +     return buf;
  2507. + }
  2508. + #endif
  2509.   
  2510.   main(argc, argv)
  2511.       int argc;
  2512.       char **argv;
  2513.   {
  2514.       int i;
  2515. + #if USEARGV
  2516. +     size_t p, clen;
  2517. +     int interactive = isatty(0);
  2518. +     char *ch;
  2519. +     (void) getbuf((size_t) 1);
  2520. + #else
  2521. +     char buf[128];
  2522.   
  2523.       for (i=0; environ[i] && strncmp(environ[i],"ARGV=",5); i++)
  2524.           cmd_set(environ[i]);
  2525. ! #endif
  2526. !     if (ch = getenv("HOME")) {
  2527. !         strcpy(home, ch);
  2528. !         ch = buf + strlen(strcpy(buf, ch));
  2529. !         if (!strchr("\\/", ch[-1]))
  2530. !             *ch++ = '/';
  2531. !         strcpy(ch, "profile.sh");
  2532. !         script(buf);
  2533. !     } else {
  2534. !         getcwd(home, sizeof(home));
  2535. !         script("profile.sh");
  2536. !     }
  2537.   
  2538.       if (argc>1 && !strcmp(argv[1], "-c"))
  2539.       {
  2540.           buf[0]='\0';
  2541. + #if USEARGV
  2542. +         p = 0;
  2543. +         for (i=2; i<argc; i++)
  2544. +         {    if (i>2) {
  2545. +                 buf[p++] = ' ';
  2546. +                 buf[p] = '\0';
  2547. +             }
  2548. +             strcpy(getbuf(p+(clen=strlen(argv[i]))+2)+p, argv[i]);
  2549. +             p += clen;
  2550. +         }
  2551. +         i = execute(buf);
  2552. +         exit(i>=0 ? i : errno);
  2553. + #else
  2554.           for (i=2; i<argc; i++)
  2555.           {    if (i>2)
  2556.                   strcat(buf, " ");
  2557. ***************
  2558. *** 65,74 ****
  2559. --- 184,209 ----
  2560.               strcat(buf, argv[i]);
  2561.           }
  2562.           execute(buf);
  2563. + #endif
  2564.       }
  2565.       else
  2566. + #if USEARGV
  2567. +         while ((interactive ? fputs("$ ", stdout) : 0),
  2568. +                bufgets(stdin)) {
  2569. +             if ((ch=strchr(buf, '\n')) != 0)
  2570. +                 *ch='\0';
  2571. +             errno = 0;
  2572. +             if (execute(buf) == -1 && interactive) {
  2573. +                 if (errno == ENOENT)
  2574. +                     printf("%s: not found\n", strtok(buf, " "));
  2575. +                 else if (errno == ENOEXEC)
  2576. +                     printf("%s: unable to exec\n", strtok(buf, " "));
  2577. +             }
  2578. +         }
  2579. + #else
  2580.           while (fputs("$ ", stdout), gets(buf))
  2581.               execute(buf);
  2582. + #endif
  2583.       exit(0);
  2584.   }
  2585.   
  2586. ***************
  2587. *** 76,84 ****
  2588.       char *buf;
  2589.   {
  2590.       char *scan=buf;
  2591. !     char cmd[80];
  2592.       char line[128];
  2593.       char env[4096], *ep=env;
  2594.       int i;
  2595.   
  2596.       while (*scan==' ')
  2597. --- 211,221 ----
  2598.       char *buf;
  2599.   {
  2600.       char *scan=buf;
  2601. ! #if !USEARGV
  2602. !     char cmd[FILENAME_MAX];
  2603.       char line[128];
  2604.       char env[4096], *ep=env;
  2605. + #endif
  2606.       int i;
  2607.   
  2608.       while (*scan==' ')
  2609. ***************
  2610. *** 94,99 ****
  2611. --- 231,241 ----
  2612.           if (!strcmp(buf, buildins[i].name))
  2613.               return (*buildins[i].func)(scan);
  2614.   
  2615. + #if USEARGV
  2616. +     if (*scan && !scan[-1])
  2617. +         scan[-1] = ' ';
  2618. +     return xsystem(buf);
  2619. + #else
  2620.       if (!searchpath(buf, cmd))
  2621.       {    printf("%s: not found\n", buf);
  2622.           return -1;
  2623. ***************
  2624. *** 111,118 ****
  2625. --- 253,262 ----
  2626.       *ep='\0';
  2627.   
  2628.       return Pexec(0, cmd, line, env);
  2629. + #endif
  2630.   }
  2631.   
  2632. + #if !USEARGV
  2633.   searchpath(from, to)
  2634.       char *from, *to;
  2635.   {
  2636. ***************
  2637. *** 163,168 ****
  2638. --- 307,336 ----
  2639.           return 0;
  2640.       return 1;
  2641.   }
  2642. + #endif
  2643. + cmd_cd(line)
  2644. +     char *line;
  2645. + {
  2646. +     if (!*line)
  2647. +         line = home;
  2648. +     else
  2649. +         line = strtok(line, " ");
  2650. +     if (chdir(line) < 0) {
  2651. +         perror(line);
  2652. +         return 1;
  2653. +     }
  2654. +     return 0;
  2655. + }
  2656. + cmd_pwd()
  2657. + {
  2658. +     char cwd[FILENAME_MAX];
  2659. +     getcwd(cwd, (int) sizeof(cwd));
  2660. +     puts(cwd);
  2661. +     return 0;
  2662. + }
  2663.   
  2664.   cmd_exit()
  2665.   {
  2666. ***************
  2667. *** 173,184 ****
  2668. --- 341,364 ----
  2669.       char *line;
  2670.   {
  2671.       char *value;
  2672. + #if USEARGV
  2673. +     char **ep;
  2674. + #else
  2675.       int i;
  2676. + #endif
  2677.   
  2678.       if (!*line)
  2679.       {
  2680. + #if USEARGV
  2681. +         if (environ)
  2682. +             for (ep = environ; *ep; ++ep) {
  2683. +                 fputs(*ep, stdout);
  2684. +                 fputs("\n", stdout);
  2685. +             }
  2686. + #else
  2687.           for (i=0; i<MAXENV && myenv[i].name; i++)
  2688.               printf("%s=%s\n", myenv[i].name, myenv[i].value);
  2689. + #endif
  2690.           return 0;
  2691.       }
  2692.   
  2693. ***************
  2694. *** 188,197 ****
  2695. --- 368,384 ----
  2696.       {    printf("Usage: set name=var\n");
  2697.           return -1;
  2698.       }
  2699. + #if USEARGV
  2700. +     if (!(line = strdup(line)))
  2701. +         exit(-ENOMEM);
  2702. +     return putenv(line);
  2703. + #else
  2704.       *value++='\0';
  2705.       return doset(line, value);
  2706. + #endif
  2707.   }
  2708.   
  2709. + #if !USEARGV
  2710.   doset(line, value)
  2711.       char *line, *value;
  2712.   {
  2713. ***************
  2714. *** 213,228 ****
  2715.       strcpy(myenv[i].value, value);
  2716.       return 0;
  2717.   }
  2718.   
  2719.   script(name)
  2720.       char *name;
  2721.   {
  2722.       FILE *fp;
  2723.       char buf[128], *p;
  2724.   
  2725.       if ((fp=fopen(name, "r"))==0)
  2726.           return;
  2727. !     while (fgets(buf, sizeof buf, fp))
  2728.       {
  2729.           if ((p=strchr(buf, '\n'))!=0)
  2730.               *p='\0';
  2731. --- 400,424 ----
  2732.       strcpy(myenv[i].value, value);
  2733.       return 0;
  2734.   }
  2735. + #endif
  2736.   
  2737.   script(name)
  2738.       char *name;
  2739.   {
  2740.       FILE *fp;
  2741. + #if USEARGV
  2742. +     char *p;
  2743. + #else
  2744.       char buf[128], *p;
  2745. + #endif
  2746.   
  2747.       if ((fp=fopen(name, "r"))==0)
  2748.           return;
  2749. ! #if USEARGV
  2750. !     while (bufgets(fp))
  2751. ! #else
  2752. !     while (fgets(buf, (int) sizeof buf, fp))
  2753. ! #endif
  2754.       {
  2755.           if ((p=strchr(buf, '\n'))!=0)
  2756.               *p='\0';
  2757. diff -c ./sysdos.c ../src/sysdos.c
  2758. *** ./sysdos.c    Tue May 12 14:19:10 1992
  2759. --- ../src/sysdos.c    Wed May 13 18:29:26 1992
  2760. ***************
  2761. *** 27,43 ****
  2762.   #include "vi.h"
  2763.   extern char **environ;
  2764.   
  2765. ! #if MSDOS
  2766.   #include <process.h>
  2767.   extern unsigned char _osmajor;
  2768.   #endif
  2769. ! #if TOS
  2770.   #include <osbind.h>
  2771.   #endif
  2772.   
  2773. ! #if MSDOS || TOS
  2774.   #include <string.h>
  2775.   
  2776.   /*
  2777. --- 27,46 ----
  2778.   #include "vi.h"
  2779.   extern char **environ;
  2780.   
  2781. ! #if MSDOS || MINT
  2782.   #include <process.h>
  2783. + # if MSDOS
  2784.   extern unsigned char _osmajor;
  2785. + # endif
  2786.   #endif
  2787. ! #if TOS || MINT
  2788.   #include <osbind.h>
  2789.   #endif
  2790. ! #if MINT
  2791. ! #include <stdio.h>
  2792. ! #endif
  2793.   
  2794. ! #if MSDOS || TOS || MINT
  2795.   #include <string.h>
  2796.   
  2797.   /*
  2798. ***************
  2799. *** 54,64 ****
  2800.   int system(cmd)
  2801.       const char    *cmd;
  2802.   {
  2803. ! #if MSDOS
  2804.       char *cmdswitch="/c";
  2805.       if (_osmajor<4)
  2806.           cmdswitch[0]=switchar();
  2807.       return spawnle(P_WAIT, o_shell, o_shell, cmdswitch, cmd, (char *)0, environ);
  2808.   #else
  2809.       long    ssp;
  2810.       int    (*shell)();
  2811. --- 57,115 ----
  2812.   int system(cmd)
  2813.       const char    *cmd;
  2814.   {
  2815. ! #if MSDOS || MINT
  2816. ! # if MINT
  2817. !     static char *extensions[] = { "ttp", "prg", "tos", NULL };
  2818. !     extern char *findfile (char *, char *, char **);
  2819. !     extern char *getenv();
  2820. !     char **argv = 0, *cmdcopy = 0, **argp, *path, *p;
  2821. !     int ret;
  2822. !     size_t clen;
  2823. !     static char cmdpath[FILENAME_MAX];
  2824. !     long    ssp;
  2825. !     int    (*shell)();
  2826. !     if (cmd == o_shell)
  2827. !         return spawnlp(P_WAIT, o_shell, o_shell, (char *)0);
  2828. !     if (!getenv("NO_SHELLP")) {
  2829. !         ssp = Super(0L);
  2830. !         shell = *((int (**)())0x4F6);
  2831. !         (void) Super(ssp);
  2832. !         if (shell)
  2833. !             return (*shell)(cmd);
  2834. !     }
  2835. !     /* see if cmd is simple enough so that we don't need a shell */
  2836. !     if ((path = getenv("PATH")) && (clen = strlen(cmd)) &&
  2837. !         !strpbrk(cmd, "'\"`><;$~[*?&|(){}") &&
  2838. !         (argv = (char **) malloc((clen/2+2) * sizeof(char *))) &&
  2839. !         (cmdcopy = strdup(cmd)) &&
  2840. !         (p = findfile(strtok(cmdcopy, " \t"), path, extensions))) {
  2841. !         argp = argv;
  2842. !         *argp++ = strcpy(cmdpath, p);
  2843. !         while (*argp++ = strtok((char *) NULL, " \t"))
  2844. !             ;
  2845. !         errno = 0;
  2846. !         ret = spawnv(P_WAIT, p, argv);
  2847. !         free(argv);
  2848. !         free(cmdcopy);
  2849. !         if (ret != -1 || errno != ENOEXEC)
  2850. !             return ret;
  2851. !     }
  2852. !     if (argv)
  2853. !         free(argv);
  2854. !     if (cmdcopy)
  2855. !         free(cmdcopy);
  2856. !     return spawnlp(P_WAIT, o_shell, o_shell, "-c", cmd, (char *)0);
  2857. ! # else
  2858.       char *cmdswitch="/c";
  2859.       if (_osmajor<4)
  2860.           cmdswitch[0]=switchar();
  2861.       return spawnle(P_WAIT, o_shell, o_shell, cmdswitch, cmd, (char *)0, environ);
  2862. + # endif
  2863.   #else
  2864.       long    ssp;
  2865.       int    (*shell)();
  2866. ***************
  2867. *** 103,109 ****
  2868. --- 154,165 ----
  2869.   static int cmdstate;
  2870.   static char output[80];
  2871.   
  2872. + #if MINT
  2873. + /* MiNT uses real pipes if it can... (wich means unless running vanilla TOS.) */
  2874. + int trpipe(cmd, in)
  2875. + #else
  2876.   int rpipe(cmd, in)
  2877. + #endif
  2878.       char    *cmd;    /* the filter command to use */
  2879.       int    in;    /* the fd to use for stdin */
  2880.   {
  2881. ***************
  2882. *** 125,130 ****
  2883. --- 181,190 ----
  2884.       /* save and redirect stdin, stdout, and stderr */
  2885.       old0=dup(0);
  2886.       old1=dup(1);
  2887. + #if MINT
  2888. +     /* ... and stderr :-) */
  2889. +     old2=dup(2);
  2890. + #endif
  2891.       if (in)
  2892.       {
  2893.           dup2(in, 0);
  2894. ***************
  2895. *** 131,136 ****
  2896. --- 191,199 ----
  2897.           close(in);
  2898.       }
  2899.       dup2(fd, 1);
  2900. + #if MINT
  2901. +     dup2(fd, 2);
  2902. + #endif
  2903.   
  2904.       /* call command */
  2905.       cmdstate=system(cmd);
  2906. ***************
  2907. *** 138,155 ****
  2908.       /* restore old std... */
  2909.       dup2(old0, 0); close(old0);
  2910.       dup2(old1, 1); close(old1);
  2911.   
  2912.       /* rewind command output */
  2913.       lseek(fd, 0L, 0);
  2914.       return fd;
  2915.   }
  2916.   
  2917.   /* This function closes the pipe opened by rpipe(), and returns 0 for success */
  2918.   int rpclose(fd)
  2919.       int    fd;
  2920.   {
  2921. -     int    status;
  2922.       close(fd);
  2923.       unlink(output);
  2924.       return cmdstate;
  2925. --- 201,229 ----
  2926.       /* restore old std... */
  2927.       dup2(old0, 0); close(old0);
  2928.       dup2(old1, 1); close(old1);
  2929. + #if MINT
  2930. +     dup2(old2, 2); close(old2);
  2931. + #endif
  2932.   
  2933.       /* rewind command output */
  2934. + #if TOS || MINT
  2935. +     /* GEMDOS redirection bugs department... */
  2936. +     close(fd);
  2937. +     fd=open(output, O_RDWR);
  2938. + #else
  2939.       lseek(fd, 0L, 0);
  2940. + #endif
  2941.       return fd;
  2942.   }
  2943.   
  2944.   /* This function closes the pipe opened by rpipe(), and returns 0 for success */
  2945. + #if MINT
  2946. + int trpclose(fd)
  2947. + #else
  2948.   int rpclose(fd)
  2949. + #endif
  2950.       int    fd;
  2951.   {
  2952.       close(fd);
  2953.       unlink(output);
  2954.       return cmdstate;
  2955. diff -c ./system.c ../src/system.c
  2956. *** ./system.c    Tue May 12 14:19:10 1992
  2957. --- ../src/system.c    Thu May 14 01:27:30 1992
  2958. ***************
  2959. *** 22,31 ****
  2960.   
  2961.   #include "config.h"
  2962.   #include "vi.h"
  2963.   extern char    **environ;
  2964.   
  2965. ! #if ANY_UNIX
  2966.   
  2967.   /* This is a new version of the system() function.  The only difference
  2968.    * between this one and the library one is: this one uses the o_shell option.
  2969.    */
  2970. --- 22,37 ----
  2971.   
  2972.   #include "config.h"
  2973.   #include "vi.h"
  2974. + #if MINT
  2975. + #include "ctype.h"
  2976. + extern int __mint;
  2977. + #endif
  2978.   extern char    **environ;
  2979.   
  2980. ! #if ANY_UNIX || MINT
  2981.   
  2982. + #if !MINT
  2983.   /* This is a new version of the system() function.  The only difference
  2984.    * between this one and the library one is: this one uses the o_shell option.
  2985.    */
  2986. ***************
  2987. *** 85,90 ****
  2988. --- 91,97 ----
  2989.   
  2990.       return status;
  2991.   }
  2992. + #endif
  2993.   
  2994.   /* This private function opens a pipe from a filter.  It is similar to the
  2995.    * system() function above, and to popen(cmd, "r").
  2996. ***************
  2997. *** 95,100 ****
  2998. --- 102,126 ----
  2999.   {
  3000.       int    r0w1[2];/* the pipe fd's */
  3001.   
  3002. + #if MINT
  3003. + /* maximum commandline length that we try to parse ourselves */
  3004. + #define MAXCMDLEN 0x400
  3005. +     static char *extensions[] = { "ttp", "prg", "tos", (char *) NULL};
  3006. +     extern char *findfile (char *, char *, char **);
  3007. +     extern char *getenv();
  3008. +     static char *argv[MAXCMDLEN/2+2];
  3009. +     static char cmdcopy[MAXCMDLEN+2];
  3010. +     static char cmdpath[FILENAME_MAX];
  3011. +     char **argp, *path, *p;
  3012. +     size_t clen;
  3013. +     /* if MiNT is not running, we have to use a tempfile */
  3014. +     if (!__mint)
  3015. +         return trpipe(cmd, in);
  3016. + #endif
  3017.       /* make the pipe */
  3018.       if (pipe(r0w1) < 0)
  3019.       {
  3020. ***************
  3021. *** 107,112 ****
  3022. --- 133,157 ----
  3023.        */
  3024.       signal(SIGINT, SIG_IGN);
  3025.   
  3026. + #if MINT
  3027. +     /* MiNT <= 0.8 had a problem with broken pipes...  */
  3028. +     if (__mint <= 8) {
  3029. +         signal(SIGTTIN, SIG_IGN);
  3030. +         signal(SIGTTOU, SIG_IGN);
  3031. +     }
  3032. +     /* see if cmd is simple enough so that we don't need a shell */
  3033. +     if ((path = getenv("PATH")) && (clen = strlen(cmd)) &&
  3034. +         clen < MAXCMDLEN && !strpbrk(cmd, "'\"`><;$~[*?&|(){}") &&
  3035. +         (p = findfile(strtok(strcpy(cmdcopy, cmd), " \t"), path, extensions))) {
  3036. +         argp = argv;
  3037. +         *argp++ = strcpy(cmdpath, p);
  3038. +         while (*argp++ = strtok((char *) NULL, " \t"))
  3039. +             ;
  3040. +     } else
  3041. +         p = 0;
  3042. + #endif
  3043.       switch (fork())
  3044.       {
  3045.         case -1:                        /* error */
  3046. ***************
  3047. *** 117,122 ****
  3048. --- 162,180 ----
  3049.           close(r0w1[0]);
  3050.   
  3051.           /* redirect stdout to go to the "write" end of the pipe */
  3052. + #if MINT
  3053. +         /* GEMDOS redirection bugs department...  */
  3054. +         dup2(r0w1[1], 1);
  3055. +         dup2(r0w1[1], 2);
  3056. +         close(r0w1[1]);
  3057. +         /* redirect stdin */
  3058. +         if (in != 0)
  3059. +         {
  3060. +             dup2(in, 0);
  3061. +             close(in);
  3062. +         }
  3063. + #else
  3064.           close(1);
  3065.           dup(r0w1[1]);
  3066.           close(2);
  3067. ***************
  3068. *** 130,141 ****
  3069. --- 188,206 ----
  3070.               dup(in);
  3071.               close(in);
  3072.           }
  3073. + #endif
  3074.   
  3075.           /* the filter should accept SIGINT signals */
  3076.           signal(SIGINT, SIG_DFL);
  3077.   
  3078.           /* exec the shell to run the command */
  3079. + #if MINT
  3080. +         errno = 0;
  3081. +         if (!p || (execv(p, argv) == -1 && errno == ENOEXEC))
  3082. +             execlp(o_shell, o_shell, "-c", cmd, (char *)0);
  3083. + #else
  3084.           execle(o_shell, o_shell, "-c", cmd, (char *)0, environ);
  3085. + #endif
  3086.           exit(1); /* if we get here, exec failed */
  3087.   
  3088.         default:                        /* parent */
  3089. ***************
  3090. *** 161,167 ****
  3091.   }    
  3092.   #endif
  3093.   
  3094. ! #if ANY_UNIX || OSK
  3095.   
  3096.   /* This function closes the pipe opened by rpipe(), and returns 0 for success */
  3097.   int rpclose(fd)
  3098. --- 226,232 ----
  3099.   }    
  3100.   #endif
  3101.   
  3102. ! #if ANY_UNIX || OSK || MINT
  3103.   
  3104.   /* This function closes the pipe opened by rpipe(), and returns 0 for success */
  3105.   int rpclose(fd)
  3106. ***************
  3107. *** 169,174 ****
  3108. --- 234,243 ----
  3109.   {
  3110.       int    status;
  3111.   
  3112. + #if MINT
  3113. +     if (!__mint)
  3114. +         return trpclose(fd);
  3115. + #endif
  3116.       close(fd);
  3117.       wait(&status);
  3118.   #if __GNUC__
  3119. ***************
  3120. *** 216,221 ****
  3121. --- 285,295 ----
  3122.       int    i, j, fd;
  3123.       REG char *s, *d;
  3124.   
  3125. + #if 1
  3126. +     /* before we do anything, see if there are wildcards at all  -nox */
  3127. +     if (!strpbrk(names, "*?[`{$~"))
  3128. +         return names;
  3129. + #endif
  3130.   
  3131.       /* build the echo command */
  3132.       if (names != tmpblk.c)
  3133. ***************
  3134. *** 249,255 ****
  3135. --- 323,336 ----
  3136.       /* successful? */
  3137.       if (rpclose(fd) == 0 && j == 0 && i < BLKSIZE && i > 0)
  3138.       {
  3139. + #if MINT
  3140. +         /* strange shells doing strange things... */
  3141. +         while (isspace(tmpblk.c[--i]))
  3142. +             ;
  3143. +         tmpblk.c[++i] = '\0';
  3144. + #else
  3145.           tmpblk.c[i-1] = '\0'; /* "i-1" so we clip off the newline */
  3146. + #endif
  3147.           return tmpblk.c;
  3148.       }
  3149.       else
  3150. ***************
  3151. *** 281,287 ****
  3152.       if (to)
  3153.       {
  3154.           /* we have lines */
  3155. ! #if MSDOS || TOS
  3156.           strcpy(scrout, o_directory);
  3157.           if ((i=strlen(scrout)) && !strchr("\\/:", scrout[i-1]))
  3158.               scrout[i++]=SLASH;
  3159. --- 362,368 ----
  3160.       if (to)
  3161.       {
  3162.           /* we have lines */
  3163. ! #if MSDOS || TOS || MINT
  3164.           strcpy(scrout, o_directory);
  3165.           if ((i=strlen(scrout)) && !strchr("\\/:", scrout[i-1]))
  3166.               scrout[i++]=SLASH;
  3167. ***************
  3168. *** 375,380 ****
  3169. --- 456,471 ----
  3170.                   }
  3171.   #endif
  3172.               }
  3173. + #if 1
  3174. +             /* doesn't the delete() belong into here?  -nox */
  3175. +             /* delete old text, if any */
  3176. +             if (to)
  3177. +             {
  3178. +                 cut(from, to);
  3179. +                 delete(from, to);
  3180. +             }
  3181. + #else
  3182.           }
  3183.   
  3184.           /* delete old text, if any */
  3185. ***************
  3186. *** 382,387 ****
  3187. --- 473,479 ----
  3188.           {
  3189.               cut(from, to);
  3190.               delete(from, to);
  3191. + #endif
  3192.           }
  3193.       }
  3194.       else
  3195. diff -c ./tio.c ../src/tio.c
  3196. *** ./tio.c    Tue May 12 14:19:12 1992
  3197. --- ../src/tio.c    Wed May 13 18:29:38 1992
  3198. ***************
  3199. *** 449,454 ****
  3200. --- 449,458 ----
  3201.    * number of characters read is 0, and we didn't time-out, then it exits because
  3202.    * we've apparently reached the end of an EX script.
  3203.    */
  3204. + #ifndef NO_CURSORSHAPE
  3205. + /* made global so that suspend_curses() can reset it  -nox */
  3206. + int    oldcurs;
  3207. + #endif
  3208.   static int fillkeybuf(when, timeout)
  3209.       int    when;    /* mixture of WHEN_XXX flags */
  3210.       int    timeout;/* timeout in 1/10 second increments, or 0 */
  3211. ***************
  3212. *** 461,469 ****
  3213.       static long    oldnlines;
  3214.       char        *str;
  3215.   #endif
  3216. - #ifndef NO_CURSORSHAPE
  3217. -     static int    oldcurs;
  3218. - #endif
  3219.   
  3220.   #ifdef DEBUG
  3221.       watch();
  3222. --- 465,470 ----
  3223. ***************
  3224. *** 547,553 ****
  3225.   
  3226.       /* Okay, now we can finally read the rawin keystrokes */
  3227.       refresh();
  3228. !     nkeys = ttyread(keybuf + cend, sizeof keybuf - cend, timeout);
  3229.   
  3230.       /* if nkeys == 0 then we've reached EOF of an ex script. */
  3231.       if (nkeys == 0 && timeout == 0)
  3232. --- 548,554 ----
  3233.   
  3234.       /* Okay, now we can finally read the rawin keystrokes */
  3235.       refresh();
  3236. !     nkeys = ttyread(keybuf + cend, (int) sizeof keybuf - cend, timeout);
  3237.   
  3238.       /* if nkeys == 0 then we've reached EOF of an ex script. */
  3239.       if (nkeys == 0 && timeout == 0)
  3240. diff -c ./tmp.c ../src/tmp.c
  3241. *** ./tmp.c    Tue May 12 14:19:12 1992
  3242. --- ../src/tmp.c    Sun Aug  9 21:34:34 1992
  3243. ***************
  3244. *** 10,16 ****
  3245.   
  3246.   /* This file contains functions which create & readback a TMPFILE */
  3247.   
  3248.   #include "config.h"
  3249.   #include "vi.h"
  3250.   #if TOS
  3251. --- 10,15 ----
  3252. ***************
  3253. *** 30,35 ****
  3254. --- 29,46 ----
  3255.   # include <process.h>
  3256.   #endif
  3257.   
  3258. + /* a quick hack 'cause close(-1) wasn't a no-op on early versions of MiNT  -nox */
  3259. + #if MINT
  3260. + int mclose(fd)
  3261. +     int fd;
  3262. + {
  3263. +     if (fd >= 0)
  3264. +         return close(fd);
  3265. +     return 0;
  3266. + }
  3267. + #define close mclose
  3268. + #endif
  3269.   #ifndef NO_MODELINES
  3270.   static void do_modelines(l, stop)
  3271.       long    l;    /* line number to start at */
  3272. ***************
  3273. *** 156,162 ****
  3274.               if (*o_readonly || (statb.st_mode & S_IJRON))
  3275.   # endif
  3276.   #endif
  3277. ! #if ANY_UNIX
  3278.               if (*o_readonly || !(statb.st_mode &
  3279.                     ((geteuid() == 0) ? 0222 :
  3280.                     ((statb.st_uid != geteuid() ? 0022 : 0200)))))
  3281. --- 167,173 ----
  3282.               if (*o_readonly || (statb.st_mode & S_IJRON))
  3283.   # endif
  3284.   #endif
  3285. ! #if ANY_UNIX || MINT
  3286.               if (*o_readonly || !(statb.st_mode &
  3287.                     ((geteuid() == 0) ? 0222 :
  3288.                     ((statb.st_uid != geteuid() ? 0022 : 0200)))))
  3289. ***************
  3290. *** 183,189 ****
  3291.   
  3292.       /* make a name for the tmp file */
  3293.       tmpnum++;
  3294. ! #if MSDOS || TOS
  3295.       /* MS-Dos doesn't allow multiple slashes, but supports drives
  3296.        * with current directories.
  3297.        * This relies on TMPNAME beginning with "%s\\"!!!!
  3298. --- 194,200 ----
  3299.   
  3300.       /* make a name for the tmp file */
  3301.       tmpnum++;
  3302. ! #if MSDOS || TOS || MINT
  3303.       /* MS-Dos doesn't allow multiple slashes, but supports drives
  3304.        * with current directories.
  3305.        * This relies on TMPNAME beginning with "%s\\"!!!!
  3306. ***************
  3307. *** 203,209 ****
  3308.       }
  3309.   
  3310.       /* create the temp file */
  3311. ! #if ANY_UNIX
  3312.       close(creat(tmpname, 0600));        /* only we can read it */
  3313.   #else
  3314.       close(creat(tmpname, FILEPERMS));    /* anybody body can read it, alas */
  3315. --- 214,220 ----
  3316.       }
  3317.   
  3318.       /* create the temp file */
  3319. ! #if ANY_UNIX || MINT
  3320.       close(creat(tmpname, 0600));        /* only we can read it */
  3321.   #else
  3322.       close(creat(tmpname, FILEPERMS));    /* anybody body can read it, alas */
  3323. ***************
  3324. *** 270,276 ****
  3325. --- 281,292 ----
  3326.               this = next;
  3327.   
  3328.               /* read [more] text into this block */
  3329. + #if MINT
  3330. +             nread = (*o_crlf ? tread : read)
  3331. +                 (origfd, &this->c[inbuf], BLKSIZE - 1 - inbuf);
  3332. + #else
  3333.               nread = tread(origfd, &this->c[inbuf], BLKSIZE - 1 - inbuf);
  3334. + #endif
  3335.               if (nread < 0)
  3336.               {
  3337.                   close(origfd);
  3338. ***************
  3339. *** 318,324 ****
  3340.                   goto FoundEOF;
  3341.               }
  3342.   
  3343. ! #if MSDOS || TOS
  3344.   /* BAH! MS text mode read fills inbuf, then compresses eliminating \r
  3345.      but leaving garbage at end of buf. The same is true for TURBOC. GB. */
  3346.   
  3347. --- 334,340 ----
  3348.                   goto FoundEOF;
  3349.               }
  3350.   
  3351. ! #if MSDOS || TOS || MINT
  3352.   /* BAH! MS text mode read fills inbuf, then compresses eliminating \r
  3353.      but leaving garbage at end of buf. The same is true for TURBOC. GB. */
  3354.   
  3355. ***************
  3356. *** 386,392 ****
  3357.               nbytes = 1;
  3358.           }
  3359.   
  3360. ! #if MSDOS || TOS
  3361.           /* each line has an extra CR that we didn't count yet */
  3362.           nbytes += nlines;
  3363.   #endif
  3364. --- 402,411 ----
  3365.               nbytes = 1;
  3366.           }
  3367.   
  3368. ! #if MSDOS || TOS || MINT
  3369. ! # if MINT
  3370. !         if (*o_crlf)
  3371. ! # endif
  3372.           /* each line has an extra CR that we didn't count yet */
  3373.           nbytes += nlines;
  3374.   #endif
  3375. ***************
  3376. *** 529,535 ****
  3377. --- 548,558 ----
  3378.           for (len = 0; len < BLKSIZE && this->c[len]; len++)
  3379.           {
  3380.           }
  3381. + #if MINT
  3382. +         if ((*o_crlf ? twrite : write)(fd, this->c, len) < len)
  3383. + #else
  3384.           if (twrite(fd, this->c, len) < len)
  3385. + #endif
  3386.           {
  3387.               msg("Trouble writing to \"%s\"", filename);
  3388.               if (!strcmp(filename, origname))
  3389. ***************
  3390. *** 551,557 ****
  3391.       }
  3392.   
  3393.       /* report lines & characters */
  3394. ! #if MSDOS || TOS
  3395.       bytes += nlines; /* for the inserted carriage returns */
  3396.   #endif
  3397.       msg("Wrote \"%s\"  %ld lines, %ld characters", filename, nlines, bytes);
  3398. --- 574,583 ----
  3399.       }
  3400.   
  3401.       /* report lines & characters */
  3402. ! #if MSDOS || TOS || MINT
  3403. ! # if MINT
  3404. !     if (*o_crlf)
  3405. ! # endif
  3406.       bytes += nlines; /* for the inserted carriage returns */
  3407.   #endif
  3408.       msg("Wrote \"%s\"  %ld lines, %ld characters", filename, nlines, bytes);
  3409. ***************
  3410. *** 626,632 ****
  3411.    * changes to be written to the disk, so that the tmp file will survive a
  3412.    * system crash or power failure.
  3413.    */
  3414. ! #if AMIGA || MSDOS || TOS
  3415.   sync()
  3416.   {
  3417.       /* MS-DOS and TOS don't flush their buffers until the file is closed,
  3418. --- 652,658 ----
  3419.    * changes to be written to the disk, so that the tmp file will survive a
  3420.    * system crash or power failure.
  3421.    */
  3422. ! #if AMIGA || MSDOS || TOS || MINT
  3423.   sync()
  3424.   {
  3425.       /* MS-DOS and TOS don't flush their buffers until the file is closed,
  3426. ***************
  3427. *** 662,668 ****
  3428. --- 688,698 ----
  3429.           U_text[1] = 127;
  3430.       }
  3431.   #ifndef CRUNCH
  3432. + #if TOS | MINT | MSDOS
  3433. +     else if (*name != '/' && *name !='\\' && (!*name || name[1]!=':'))
  3434. + #else
  3435.       else if (*name != SLASH)
  3436. + #endif
  3437.       {
  3438.           /* get the directory name */
  3439.           ptr = getcwd(U_text, BLKSIZE);
  3440. ***************
  3441. *** 684,690 ****
  3442.           /* copy the filename into U_text */
  3443.           strncpy(U_text, *name ? name : "foo", BLKSIZE);
  3444.       }
  3445.       if (tmpfd >= 0)
  3446.       {
  3447.           /* write the name out to second block of the temp file */
  3448. --- 714,725 ----
  3449.           /* copy the filename into U_text */
  3450.           strncpy(U_text, *name ? name : "foo", BLKSIZE);
  3451.       }
  3452. ! #if MINT
  3453. !     for (ptr=U_text; *ptr && ptr < U_text+BLKSIZE; ++ptr) {
  3454. !         if (*ptr == '\\')
  3455. !             *ptr = '/';
  3456. !     }
  3457. ! #endif
  3458.       if (tmpfd >= 0)
  3459.       {
  3460.           /* write the name out to second block of the temp file */
  3461. diff -c ./vars.c ../src/vars.c
  3462. *** ./vars.c    Tue May 12 14:19:14 1992
  3463. --- ../src/vars.c    Wed May 13 18:29:48 1992
  3464. ***************
  3465. *** 106,112 ****
  3466.   
  3467.   /* Bigger stack req'ed for TOS and TURBOC */
  3468.   
  3469. ! #if TOS
  3470.   long    _stksize = 16384;
  3471.   #endif
  3472.   
  3473. --- 106,112 ----
  3474.   
  3475.   /* Bigger stack req'ed for TOS and TURBOC */
  3476.   
  3477. ! #if TOS || MINT
  3478.   long    _stksize = 16384;
  3479.   #endif
  3480.   
  3481. diff -c ./vcmd.c ../src/vcmd.c
  3482. *** ./vcmd.c    Tue May 12 14:19:14 1992
  3483. --- ../src/vcmd.c    Wed May 13 21:08:30 1992
  3484. ***************
  3485. *** 553,559 ****
  3486.       /* adjust for inclusive endmarks in ex */
  3487.       n -= BLKSIZE;
  3488.   
  3489. !     if (vgets('!', cmdln, sizeof(cmdln)) > 0)
  3490.       {
  3491.           filter(m, n, cmdln, TRUE);
  3492.       }
  3493. --- 553,559 ----
  3494.       /* adjust for inclusive endmarks in ex */
  3495.       n -= BLKSIZE;
  3496.   
  3497. !     if (vgets('!', cmdln, (int) sizeof(cmdln)) > 0)
  3498.       {
  3499.           filter(m, n, cmdln, TRUE);
  3500.       }
  3501. ***************
  3502. *** 966,972 ****
  3503. --- 966,975 ----
  3504.   
  3505.       /* arrange for the menu to be erased (except "save & exit" doesn't care)
  3506.        */
  3507. + #if 0
  3508. +     /* hmm.  doesn't work for `\\Z'  -nox */
  3509.       if (sel != 9)
  3510. + #endif
  3511.           redraw(MARK_UNSET, FALSE);
  3512.   
  3513.       return m;
  3514. diff -c ./vi.c ../src/vi.c
  3515. *** ./vi.c    Tue May 12 14:19:14 1992
  3516. --- ../src/vi.c    Wed May 13 18:30:00 1992
  3517. ***************
  3518. *** 555,561 ****
  3519.                 {    
  3520.                   text[0] = key;
  3521.                   text[1] = '\0';
  3522. !                 if (doingdot || vgets(key, text + 1, sizeof text - 1) >= 0)
  3523.                   {
  3524.                       /* reassure user that <CR> was hit */
  3525.                       qaddch('\r');
  3526. --- 555,561 ----
  3527.                 {    
  3528.                   text[0] = key;
  3529.                   text[1] = '\0';
  3530. !                 if (doingdot || vgets(key, text + 1, (int) sizeof text - 1) >= 0)
  3531.                   {
  3532.                       /* reassure user that <CR> was hit */
  3533.                       qaddch('\r');
  3534. diff -c ./vi.h ../src/vi.h
  3535. *** ./vi.h    Tue May 12 14:19:16 1992
  3536. --- ../src/vi.h    Wed May 13 23:07:12 1992
  3537. ***************
  3538. *** 58,64 ****
  3539.   # include <string.h>    /* for str* prototypes            */
  3540.   # include <stdlib.h>    /* for atoi, system, malloc, free    */
  3541.   # include <stdarg.h>    /* for vararg definitions        */
  3542. ! # if ANY_UNIX
  3543.   #  include <unistd.h>    /* for read, write, ... prototypes    */
  3544.   # include <sys/wait.h>    /* for wait prototype            */
  3545.   # endif
  3546. --- 58,64 ----
  3547.   # include <string.h>    /* for str* prototypes            */
  3548.   # include <stdlib.h>    /* for atoi, system, malloc, free    */
  3549.   # include <stdarg.h>    /* for vararg definitions        */
  3550. ! # if ANY_UNIX || MINT
  3551.   #  include <unistd.h>    /* for read, write, ... prototypes    */
  3552.   # include <sys/wait.h>    /* for wait prototype            */
  3553.   # endif
  3554. ***************
  3555. *** 200,205 ****
  3556. --- 200,210 ----
  3557.   
  3558.   #if MSDOS
  3559.   extern char    o_pcbios[1];
  3560. + #endif
  3561. + #if MINT
  3562. + extern char    o_stbios[1];
  3563. + extern char    o_crlf[1];
  3564.   #endif
  3565.   
  3566.   #ifndef NO_SHOWMATCH
  3567. diff -c ./wildcard.c ../src/wildcard.c
  3568. *** ./wildcard.c    Tue May 12 14:40:12 1992
  3569. --- ../src/wildcard.c    Sun Aug  9 21:12:58 1992
  3570. ***************
  3571. *** 57,63 ****
  3572. --- 57,69 ----
  3573.   #define    MAXFILES    1000
  3574.   
  3575.   int pstrcmp();
  3576. + #ifdef __STDC__
  3577. + #include <string.h>
  3578. + #include <stdlib.h>
  3579. + #else
  3580.   extern char *calloc();
  3581. + #endif
  3582.   
  3583.   char *files[MAXFILES];
  3584.   int nfiles;
  3585. ***************
  3586. *** 96,102 ****
  3587.   }    
  3588.   #endif
  3589.   
  3590. ! expand(name)
  3591.       char *name;
  3592.   {
  3593.       char *filespec;
  3594. --- 102,108 ----
  3595.   }    
  3596.   #endif
  3597.   
  3598. ! int expand(name)
  3599.       char *name;
  3600.   {
  3601.       char *filespec;
  3602. ***************
  3603. *** 139,153 ****
  3604.       }
  3605.   }
  3606.   
  3607. ! addfile(buf)
  3608.       char *buf;
  3609.   {
  3610.       char *p;
  3611.   
  3612.       for (p=buf; *p; p++)
  3613.           *p=tolower(*p);
  3614. !     if (nfiles<MAXFILES && (files[nfiles]=calloc(strlen(buf)+1, 1))!=0)
  3615.           strcpy(files[nfiles++], buf);
  3616.   }
  3617.   
  3618. --- 145,167 ----
  3619.       }
  3620.   }
  3621.   
  3622. ! #if MINT
  3623. ! extern    int __mint;
  3624. ! #endif
  3625. ! int addfile(buf)
  3626.       char *buf;
  3627.   {
  3628.       char *p;
  3629.   
  3630. + #if MINT
  3631. +     /* there are filesystems on MiNT that are case sensitive... and for
  3632. +        the vanilla GEMDOS fs MiNT already does this conversion itself  */
  3633. +     if (!__mint)
  3634. + #endif
  3635.       for (p=buf; *p; p++)
  3636.           *p=tolower(*p);
  3637. !     if (nfiles<MAXFILES && (files[nfiles]=calloc(strlen(buf)+1, (size_t) 1))!=0)
  3638.           strcpy(files[nfiles++], buf);
  3639.   }
  3640.   
  3641.