home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume8 / ue310usp / patches < prev    next >
Encoding:
Text File  |  1989-09-23  |  24.6 KB  |  1,028 lines

  1. *** bind.c.orig    Sat Sep 16 22:32:05 1989
  2. --- bind.c    Sun Sep 17 01:53:53 1989
  3. ***************
  4. *** 785,790 ****
  5. --- 785,795 ----
  6.           *ptr++ = '^';
  7.       }
  8.   
  9. +     if ((c & 255) == 0x7F) {
  10. +         *ptr++ = '^';
  11. +         c = '?';
  12. +     }
  13.       c = c & 255;    /* strip the prefixes */
  14.   
  15.       /* and output the final sequence */
  16. ***************
  17. *** 910,916 ****
  18.   
  19.       Meta and ^X prefix of lower case letters are converted to upper
  20.       case.  Real control characters are automatically converted to
  21. !     the ^A form.
  22.   */
  23.   
  24.   unsigned int PASCAL NEAR stock(keyname)
  25. --- 915,921 ----
  26.   
  27.       Meta and ^X prefix of lower case letters are converted to upper
  28.       case.  Real control characters are automatically converted to
  29. !     the ^A form.  '^?' is converted to DEL (0x7F).
  30.   */
  31.   
  32.   unsigned int PASCAL NEAR stock(keyname)
  33. ***************
  34. *** 963,969 ****
  35.   
  36.       /* a control char?  (Always upper case) */
  37.       if (*keyname == '^' && *(keyname+1) != 0) {
  38. !         c |= CTRL;
  39.           ++keyname;
  40.           uppercase(keyname);
  41.       }
  42. --- 968,977 ----
  43.   
  44.       /* a control char?  (Always upper case) */
  45.       if (*keyname == '^' && *(keyname+1) != 0) {
  46. !         if (keyname[1] == '?')
  47. !             c |= 0x7F;
  48. !         else
  49. !             c |= CTRL;
  50.           ++keyname;
  51.           uppercase(keyname);
  52.       }
  53. ***************
  54. *** 980,986 ****
  55.           uppercase(keyname);        /* Then make sure it's upper case */
  56.   
  57.       /* the final sequence... */
  58. !     c |= *keyname;
  59.       return(c);
  60.   }
  61.   
  62. --- 988,995 ----
  63.           uppercase(keyname);        /* Then make sure it's upper case */
  64.   
  65.       /* the final sequence... */
  66. !     if ((c & 255) != 0x7f)
  67. !         c |= *keyname;
  68.       return(c);
  69.   }
  70.   
  71. *** display.c.orig    Sat Sep 16 23:15:39 1989
  72. --- display.c    Sat Sep 16 23:51:59 1989
  73. ***************
  74. *** 11,16 ****
  75. --- 11,19 ----
  76.   #include    "etype.h"
  77.   #include    "edef.h"
  78.   #include    "elang.h"
  79. + #if VARARGS
  80. + #include    <varargs.h>
  81. + #endif
  82.   
  83.   typedef struct    VIDEO {
  84.       int    v_flag;         /* Flags */
  85. ***************
  86. *** 1091,1096 ****
  87. --- 1094,1106 ----
  88.   #define    ADJUST(ptr, dtype)    ptr += sizeof(dtype)
  89.   #endif
  90.   
  91. + #if VARARGS
  92. + CDECL NEAR mlwrite(va_alist)
  93. + va_dcl
  94. + {
  95. +     va_list ap;
  96. +     char *fmt;
  97. + #else
  98.   CDECL NEAR mlwrite(fmt, arg)
  99.   
  100.   char *fmt;    /* format string for output */
  101. ***************
  102. *** 1097,1104 ****
  103.   char *arg;    /* pointer to first argument to print */
  104.   
  105.   {
  106. -     register int c;     /* current char in format string */
  107.       register char *ap;    /* ptr to current data field */
  108.   
  109.       /* if we are not currently echoing on the command line, abort this */
  110.       if (discmd == FALSE)
  111. --- 1107,1115 ----
  112.   char *arg;    /* pointer to first argument to print */
  113.   
  114.   {
  115.       register char *ap;    /* ptr to current data field */
  116. + #endif
  117. +     register int c;     /* current char in format string */
  118.   
  119.       /* if we are not currently echoing on the command line, abort this */
  120.       if (discmd == FALSE)
  121. ***************
  122. *** 1116,1124 ****
  123. --- 1127,1141 ----
  124.           TTflush();
  125.       }
  126.   
  127. + #if VARARGS
  128. +     va_start(ap);
  129. +     fmt = va_arg(ap, char *);
  130. + #endif
  131.       movecursor(term.t_nrow, 0);
  132.        lastptr = &lastmesg[0];        /* setup to record message */
  133. + #if !VARARGS
  134.       ap = (char *) &arg;
  135. + #endif
  136.       while ((c = *fmt++) != 0) {
  137.           if (c != '%') {
  138.               mlout(c);
  139. ***************
  140. *** 1127,1159 ****
  141. --- 1144,1200 ----
  142.               c = *fmt++;
  143.               switch (c) {
  144.                   case 'd':
  145. + #if VARARGS
  146. +                     mlputi(va_arg(ap, int), 10);
  147. + #else
  148.                       mlputi(*(int *)ap, 10);
  149.                               ADJUST(ap, int);
  150. + #endif
  151.                       break;
  152.   
  153.                   case 'o':
  154. + #if VARARGS
  155. +                     mlputi(va_arg(ap, int), 8);
  156. + #else
  157.                       mlputi(*(int *)ap,  8);
  158.                       ADJUST(ap, int);
  159. + #endif
  160.                       break;
  161.   
  162.                   case 'x':
  163. + #if VARARGS
  164. +                     mlputi(va_arg(ap, int), 16);
  165. + #else
  166.                       mlputi(*(int *)ap, 16);
  167.                       ADJUST(ap, int);
  168. + #endif
  169.                       break;
  170.   
  171.                   case 'D':
  172. + #if VARARGS
  173. +                     mlputli(va_arg(ap, long), 10);
  174. + #else
  175.                       mlputli(*(long *)ap, 10);
  176.                       ADJUST(ap, long);
  177. + #endif
  178.                       break;
  179.   
  180.                   case 's':
  181. + #if VARARGS
  182. +                     mlputs(va_arg(ap, char *));
  183. + #else
  184.                       mlputs(*(char **)ap);
  185.                       ADJUST(ap, char *);
  186. + #endif
  187.                       break;
  188.   
  189.                   case 'f':
  190. + #if VARARGS
  191. +                     mlputf(va_arg(ap, int));
  192. + #else
  193.                       mlputf(*(int *)ap);
  194.                       ADJUST(ap, int);
  195. + #endif
  196.                       break;
  197.   
  198.                   default:
  199. *** ebind.h.orig    Sat Sep 16 23:37:51 1989
  200. --- ebind.h    Sat Sep 16 23:38:17 1989
  201. ***************
  202. *** 78,84 ****
  203.       {CTLX|'A',        BINDFNC,    setvar},
  204.       {CTLX|'B',        BINDFNC,    usebuffer},
  205.       {CTLX|'C',        BINDFNC,    spawncli},
  206. ! #if    BSD
  207.       {CTLX|'D',        BINDFNC,    bktoshell},
  208.   #endif
  209.       {CTLX|'E',        BINDFNC,    ctlxe},
  210. --- 78,84 ----
  211.       {CTLX|'A',        BINDFNC,    setvar},
  212.       {CTLX|'B',        BINDFNC,    usebuffer},
  213.       {CTLX|'C',        BINDFNC,    spawncli},
  214. ! #if    JOBCTRL
  215.       {CTLX|'D',        BINDFNC,    bktoshell},
  216.   #endif
  217.       {CTLX|'E',        BINDFNC,    ctlxe},
  218. *** edef.h.orig    Thu Jun 15 14:13:52 1989
  219. --- edef.h    Thu Jun 15 14:10:28 1989
  220. ***************
  221. *** 41,47 ****
  222.   NOSHARE int DNEAR sscroll = FALSE;    /* smooth scrolling enabled flag*/
  223.   NOSHARE int DNEAR hscroll = TRUE;    /* horizontal scrolling flag    */
  224.   NOSHARE int DNEAR hjump = 1;        /* horizontal jump size     */
  225. ! NOSHARE int DNEAR ssave = TRUE;     /* safe save flag        */
  226.   NOSHARE struct BUFFER *bstore = NULL;    /* buffer to store macro text to*/
  227.   NOSHARE int DNEAR vtrow = 0;        /* Row location of SW cursor    */
  228.   NOSHARE int DNEAR vtcol = 0;        /* Column location of SW cursor */
  229. --- 41,47 ----
  230.   NOSHARE int DNEAR sscroll = FALSE;    /* smooth scrolling enabled flag*/
  231.   NOSHARE int DNEAR hscroll = TRUE;    /* horizontal scrolling flag    */
  232.   NOSHARE int DNEAR hjump = 1;        /* horizontal jump size     */
  233. ! NOSHARE int DNEAR ssave = FALSE;     /* safe save flag        */
  234.   NOSHARE struct BUFFER *bstore = NULL;    /* buffer to store macro text to*/
  235.   NOSHARE int DNEAR vtrow = 0;        /* Row location of SW cursor    */
  236.   NOSHARE int DNEAR vtcol = 0;        /* Column location of SW cursor */
  237. *** efunc.h.orig    Sat Sep 16 23:38:37 1989
  238. --- efunc.h    Sat Sep 16 23:39:07 1989
  239. ***************
  240. *** 229,235 ****
  241.   #if    PROC
  242.       {"store-procedure",        storeproc},
  243.   #endif
  244. ! #if    BSD
  245.       {"suspend-emacs",        bktoshell},
  246.   #endif
  247.       {"transpose-characters",    twiddle},
  248. --- 229,235 ----
  249.   #if    PROC
  250.       {"store-procedure",        storeproc},
  251.   #endif
  252. ! #if    JOBCTRL
  253.       {"suspend-emacs",        bktoshell},
  254.   #endif
  255.       {"transpose-characters",    twiddle},
  256. *** input.c.orig    Thu Jun 15 14:05:11 1989
  257. --- input.c    Mon Aug 14 13:20:59 1989
  258. ***************
  259. *** 46,51 ****
  260. --- 46,59 ----
  261.   #include    "edef.h"
  262.   #include    "elang.h"
  263.   
  264. + #if USG | BSD | V7
  265. + #include    <pwd.h>
  266. + extern    struct passwd *getpwnam();
  267. + #if USG
  268. + #define    index    strchr
  269. + #endif
  270. + #endif
  271.   /*
  272.    * Ask a yes or no question in the message line. Return either TRUE, FALSE, or
  273.    * ABORT. The ABORT status is returned if the user bumps out of the question
  274. ***************
  275. *** 209,214 ****
  276. --- 217,227 ----
  277.       register int c;        /* current input character */
  278.       int cpos;        /* current column on screen output */
  279.       static char buf[NSTRING];/* buffer to hold tentative name */
  280. + #if USG | BSD | V7
  281. +     char *home;
  282. +     struct passwd *pwd;
  283. + #endif
  284.   #if    COMPLET == 0
  285.       int status;
  286.   #endif
  287. ***************
  288. *** 306,313 ****
  289.               TTflush();
  290.               if (buf[cpos - 1] == 0)
  291.                   return(buf);
  292.           } else {
  293. !             if (cpos < maxlen && c > ' ') {
  294.                   buf[cpos++] = c;
  295.                   mlout(c);
  296.                   ++ttcol;
  297. --- 319,394 ----
  298.               TTflush();
  299.               if (buf[cpos - 1] == 0)
  300.                   return(buf);
  301. + #if USG | BSD | V7
  302. +         } else if (c == '/' && type == CMP_FILENAME && buf[0] == '~') {
  303. +             int i;
  304. +             if (cpos == 1) {
  305. +                 if (home = (char *)getenv("HOME")) {
  306. +                     mlout('\b');    /* backup over ~ */
  307. +                     mlout(' ');
  308. +                     mlout('\b');
  309. +                     ttcol--;
  310. +                     TTflush();
  311. +                     strcpy(buf, home);
  312. +                     cpos = strlen(buf);
  313. +                     buf[cpos++] = '/';
  314. +                     for (i = 0; i < cpos; i++) {
  315. +                         mlout(buf[i]);
  316. +                         ttcol++;
  317. +                     }
  318. +                     TTflush();
  319. +                 } else
  320. +                     goto nextc;
  321. +             } else {
  322. +                 buf[cpos] = '\0';
  323. +                 if (pwd = getpwnam(&buf[1])) {
  324. +                     while (cpos != 0) {    /* kill    */
  325. +                         mlout('\b');    /* line    */
  326. +                         mlout(' ');
  327. +                         mlout('\b');
  328. +                         --cpos;
  329. +                         --ttcol;
  330. +                     }
  331. +                     TTflush();
  332. +                     strcpy(buf, pwd->pw_dir);
  333. +                     cpos = strlen(buf);
  334. +                     buf[cpos++] = '/';
  335. +                     for (i = 0; i < cpos; i++) {
  336. +                      mlout(buf[i]);
  337. +                         ttcol++;
  338. +                     }
  339. +                     TTflush();
  340. +                 } else
  341. +                     goto nextc;
  342. +             }
  343. +         } else if (c == '/' && type == CMP_FILENAME && buf[0] == '$') {
  344. +             int i;
  345. +             buf[cpos] = '\0';
  346. +             if (home = (char *)getenv(&buf[1])) {
  347. +                 while (cpos != 0) {    /* kill    */
  348. +                     mlout('\b');    /* line    */
  349. +                     mlout(' ');
  350. +                     mlout('\b');
  351. +                     --cpos;
  352. +                     --ttcol;
  353. +                 }
  354. +                 TTflush();
  355. +                 strcpy(buf, home);
  356. +                 cpos = strlen(buf);
  357. +                 buf[cpos++] = '/';
  358. +                 for (i = 0; i < cpos; i++) {
  359. +                     mlout(buf[i]);
  360. +                     ttcol++;
  361. +                 }
  362. +                 TTflush();
  363. +             } else
  364. +                 goto nextc;
  365. + #endif
  366.           } else {
  367. ! nextc:            if (cpos < maxlen && c > ' ') {
  368.                   buf[cpos++] = c;
  369.                   mlout(c);
  370.                   ++ttcol;
  371. ***************
  372. *** 476,542 ****
  373.   {
  374.       register char *fname;    /* trial file to complete */
  375.       register int index;    /* index into strings to compare */
  376. !     register char *match;    /* last file that matches string */
  377. !     register int matchflag;    /* did this file name match? */
  378. !     register int comflag;    /* was there a completion at all? */
  379. !     /* start attempting completions, one character at a time */
  380. !     comflag = FALSE;
  381. !     while (*cpos < NBUFN) {
  382. !         /* first, we start at the first file and scan the list */
  383. !         match = NULL;
  384. !         name[*cpos] = 0;
  385. !         fname = getffile(name);
  386. !         while (fname) {
  387. !             /* is this a match? */
  388. !             matchflag = TRUE;
  389. !             for (index = 0; index < *cpos; index++)
  390. !                 if (name[index] != fname[index]) {
  391. !                     matchflag = FALSE;
  392. !                     break;
  393. !                 }
  394. !             /* if it is a match */
  395. !             if (matchflag && index) {
  396. !                 /* if this is the first match, simply record it */
  397. !                 if (match == NULL) {
  398. !                     match = fname;
  399. !                     name[*cpos] = fname[*cpos];
  400. !                 } else {
  401. !                     /* if there's a difference, stop here */
  402. !                     if (name[*cpos] != fname[*cpos])
  403. !                         return;
  404. !                 }
  405. !             }
  406. !             /* on to the next file */
  407. !             fname = getnfile();
  408. !         }
  409. !         /* with no match, we are done */
  410. !         if (match == NULL) {
  411. !             /* beep if we never matched */
  412. !             if (comflag == FALSE)
  413. !                 TTbeep();
  414. !             return;
  415. !         }
  416.   
  417. !         /* if we have completed all the way... go back */
  418. !         if (name[*cpos] == 0) {
  419. !             (*cpos)++;
  420. !             return;
  421. !         }
  422.   
  423. !         /* remember we matched, and complete one character */
  424. !         comflag = TRUE;
  425. !         TTputc(name[(*cpos)++]);
  426. !         TTflush();
  427. !     }
  428.   
  429. -     /* don't allow a completion past the end of the max file name length */
  430.       return;
  431.   }
  432.   #endif
  433. --- 557,627 ----
  434.   {
  435.       register char *fname;    /* trial file to complete */
  436.       register int index;    /* index into strings to compare */
  437. !     register int matches;    /* number of matches for name */
  438. !     char longestmatch[NSTRING]; /* temp buffer for longest match */
  439. !     int longestlen;        /* length of longest match (always > *cpos) */
  440.   
  441. !     /* everything (or nothing) matches an empty string */
  442. !     if (*cpos == 0)
  443. !         return;
  444. !     /* first, we start at the first file and scan the list */
  445. !     matches = 0;
  446. !     name[*cpos] = 0;
  447. !     fname = getffile(name);
  448. !     while (fname) {
  449. !         /* is this a match? */
  450. !         if (strncmp(name,fname,*cpos) == 0) {
  451. !             /* count the number of matches */
  452. !             matches++;
  453. !             /* if this is the first match, simply record it */
  454. !             if (matches == 1) {
  455. !                 strcpy(longestmatch,fname);
  456. !                 longestlen = strlen(longestmatch);
  457. !             } else {
  458. !                 
  459. !                 /* if there's a difference, stop here */
  460. !                 if (longestmatch[*cpos] != fname[*cpos])
  461. !                     return;
  462. !                 for (index = (*cpos) + 1; index < longestlen; index++)
  463. !                     if (longestmatch[index] != fname[index]) {
  464. !                         longestlen = index;
  465. !                         longestmatch[longestlen] = 0;
  466. !                     }
  467. !             }
  468. !         }
  469. !         /* on to the next file */
  470. !         fname = getnfile();
  471. !     }
  472. !     /* beep if we never matched */
  473. !     if (matches == 0) {
  474. !         TTbeep();
  475. !         return;
  476. !     }
  477. !     /* the longestmatch array contains the longest match so copy and print it */
  478. !     for ( ; (*cpos < (NSTRING-1)) && (*cpos < longestlen); (*cpos)++) {
  479. !         name[*cpos] = longestmatch[*cpos];
  480. !         TTputc(name[*cpos]);
  481. !     }
  482. !     name[*cpos] = 0;
  483. !     /* if only one file matched then increment cpos to signal complete() */
  484. !     /* that this was a complete match.  If a directory was matched then */
  485. !     /* last character will be the DIRSEPCHAR.  In this case we do NOT *
  486. !     /* want to signal a complete match. */
  487. !     if ((matches == 1) && (name[(*cpos)-1] != DIRSEPCHAR))
  488. !         (*cpos)++;
  489.   
  490. !     TTflush();
  491.   
  492.       return;
  493.   }
  494.   #endif
  495. *** tcap.c.orig    Sat Sep 16 22:25:59 1989
  496. --- tcap.c    Sat Sep 16 22:26:18 1989
  497. ***************
  498. *** 413,419 ****
  499.       register int c;
  500.       register int index;    /* index into termcap binding table */
  501.       char *sp;
  502. ! #if    BSD | V7 | HPUX
  503.       int fdset;
  504.       struct timeval timeout;
  505.   #endif
  506. --- 413,419 ----
  507.       register int c;
  508.       register int index;    /* index into termcap binding table */
  509.       char *sp;
  510. ! #if    BSD | V7 | HPUX | SUN
  511.       int fdset;
  512.       struct timeval timeout;
  513.   #endif
  514. ***************
  515. *** 427,433 ****
  516.   
  517.       /* process a possible escape sequence */
  518.       /* set up to check the keyboard for input */
  519. ! #if    BSD | V7 | HPUX
  520.       fdset = 1;
  521.       timeout.tv_sec = 0;
  522.       timeout.tv_usec = 35000L;
  523. --- 427,433 ----
  524.   
  525.       /* process a possible escape sequence */
  526.       /* set up to check the keyboard for input */
  527. ! #if    BSD | V7 | HPUX | SUN
  528.       fdset = 1;
  529.       timeout.tv_sec = 0;
  530.       timeout.tv_usec = 35000L;
  531. ***************
  532. *** 438,444 ****
  533.           return(CTRL | '[');
  534.   #endif
  535.   
  536. ! #if XENIX | SUNOS
  537.       if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
  538.           nap(35000L);
  539.           if (rdchk(0) <= 0)
  540. --- 438,444 ----
  541.           return(CTRL | '[');
  542.   #endif
  543.   
  544. ! #if XENIX
  545.       if ((kbdmode != PLAY) && (rdchk(0) <= 0)) {
  546.           nap(35000L);
  547.           if (rdchk(0) <= 0)
  548. *** unix.c.orig    Thu May 11 13:09:36 1989
  549. --- unix.c    Sun Sep 17 00:06:10 1989
  550. ***************
  551. *** 15,21 ****
  552. --- 15,28 ----
  553.   #include    <signal.h>
  554.   #include    <termio.h>
  555.   #include    <fcntl.h>
  556. + #include    <sys/types.h>
  557. + #include    <sys/stat.h>
  558. + #if    DIRENT
  559. + #include    <dirent.h>
  560. + #define direct dirent
  561. + #else
  562.   #include    <ndir.h>
  563. + #endif
  564.   int kbdflgs;            /* saved keyboard fd flags    */
  565.   int kbdpoll;            /* in O_NDELAY mode            */
  566.   int kbdqp;            /* there is a char in kbdq    */
  567. ***************
  568. *** 42,55 ****
  569.   
  570.   #if BSD
  571.   #include <sys/ioctl.h>        /* to get at the typeahead */
  572. - extern    int rtfrmshell();    /* return from suspended shell */
  573.   #define    TBUFSIZ    128
  574.   char tobuf[TBUFSIZ];        /* terminal output buffer */
  575.   #endif
  576.   #endif
  577.   
  578.   #if     V7 | USG | HPUX | SUN | XENIX | BSD
  579. - #include        <signal.h>
  580.   extern int vttidy();
  581.   #endif
  582.   
  583. --- 49,64 ----
  584.   
  585.   #if BSD
  586.   #include <sys/ioctl.h>        /* to get at the typeahead */
  587.   #define    TBUFSIZ    128
  588.   char tobuf[TBUFSIZ];        /* terminal output buffer */
  589.   #endif
  590.   #endif
  591.   
  592. + #if JOBCTRL
  593. + extern    int rtfrmshell();    /* return from suspended shell */
  594. + #endif
  595.   #if     V7 | USG | HPUX | SUN | XENIX | BSD
  596.   extern int vttidy();
  597.   #endif
  598.   
  599. ***************
  600. *** 75,80 ****
  601. --- 84,94 ----
  602.       kbdpoll = FALSE;
  603.   #endif
  604.   
  605. + #if    JOBCTRL
  606. +     signal(SIGTSTP,SIG_DFL);    /* set signals so that we can */
  607. +     signal(SIGCONT,rtfrmshell);    /* suspend & restart emacs */
  608. + #endif
  609.   #if     V7 | BSD
  610.           gtty(0, &ostate);                       /* save old state */
  611.           gtty(0, &nstate);                       /* get base of new state */
  612. ***************
  613. *** 87,96 ****
  614.       /* provide a smaller terminal output buffer so that
  615.          the type ahead detection works better (more often) */
  616.       setbuffer(stdout, &tobuf[0], TBUFSIZ);
  617. -     signal(SIGTSTP,SIG_DFL);    /* set signals so that we can */
  618. -     signal(SIGCONT,rtfrmshell);    /* suspend & restart emacs */
  619.   #endif
  620.   #endif
  621.       /* on all screens we are not sure of the initial position
  622.          of the cursor                    */
  623.       ttrow = 999;
  624. --- 101,112 ----
  625.       /* provide a smaller terminal output buffer so that
  626.          the type ahead detection works better (more often) */
  627.       setbuffer(stdout, &tobuf[0], TBUFSIZ);
  628.   #endif
  629.   #endif
  630. +     /* if we spawn a subshell we don't want to die if the user hits
  631. +        the interrupt or quit keys */
  632. +     signal(SIGINT, SIG_IGN);
  633. +     signal(SIGQUIT, SIG_IGN);
  634.       /* on all screens we are not sure of the initial position
  635.          of the cursor                    */
  636.       ttrow = 999;
  637. ***************
  638. *** 217,223 ****
  639.           if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
  640.               return(FALSE);
  641.           kbdpoll = TRUE;
  642. !         kbdqp = (1 == read(0, kbdq, 1));
  643.       }
  644.       return(kbdqp);
  645.   #endif
  646. --- 233,239 ----
  647.           if (fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0 && kbdpoll)
  648.               return(FALSE);
  649.           kbdpoll = TRUE;
  650. !         kbdqp = (1 == read(0, &kbdq, 1));
  651.       }
  652.       return(kbdqp);
  653.   #endif
  654. ***************
  655. *** 259,265 ****
  656.           return(TRUE);
  657.   }
  658.   
  659. ! #if    BSD
  660.   
  661.   bktoshell()        /* suspend MicroEMACS and wait to wake up */
  662.   {
  663. --- 275,281 ----
  664.           return(TRUE);
  665.   }
  666.   
  667. ! #if    JOBCTRL
  668.   
  669.   bktoshell()        /* suspend MicroEMACS and wait to wake up */
  670.   {
  671. ***************
  672. *** 299,311 ****
  673.           TTclose();                              /* stty to old modes    */
  674.           system(line);
  675.           TTopen();
  676. !         TTflush();
  677.       /* if we are interactive, pause here */
  678.       if (clexec == FALSE) {
  679.               mlputs(TEXT6);
  680.   /*                     "\r\n\n[End]" */
  681.               tgetc();
  682.           }
  683.           sgarbf = TRUE;
  684.           return(TRUE);
  685.   }
  686. --- 315,329 ----
  687.           TTclose();                              /* stty to old modes    */
  688.           system(line);
  689.           TTopen();
  690. !         movecursor(term.t_nrow, 0);             /* Seek to last line.   */
  691.       /* if we are interactive, pause here */
  692.       if (clexec == FALSE) {
  693.               mlputs(TEXT6);
  694.   /*                     "\r\n\n[End]" */
  695. +             TTflush();
  696.               tgetc();
  697.           }
  698. +     TTflush();
  699.           sgarbf = TRUE;
  700.           return(TRUE);
  701.   }
  702. ***************
  703. *** 317,323 ****
  704.    */
  705.   
  706.   execprg(f, n)
  707.   {
  708.           register int    s;
  709.           char            line[NLINE];
  710. --- 335,340 ----
  711. ***************
  712. *** 326,348 ****
  713.       if (restflag)
  714.           return(resterr());
  715.   
  716. !         if ((s=mlreply("!", line, NLINE)) != TRUE)
  717.                   return(s);
  718.           TTputc('\n');                /* Already have '\r'    */
  719.           TTflush();
  720.           TTclose();                              /* stty to old modes    */
  721. !         system(line);
  722.           TTopen();
  723. !         mlputs(TEXT188);                        /* Pause.               */
  724. ! /*             "[End]" */
  725. !         TTflush();
  726. !         while ((s = tgetc()) != '\r' && s != ' ')
  727. !                 ;
  728.           sgarbf = TRUE;
  729.           return(TRUE);
  730.   }
  731.   
  732.   /*
  733.    * Pipe a one line command into a window
  734.    * Bound to ^X @
  735.    */
  736. --- 343,502 ----
  737.       if (restflag)
  738.           return(resterr());
  739.   
  740. !         if ((s=mlreply("$", line, NLINE)) != TRUE)
  741.                   return(s);
  742.           TTputc('\n');                /* Already have '\r'    */
  743.           TTflush();
  744.           TTclose();                              /* stty to old modes    */
  745. !         execpr(line);
  746.           TTopen();
  747. !         movecursor(term.t_nrow, 0);             /* Seek to last line.   */
  748. !     /* if we are interactive, pause here */
  749. !     if (clexec == FALSE) {
  750. !             mlputs(TEXT188);
  751. ! /*                     "[End]" */
  752. !             TTflush();
  753. !             tgetc();
  754. !         }
  755. !     TTflush();
  756.           sgarbf = TRUE;
  757.           return(TRUE);
  758.   }
  759.   
  760.   /*
  761. +  * Run a program with arguments without using a shell.
  762. +  * Line is a string containing a program name and arguments, separated
  763. +  * by whitespace.  Shell metacharacters have no special meaning.
  764. +  */
  765. + execpr(line)
  766. +     char           *line;
  767. + {
  768. +     char          **stov();
  769. +     char          **argv;
  770. +     char           *cp;    /* A copy of the line in case it's $SHELL. */
  771. +     int             pid;
  772. +     if (line == 0 || *line == 0)
  773. +         return;
  774. +     cp = malloc(strlen(line) + 1);
  775. +     strcpy(cp, line);
  776. +     argv = stov(cp);
  777. +     pid = fork();
  778. +     switch (pid) {
  779. +     case -1:
  780. +         break;
  781. +     case 0:        /* Child. */
  782. +         signal(SIGINT, SIG_DFL);
  783. +         signal(SIGQUIT, SIG_DFL);
  784. +         execvp(argv[0], argv);
  785. +         /* Might want to print "argv[0]: Command not found.\n". */
  786. +         exit(0);
  787. +     default:        /* Parent. */
  788. +         while (wait((int *) 0) != pid)
  789. +              /* Do nothing. */ ;
  790. +         break;
  791. +     }
  792. +     free(argv);
  793. +     free(cp);
  794. + }
  795. + /* Number of arguments between realloc's. */
  796. + #define ALLOC_BLOCK 10
  797. + /*
  798. +  * Make an argv-like vector (string array) from a string (such as an
  799. +  * environment variable).  The last element of the vector is null.
  800. +  * Scatters nulls throughout s.
  801. +  */
  802. + char **
  803. + stov(s)
  804. +     char           *s;    /* The string to vectorize. */
  805. + {
  806. +     char           *malloc(), *realloc(), *strtok();
  807. +     int             argc;
  808. +     char          **argv;
  809. +     argc = 0;
  810. +     argv = (char **) malloc((unsigned) (sizeof(char *) * ALLOC_BLOCK));
  811. +     for (s = strtok(s, " \t\n\r"); s;
  812. +         s = strtok((char *) NULL, " \t\n\r")) {
  813. +         if (argc > 0 && argc % ALLOC_BLOCK == 0)
  814. +             argv = (char **) realloc((char *) argv, (unsigned)
  815. +                 (sizeof(char *) * (argc + ALLOC_BLOCK)));
  816. +         argv[argc++] = s;
  817. +     }
  818. +     argv = (char **) realloc((char *) argv,
  819. +         (unsigned) (sizeof(char *) * (argc + 1)));
  820. +     argv[argc] = NULL;
  821. +     return argv;
  822. + }
  823. + #if V7 | BSD
  824. + /* Return the next token in string, delimited by one or more members of
  825. +    the set separators.  If string is NULL, use the same string as in the
  826. +    last call.  */
  827. + char *
  828. + strtok(string, separators)
  829. +     char           *string;
  830. +     char           *separators;
  831. + {
  832. +     static char    *pos = NULL;    /* Current location in the string. */
  833. +     register int    token_length;
  834. +     if (string)
  835. +         pos = string;
  836. +     pos += strspn(pos, separators);    /* Skip initial separators. */
  837. +     token_length = strcspn(pos, separators);    /* Find token length. */
  838. +     if (token_length == 0)
  839. +         return NULL;    /* No more tokens; pos is on a 0. */
  840. +     separators = pos;    /* Re-use separators to save start of token. */
  841. +     pos += token_length;    /* Move onto the 0. */
  842. +     if (*pos)        /* If not the last token, */
  843. +         *pos++ = 0;    /* null terminate the token. */
  844. +     return separators;
  845. + }
  846. + /* Return the length of the span of characters at the start of string
  847. +    that are members of class.  */
  848. + strspn(string, class)
  849. +     char           *string;
  850. +     char           *class;
  851. + {
  852. +     char           *index();
  853. +     register int    count;
  854. +     for (count = 0; string[count]; ++count)
  855. +         if (!index(class, string[count]))
  856. +             break;
  857. +     return count;
  858. + }
  859. + /* Return the length of the span of characters at the start of string
  860. +    that are non-members of class.  */
  861. + strcspn(string, class)
  862. +     char           *string;
  863. +     char           *class;
  864. + {
  865. +     char           *index();
  866. +     register int    count;
  867. +     for (count = 0; string[count]; ++count)
  868. +         if (index(class, string[count]))
  869. +             break;
  870. +     return count;
  871. + }
  872. + #endif
  873. + /*
  874.    * Pipe a one line command into a window
  875.    * Bound to ^X @
  876.    */
  877. ***************
  878. *** 529,534 ****
  879. --- 683,689 ----
  880.       register int index;        /* index into various strings */
  881.       register int point;        /* index into other strings */
  882.       register int extflag;        /* does the file have an extention? */
  883. +     int currentdir = FALSE;
  884.   
  885.       /* first parse the file path off the file spec */
  886.       strcpy(path, fspec);
  887. ***************
  888. *** 537,542 ****
  889. --- 692,704 ----
  890.                   path[index] != '\\' && path[index] != ':'))
  891.           --index;
  892.       path[index+1] = 0;
  893. + #if HPUX
  894. +     if (index < 0) {
  895. +         strcpy(path,"./");
  896. +         index = 1;
  897. +         currentdir = TRUE;
  898. +     }
  899. + #endif
  900.   
  901.       /* check for an extension */
  902.       point = strlen(fspec) - 1;
  903. ***************
  904. *** 554,563 ****
  905.           closedir(dirptr);
  906.           dirptr = NULL;
  907.       }
  908. !     dirptr = opendir(path);
  909.       if (dirptr == NULL)
  910.           return(NULL);
  911.   
  912.       strcpy(rbuf, path);
  913.       nameptr = &rbuf[strlen(rbuf)];
  914.   
  915. --- 716,733 ----
  916.           closedir(dirptr);
  917.           dirptr = NULL;
  918.       }
  919. !     if (path[0])
  920. !         dirptr = opendir(path);
  921. !     else
  922. !         dirptr = opendir(".");
  923.       if (dirptr == NULL)
  924.           return(NULL);
  925.   
  926. + #if HPUX
  927. +     if (currentdir == TRUE)
  928. +         path[0] = '\0';
  929. + #endif
  930.       strcpy(rbuf, path);
  931.       nameptr = &rbuf[strlen(rbuf)];
  932.   
  933. ***************
  934. *** 580,591 ****
  935.       /* check to make sure we skip directory entries */
  936.       strcpy(nameptr, dp->d_name);
  937.       stat(rbuf, &fstat);
  938. !     if ((fstat.st_mode & S_IFMT) != S_IFREG)
  939.           goto nxtdir;
  940.   
  941.       /* return the next file name! */
  942.       return(rbuf);
  943.   }
  944.   #else
  945.   char *PASCAL NEAR getffile(fspec)
  946.   
  947. --- 750,766 ----
  948.       /* check to make sure we skip directory entries */
  949.       strcpy(nameptr, dp->d_name);
  950.       stat(rbuf, &fstat);
  951. !     if (((fstat.st_mode & S_IFMT) != S_IFREG) &&
  952. !         ((fstat.st_mode & S_IFMT) != S_IFDIR))
  953.           goto nxtdir;
  954.   
  955. +     if ((fstat.st_mode & S_IFMT) == S_IFDIR)
  956. +         strcat(rbuf,"/");
  957.       /* return the next file name! */
  958.       return(rbuf);
  959.   }
  960.   #else
  961.   char *PASCAL NEAR getffile(fspec)
  962.   
  963. *** estruct.h.orig    Tue Sep 19 11:44:15 1989
  964. --- estruct.h    Tue Sep 19 11:45:37 1989
  965. ***************
  966. *** 52,57 ****
  967. --- 52,62 ----
  968.   #define WMCS    0            /* Wicat's MCS            */
  969.   #define    AOSVS    0            /* Data General AOS/VS        */
  970.   
  971. + /* Additional settings for Unix systems        */
  972. + #define DIRENT  1            /* has POSIX <dirent.h> library    */
  973. + #define JOBCTRL    0            /* has BSD job control        */
  974. + #define VARARGS    1            /* has Unix <varargs.h>        */
  975.   /*    Compiler definitions            */
  976.   /*    [Set one of these!!]            */
  977.   #define UNIX    0    /* a random UNIX compiler */
  978.