home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / source / ms_sh16.lzh / ms_sh.5 < prev    next >
Text File  |  1990-05-06  |  39KB  |  1,588 lines

  1.  
  2. #!/bin/sh
  3. # this is part 5 of a multipart archive
  4. # do not concatenate these parts, unpack them in order with /bin/sh
  5. # file Patch1.6 continued
  6. #
  7. CurArch=5
  8. if test ! -r s2_seq_.tmp
  9. then echo "Please unpack part 1 first!"
  10.      exit 1; fi
  11. ( read Scheck
  12.   if test "$Scheck" != $CurArch
  13.   then echo "Please unpack part $Scheck next!"
  14.        exit 1;
  15.   else exit 0; fi
  16. ) < s2_seq_.tmp || exit 1
  17. echo "x - Continuing file Patch1.6"
  18. sed 's/^X//' << 'SHAR_EOF' >> Patch1.6
  19. X      int        i = (int)strtol (cp, &ep, 10);
  20. X  
  21. X! /* Get the previous command ? (single !) */
  22. X  
  23. X!     if (c_len == 0)
  24. X      {
  25. X      if (c_history < 0)
  26. X-     {
  27. X-         M_length = -1;
  28. X          return Re_start (No_prehistory);
  29. X-     }
  30. X  
  31. X      return TRUE;
  32. X      }
  33. X--- 793,811 ----
  34. X  
  35. X  static bool    Scan_History ()
  36. X  {
  37. X!     char    *cp = l_buffer + 1;
  38. X      char    *ep;
  39. X      int        i = (int)strtol (cp, &ep, 10);
  40. X  
  41. X! /* Get the previous command ? (single ! or double !!) */
  42. X  
  43. X!     if ((M_length == 0) || (*cp == '!'))
  44. X      {
  45. X+     if (c_history >= l_history)
  46. X+         c_history = l_history - 1;
  47. X+ 
  48. X      if (c_history < 0)
  49. X          return Re_start (No_prehistory);
  50. X  
  51. X      return TRUE;
  52. X      }
  53. X***************
  54. X*** 627,640 ****
  55. X  /* Request for special history number item.  Check History file empty */
  56. X  
  57. X      if (l_history == 0)
  58. X-     {
  59. X-     M_length = -1;
  60. X      return Re_start (No_MatchHistory);
  61. X-     }
  62. X  
  63. X  /* Check for number */
  64. X  
  65. X!     if (!*ep)
  66. X      {
  67. X      M_length = -1;
  68. X  
  69. X--- 813,823 ----
  70. X  /* Request for special history number item.  Check History file empty */
  71. X  
  72. X      if (l_history == 0)
  73. X      return Re_start (No_MatchHistory);
  74. X  
  75. X  /* Check for number */
  76. X  
  77. X!     if ((*l_buffer == '!') && (ep > cp) && M_length)
  78. X      {
  79. X      M_length = -1;
  80. X  
  81. X***************
  82. X*** 648,654 ****
  83. X      else
  84. X      {
  85. X      for (c_history = l_history - 1;
  86. X!         (strncmp (cp, cmd_history[c_history].command, c_len) != 0)
  87. X           && (c_history >= 0);
  88. X          --c_history);
  89. X      }
  90. X--- 831,837 ----
  91. X      else
  92. X      {
  93. X      for (c_history = l_history - 1;
  94. X!         (strncmp (cp, cmd_history[c_history].command, M_length) != 0)
  95. X           && (c_history >= 0);
  96. X          --c_history);
  97. X      }
  98. X***************
  99. X*** 674,680 ****
  100. X  
  101. X      if (l_history == 0)
  102. X      {
  103. X-     M_length = -1;
  104. X      Re_start (No_MatchHistory);
  105. X      return;
  106. X      }
  107. X--- 857,862 ----
  108. X***************
  109. X*** 686,692 ****
  110. X  
  111. X  /* Anything found ? */
  112. X  
  113. X!     if ((c_history < 0) || (c_history == l_history))
  114. X      {
  115. X      c_history = l_history - 1;
  116. X      Re_start (No_MatchHistory);
  117. X--- 868,874 ----
  118. X  
  119. X  /* Anything found ? */
  120. X  
  121. X!     if ((c_history < 0) || (c_history >= l_history))
  122. X      {
  123. X      c_history = l_history - 1;
  124. X      Re_start (No_MatchHistory);
  125. X***************
  126. X*** 712,719 ****
  127. X      l_history = 0;            /* End of history array        */
  128. X  
  129. X      if ((lset = lookup (history_file, TRUE))->value == null)
  130. X!     setval (lset, strcat (strcpy (l_buffer, lookup (home, FALSE)->value),
  131. X!                   "history.sh"));
  132. X  
  133. X      if (!History_Enabled || ((fp = fopen (lset->value, "rt")) == (FILE *)NULL))
  134. X      return;
  135. X--- 894,903 ----
  136. X      l_history = 0;            /* End of history array        */
  137. X  
  138. X      if ((lset = lookup (history_file, TRUE))->value == null)
  139. X!     {
  140. X!     setval (lset, (cp = Build_H_Filename ("history.sh")));
  141. X!     DELETE (cp);
  142. X!     }
  143. X  
  144. X      if (!History_Enabled || ((fp = fopen (lset->value, "rt")) == (FILE *)NULL))
  145. X      return;
  146. X***************
  147. X*** 844,849 ****
  148. X--- 1028,1036 ----
  149. X  {
  150. X      if (cp != (char *)NULL)
  151. X      {
  152. X+     if (strlen (l_buffer) && (s_cursor != -1))
  153. X+         S_putc (NL);
  154. X+ 
  155. X      print_warn (cp);
  156. X      erase_to_end_of_line ();
  157. X      v1_putc (NL);
  158. X***************
  159. X*** 853,862 ****
  160. X  
  161. X  /* Re-initialise */
  162. X  
  163. X!     c_buffer_pos = l_buffer;
  164. X!     end_buffer = l_buffer;
  165. X!     read_cursor_position ();
  166. X! 
  167. X      return FALSE;
  168. X  }
  169. X  
  170. X--- 1040,1046 ----
  171. X  
  172. X  /* Re-initialise */
  173. X  
  174. X!     Init_Input (insert_mode);
  175. X      return FALSE;
  176. X  }
  177. X  
  178. X***************
  179. X*** 869,872 ****
  180. X--- 1053,1458 ----
  181. X  {
  182. X      while (cnt--)
  183. X      *(sp1--) =  *(sp--);
  184. X+ }
  185. X+ 
  186. X+ /* Complete file name */
  187. X+ 
  188. X+ static bool    Complete_file (fn_start, fn_search)
  189. X+ char        *fn_start;
  190. X+ bool        fn_search;
  191. X+ {
  192. X+     char        *fn_end, *cp, *fn_mstart, fn_es, *fn_dir;
  193. X+     int            fn_len, pre_len, i;
  194. X+     DIR            *dn;
  195. X+     char        d_name [NAME_MAX + 1];
  196. X+     struct dirent    *d_ce;
  197. X+     int            found_cnt = 0;
  198. X+     int            max_per_line;
  199. X+     static char        *ms_drive = "a:/";
  200. X+ 
  201. X+     while (!isspace (*fn_start) && (fn_start != l_buffer))
  202. X+     --fn_start;
  203. X+     
  204. X+     if (isspace (*fn_start))
  205. X+     ++fn_start;
  206. X+ 
  207. X+     fn_end = fn_start;
  208. X+ 
  209. X+     while (!isspace (*fn_end) && (fn_end != end_buffer))
  210. X+     ++fn_end;
  211. X+ 
  212. X+ /* Get the directory name */
  213. X+ 
  214. X+     if (fn_end != end_buffer)
  215. X+     {
  216. X+     fn_es = *fn_end;
  217. X+     *fn_end = 0;
  218. X+     }
  219. X+ 
  220. X+ /* Find the directory name */
  221. X+ 
  222. X+     if ((cp = strrchr (fn_start, '/')) != (char *)NULL)
  223. X+     {
  224. X+     fn_mstart = cp + 1;
  225. X+     fn_dir = fn_start;
  226. X+     }
  227. X+ 
  228. X+ /* No directory flag - Drive specifier? */
  229. X+ 
  230. X+     else if (*(fn_start + 1) == ':')
  231. X+     {
  232. X+     *(fn_dir = ms_drive) = *fn_start;
  233. X+     *(fn_dir + 2) = '.';
  234. X+     fn_mstart = fn_start + 2;
  235. X+     }
  236. X+ 
  237. X+ /* No drive specifier */
  238. X+ 
  239. X+     else
  240. X+     {
  241. X+     fn_dir = ".";
  242. X+     fn_mstart = fn_start;
  243. X+     }
  244. X+ 
  245. X+ /* Set up some values - length and end */
  246. X+ 
  247. X+     fn_len = fn_end - fn_mstart;
  248. X+ 
  249. X+     if (fn_end != end_buffer)
  250. X+     *fn_end = fn_es;
  251. X+ 
  252. X+ /* Get the match length which must be nonzero unless we are doing a display
  253. X+  * of the directory
  254. X+  */
  255. X+ 
  256. X+     if (!fn_len && !fn_search)
  257. X+     {
  258. X+     v1_putc (0x07);
  259. X+     return FALSE;
  260. X+     }
  261. X+ 
  262. X+ /* Reset the / to a zero to terminate the directory name */
  263. X+ 
  264. X+     if (cp != (char *)NULL)
  265. X+     *cp = 0;
  266. X+ 
  267. X+ /* Check for some special cases - root */
  268. X+ 
  269. X+     if ((i = strlen (fn_dir)) == 0)
  270. X+     fn_dir = "/";
  271. X+ 
  272. X+     else if ((i == 2) && (*(fn_dir + 1) == ':'))
  273. X+     {
  274. X+     *(fn_dir = ms_drive) = *fn_start;
  275. X+     *(fn_dir + 2) = '/';
  276. X+     }
  277. X+    
  278. X+ /* Get the prefix length and open the directory */
  279. X+ 
  280. X+     pre_len = fn_mstart - l_buffer;
  281. X+     dn = opendir (fn_dir);
  282. X+ 
  283. X+     if (cp != (char *)NULL)
  284. X+     *cp = '/';
  285. X+ 
  286. X+     if (dn == (DIR *)NULL)
  287. X+     {
  288. X+     v1_putc (0x07);
  289. X+     return FALSE;
  290. X+     }
  291. X+ 
  292. X+ /* Initialise the save buffer for a search or a match.  In the case of a
  293. X+  * search, we alway want to output NAME_MAX characters.  In the case of a
  294. X+  * match we want to know if we found it.
  295. X+  */
  296. X+ 
  297. X+     d_name[NAME_MAX] = 0;
  298. X+     *d_name = 0;
  299. X+     max_per_line = (Max_Cols / (((NAME_MAX / 8) + 1) * 8));
  300. X+ 
  301. X+ /* Scan the directory */
  302. X+ 
  303. X+     while ((d_ce = readdir (dn)) != (struct dirent *)NULL)
  304. X+     {
  305. X+     if (strnicmp (d_ce->d_name, fn_mstart, fn_len) == 0)
  306. X+     {
  307. X+ 
  308. X+ /* Are we displaying the directory or just searching */
  309. X+ 
  310. X+         if (fn_search)
  311. X+         {
  312. X+         v1_putc ((char)((found_cnt % max_per_line == 0) ? NL : '\t'));
  313. X+         memset (d_name, ' ', NAME_MAX);
  314. X+         memcpy (d_name, d_ce->d_name, strlen (d_ce->d_name));
  315. X+         v1_puts (d_name);
  316. X+         }
  317. X+ 
  318. X+ /* Just search - check for first entry match */
  319. X+ 
  320. X+         else if (!*d_name)
  321. X+         strcpy (d_name, d_ce->d_name);
  322. X+         
  323. X+         else
  324. X+         {
  325. X+         for (i = fn_len; d_name[i] == d_ce->d_name[i] ; i++);
  326. X+         d_name[i] = 0;
  327. X+         }
  328. X+ 
  329. X+ /* Increment counter */
  330. X+ 
  331. X+         ++found_cnt;
  332. X+     }
  333. X+     }
  334. X+ 
  335. X+     closedir (dn);
  336. X+ 
  337. X+ /* If we are searching and we found something - redraw */
  338. X+ 
  339. X+     if (fn_search && found_cnt)
  340. X+     {
  341. X+     v1_putc (NL);
  342. X+     put_prompt (last_prompt);
  343. X+     read_cursor_position ();
  344. X+     return TRUE;
  345. X+     }
  346. X+ 
  347. X+ /* Did I find anything? - no exit */
  348. X+ 
  349. X+     if (!*d_name)
  350. X+     {
  351. X+     v1_putc (0x07);
  352. X+     return FALSE;
  353. X+     }
  354. X+ 
  355. X+ /* Check that the line is not too long and if there is an end bit, we can
  356. X+  * save a copy of it.
  357. X+  */
  358. X+ 
  359. X+     cp = null;
  360. X+     fn_len = strlen (fn_end);
  361. X+ 
  362. X+     if (((fn_len + strlen (d_name) + pre_len) >= LINE_MAX) ||
  363. X+     ((fn_len != 0) && ((cp = strdup (fn_end)) == (char *)NULL)))
  364. X+     {
  365. X+     v1_putc (0x07);
  366. X+     return FALSE;
  367. X+     }
  368. X+ 
  369. X+ /* Append the new end of line bits */
  370. X+ 
  371. X+     strcpy (fn_mstart, d_name);
  372. X+     strcat (fn_mstart, cp);
  373. X+ 
  374. X+     if (cp != null)
  375. X+     free (cp);
  376. X+ 
  377. X+     end_buffer = &l_buffer[strlen (l_buffer)];
  378. X+     c_buffer_pos = end_buffer;
  379. X+ 
  380. X+ /* Beep if more than one */
  381. X+ 
  382. X+     if (found_cnt > 1)
  383. X+     v1_putc (0x07);
  384. X+ 
  385. X+     return TRUE;
  386. X+ }
  387. X+ 
  388. X+ /* Initialise input */
  389. X+ 
  390. X+ static void    Init_Input (im)
  391. X+ bool        im;
  392. X+ {
  393. X+     c_buffer_pos = l_buffer;    /* Initialise            */
  394. X+     end_buffer = l_buffer;
  395. X+     insert_mode = im;
  396. X+     M_length = -1;
  397. X+ 
  398. X+ /* Reset max line length and get the number of columns */
  399. X+ 
  400. X+     Max_Length = 0;
  401. X+     Get_Screen_Params ();
  402. X+ 
  403. X+ /* Save the cursor position */
  404. X+ 
  405. X+     read_cursor_position ();
  406. X+ }
  407. X+ 
  408. X+ /* Configure Keyboard I/O */
  409. X+ 
  410. X+ void    Configure_Keys ()
  411. X+ {
  412. X+     char        *sp;            /* Line pointers    */
  413. X+     char        *cp;
  414. X+     FILE        *fp;
  415. X+     char        *line;            /* Input line        */
  416. X+     char        c;            /* Save character    */
  417. X+     int            i, fval, cval;
  418. X+     int            line_len;
  419. X+ 
  420. X+ /* Get some memory for the input line and the file name */
  421. X+ 
  422. X+     line_len = max (strlen (Program_Name) + 4, 200);
  423. X+     if ((line = getcell (line_len)) == (char *)NULL)
  424. X+     return;
  425. X+     
  426. X+     strcpy (line, Program_Name);
  427. X+ 
  428. X+ /* Find the .exe in the name */
  429. X+ 
  430. X+     if ((cp = strrchr (line, '/')) != (char *)NULL)
  431. X+     ++cp;
  432. X+     
  433. X+     else
  434. X+     cp = line;
  435. X+ 
  436. X+     if ((cp = strrchr (cp, '.')) == (char *)NULL)
  437. X+     cp = &line[strlen (line)];
  438. X+ 
  439. X+     strcpy (cp, ".ini");
  440. X+ 
  441. X+     if ((fp = fopen (line, "rt")) == (FILE *)NULL)
  442. X+     {
  443. X+     DELETE (line);
  444. X+     return;
  445. X+     }
  446. X+ 
  447. X+     while (fgets (line, line_len - 1, fp) != (char *)NULL)
  448. X+     {
  449. X+ 
  450. X+ /* Ignore comment lines */
  451. X+ 
  452. X+     if (*line == '#')
  453. X+         continue;
  454. X+ 
  455. X+ /* Remove the EOL */
  456. X+ 
  457. X+     if ((cp = strchr (line, '\n')) != (char *)NULL)
  458. X+         *cp = 0;
  459. X+     
  460. X+ /* Find the keyword */
  461. X+ 
  462. X+     cp = line;
  463. X+     while (!isspace (*cp) && *cp && (*cp != '='))
  464. X+         ++cp;
  465. X+ 
  466. X+     if (!*cp)
  467. X+         continue;
  468. X+ 
  469. X+     c = *cp;
  470. X+     *cp = 0;
  471. X+ 
  472. X+ /* Look up the keyword name */
  473. X+ 
  474. X+     for (i = 0; (i < KF_LENGTH) &&
  475. X+             (stricmp (line, KF_List[i].kf_name) != 0); ++i);
  476. X+ 
  477. X+ /* Ignore no matches */
  478. X+ 
  479. X+     if (i == KF_LENGTH)
  480. X+         continue;
  481. X+ 
  482. X+ /* Find the equals */
  483. X+ 
  484. X+     *cp = c;
  485. X+     while (isspace (*cp))
  486. X+         ++cp;
  487. X+     
  488. X+     if (*(cp++) != '=')
  489. X+         continue;
  490. X+ 
  491. X+     while (isspace (*cp))
  492. X+         ++cp;
  493. X+ 
  494. X+ /* Get the value */
  495. X+ 
  496. X+     errno = 0;
  497. X+     cval = 0;
  498. X+ 
  499. X+     fval = (int)strtol (cp, &sp, 0);
  500. X+ 
  501. X+ /* Check for correct terminator */
  502. X+ 
  503. X+     if (errno || (fval < 0) ||
  504. X+         ((fval != 0) && *sp) ||
  505. X+         ((fval == 0) &&
  506. X+           (((i < KF_END_FKEYS) && !isspace (*sp)) ||
  507. X+            ((i >= KF_END_FKEYS) && *sp))))
  508. X+         continue;
  509. X+     
  510. X+     if ((fval == 0) && (i < KF_END_FKEYS))
  511. X+     {
  512. X+         cp = sp;
  513. X+         while (isspace (*cp))
  514. X+         ++cp;
  515. X+ 
  516. X+         errno = 0;
  517. X+         cval = (int)strtol (cp, &sp, 0);
  518. X+ 
  519. X+         if (errno || (cval == 0) || *sp)
  520. X+         continue;
  521. X+     }
  522. X+ 
  523. X+ /* OK we have a valid value, save it */
  524. X+ 
  525. X+     KF_List[i].akey = (char)fval;
  526. X+     KF_List[i].fkey = (char)cval;
  527. X+     }
  528. X+ 
  529. X+     DELETE (line);
  530. X+     fclose (fp);
  531. X+ }
  532. X+ #endif
  533. X+ 
  534. X+ /* Check cursor is in column zero */
  535. X+ 
  536. X+ void    In_Col_Zero ()
  537. X+ {
  538. X+     union REGS        r;
  539. X+ 
  540. X+     Get_Screen_Params ();
  541. X+     read_cursor_position ();
  542. X+ 
  543. X+     r.h.ah = 0x08;
  544. X+     r.h.bh = 0x00;
  545. X+     int86 (0x10, &r, &r);
  546. X+ 
  547. X+     if ((s_cursor % Max_Cols) || (r.h.al != ' '))
  548. X+     v1_putc (NL);
  549. X+ }
  550. X+ 
  551. X+ /* Get screen parameters */
  552. X+ 
  553. X+ static void    Get_Screen_Params ()
  554. X+ {
  555. X+     union REGS        r;
  556. X+ 
  557. X+     Max_Cols = *(int *)(0x0040004aL);
  558. X+     Max_Lines = 25;
  559. X+ 
  560. X+ /* Is this an EGA?  This test was found in NANSI.SYS */
  561. X+ 
  562. X+     r.h.ah = 0x12;
  563. X+     r.x.bx = 0xff10;
  564. X+     int86 (0x10, &r, &r);
  565. X+ 
  566. X+     if (r.x.bx & 0xfefc)
  567. X+     return;
  568. X+ 
  569. X+ /* Else read the number of rows */
  570. X+ 
  571. X+     r.x.ax = 0x1130;
  572. X+     r.h.bh = 0;
  573. X+     int86 (0x10, &r, &r);
  574. X+     Max_Lines = r.h.dl + 1;
  575. X+ }
  576. X+ 
  577. X+ /* Ring Bell ? */
  578. X+ 
  579. X+ bool    Ring_Bell ()
  580. X+ {
  581. X+ #ifdef NO_HISTORY
  582. X+     return TRUE;
  583. X+ #else
  584. X+     return (bool)(KF_List[KF_RINGBELL].akey ? TRUE : FALSE);
  585. X+ #endif
  586. X  }
  587. XIndex: shell/sh4.c
  588. XPrereq: 1.1
  589. X*** ../sh15/shell/sh4.c    Fri Feb 16 19:21:44 1990
  590. X--- shell/sh4.c    Tue May  1 19:49:02 1990
  591. X***************
  592. X*** 13,21 ****
  593. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  594. X   *     (or parts of sources) cannot be sold under any circumstances.
  595. X   *
  596. X!  *    $Header: sh4.c 1.1 90/01/25 13:41:38 MS_user Exp $
  597. X   *
  598. X   *    $Log:    sh4.c $
  599. X   * Revision 1.1  90/01/25  13:41:38  MS_user
  600. X   * Initial revision
  601. X   * 
  602. X--- 13,37 ----
  603. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  604. X   *     (or parts of sources) cannot be sold under any circumstances.
  605. X   *
  606. X!  *    $Header: sh4.c 1.6 90/04/25 22:35:26 MS_user Exp $
  607. X   *
  608. X   *    $Log:    sh4.c $
  609. X+  * Revision 1.6  90/04/25  22:35:26  MS_user
  610. X+  * Make anys a global function
  611. X+  * 
  612. X+  * Revision 1.5  90/03/27  20:33:41  MS_user
  613. X+  * Clear extended file name on interrupt
  614. X+  * 
  615. X+  * Revision 1.4  90/03/16  21:27:33  MS_user
  616. X+  * Stop grave changing NL to SP for here documents
  617. X+  * 
  618. X+  * Revision 1.3  90/03/16  11:50:41  MS_user
  619. X+  * Correct Bug which prevents $$, $#, $!, $? and $- working.
  620. X+  * 
  621. X+  * Revision 1.2  90/03/14  19:30:34  MS_user
  622. X+  * Change subgetc for here document processing.  In particular `list`
  623. X+  * processing.  I hope the detection method for this is right!
  624. X+  * 
  625. X   * Revision 1.1  90/01/25  13:41:38  MS_user
  626. X   * Initial revision
  627. X   * 
  628. X***************
  629. X*** 48,62 ****
  630. X  
  631. X  static void        globname (char *, char *);
  632. X  static bool        expand (char *, Word_B **, int);
  633. X! static char        dollar (int);
  634. X! static bool        grave (int);
  635. X  static Word_B        *Expand_globs (char *, Word_B *);
  636. X  static bool        anyspcl (Word_B *);
  637. X  static char        *blank (int);
  638. X  static char        *generate (char *, char *, char *, char *);
  639. X  static char        *unquote (char *);
  640. X  static Word_B        *newword (int);
  641. X- static bool        anys (char *, char *);
  642. X  static char        *anys_p (char *, char *);
  643. X  static void        Glob_MDrives (char *, char *);
  644. X  static char        *Check_Multi_Drive (char *);
  645. X--- 64,77 ----
  646. X  
  647. X  static void        globname (char *, char *);
  648. X  static bool        expand (char *, Word_B **, int);
  649. X! static char        dollar (bool);
  650. X! static bool        grave (bool);
  651. X  static Word_B        *Expand_globs (char *, Word_B *);
  652. X  static bool        anyspcl (Word_B *);
  653. X  static char        *blank (int);
  654. X  static char        *generate (char *, char *, char *, char *);
  655. X  static char        *unquote (char *);
  656. X  static Word_B        *newword (int);
  657. X  static char        *anys_p (char *, char *);
  658. X  static void        Glob_MDrives (char *, char *);
  659. X  static char        *Check_Multi_Drive (char *);
  660. X***************
  661. X*** 169,176 ****
  662. X  /* Expand special characters and variables */
  663. X  
  664. X  static bool        expand (cp, wbp, f)
  665. X! register char        *cp;
  666. X! register Word_B        **wbp;
  667. X  {
  668. X      jmp_buf    ev;
  669. X  
  670. X--- 184,192 ----
  671. X  /* Expand special characters and variables */
  672. X  
  673. X  static bool        expand (cp, wbp, f)
  674. X! register char        *cp;            /* String to process    */
  675. X! register Word_B        **wbp;            /* Word block        */
  676. X! int            f;            /* Expand mode        */
  677. X  {
  678. X      jmp_buf    ev;
  679. X  
  680. X***************
  681. X*** 212,218 ****
  682. X          if (((f & DOGLOB) == 0) || FL_TEST ('f'))
  683. X          {
  684. X          if (f & DOTRIM)
  685. X!             unquote(cp);
  686. X  
  687. X          *wbp = addword (cp, *wbp);
  688. X          }
  689. X--- 228,234 ----
  690. X          if (((f & DOGLOB) == 0) || FL_TEST ('f'))
  691. X          {
  692. X          if (f & DOTRIM)
  693. X!             unquote (cp);
  694. X  
  695. X          *wbp = addword (cp, *wbp);
  696. X          }
  697. X***************
  698. X*** 238,245 ****
  699. X  {
  700. X      register int    c, c1;
  701. X      register char    *sp = e.linep;
  702. X!     int            scanequals = f & DOKEY;
  703. X!     int            foundequals = 0;
  704. X  
  705. X  loop:
  706. X      switch (c = subgetc ('"', foundequals))
  707. X--- 254,261 ----
  708. X  {
  709. X      register int    c, c1;
  710. X      register char    *sp = e.linep;
  711. X!     int            scanequals = (f & DOKEY) ? TRUE : FALSE;
  712. X!     bool        foundequals = FALSE;
  713. X  
  714. X  loop:
  715. X      switch (c = subgetc ('"', foundequals))
  716. X***************
  717. X*** 259,269 ****
  718. X  
  719. X      case '"':
  720. X      case '\'':
  721. X!         scanequals = 0;
  722. X          if (INSUB())
  723. X          break;
  724. X  
  725. X!         for (c1 = c; (c = subgetc ((char)c1, 1)) != c1;)
  726. X          {
  727. X          if (c == 0)
  728. X              break;
  729. X--- 275,285 ----
  730. X  
  731. X      case '"':
  732. X      case '\'':
  733. X!         scanequals = FALSE;
  734. X          if (INSUB())
  735. X          break;
  736. X  
  737. X!         for (c1 = c; (c = subgetc ((char)c1, TRUE)) != c1;)
  738. X          {
  739. X          if (c == 0)
  740. X              break;
  741. X***************
  742. X*** 280,286 ****
  743. X      unget(c);
  744. X  
  745. X      if (!isalpha (c))
  746. X!     scanequals = 0;
  747. X  
  748. X      while (1)
  749. X      {
  750. X--- 296,302 ----
  751. X      unget(c);
  752. X  
  753. X      if (!isalpha (c))
  754. X!     scanequals = FALSE;
  755. X  
  756. X      while (1)
  757. X      {
  758. X***************
  759. X*** 288,294 ****
  760. X          (f & DOBLANK) && any ((char)c, ifs->value) ||
  761. X          !INSUB() && any ((char)c, spcl1))
  762. X      {
  763. X!         scanequals = 0;
  764. X          unget (c);
  765. X  
  766. X          if (any ((char)c, spcl1))
  767. X--- 304,310 ----
  768. X          (f & DOBLANK) && any ((char)c, ifs->value) ||
  769. X          !INSUB() && any ((char)c, spcl1))
  770. X      {
  771. X!         scanequals = FALSE;
  772. X          unget (c);
  773. X  
  774. X          if (any ((char)c, spcl1))
  775. X***************
  776. X*** 301,312 ****
  777. X      {
  778. X          if (c == '=')
  779. X          {
  780. X!         foundequals = 1;
  781. X!         scanequals  = 0;
  782. X          }
  783. X  
  784. X          else if (!isalnum (c))
  785. X!         scanequals = 0;
  786. X      }
  787. X  
  788. X      *e.linep++ = (char)c;
  789. X--- 317,328 ----
  790. X      {
  791. X          if (c == '=')
  792. X          {
  793. X!         foundequals = TRUE;
  794. X!         scanequals  = FALSE;
  795. X          }
  796. X  
  797. X          else if (!isalnum (c))
  798. X!         scanequals = FALSE;
  799. X      }
  800. X  
  801. X      *e.linep++ = (char)c;
  802. X***************
  803. X*** 322,353 ****
  804. X  
  805. X  int        subgetc (ec, quoted)
  806. X  register char    ec;
  807. X! int        quoted;
  808. X  {
  809. X      register char    c;
  810. X  
  811. X! again:
  812. X!     c = (char)Getc (ec);
  813. X! 
  814. X!     if (!INSUB() && ec != '\'')
  815. X      {
  816. X!     if (c == '`')
  817. X!     {
  818. X!         if (grave (quoted) == 0)
  819. X!         return 0;
  820. X  
  821. X!         e.iop->task = XGRAVE;
  822. X!         goto again;
  823. X!     }
  824. X! 
  825. X!     if (c == '$' && (c = dollar (quoted)) == 0)
  826. X      {
  827. X-         e.iop->task = XDOLL;
  828. X-         goto again;
  829. X-     }
  830. X-     }
  831. X  
  832. X!     return c;
  833. X  }
  834. X  
  835. X  /*
  836. X--- 338,398 ----
  837. X  
  838. X  int        subgetc (ec, quoted)
  839. X  register char    ec;
  840. X! bool        quoted;
  841. X  {
  842. X      register char    c;
  843. X  
  844. X!     while (1)
  845. X      {
  846. X!     c = (char)Getc (ec);
  847. X  
  848. X!     if (!INSUB() && ec != '\'')
  849. X      {
  850. X  
  851. X! /* Found a ` - execute the command */
  852. X! 
  853. X!         if (c == '`')
  854. X!         {
  855. X! 
  856. X! /* If both ec (end character) is zero and quoted flag is FALSE, this is execute
  857. X!  * command request is in a here document, so we have to collect the rest of
  858. X!  * the command from input.  Otherwise, the command is in e.iop->argp->aword.
  859. X!  *
  860. X!  * We also need to set quoted so that NL are not processed when reading
  861. X!  * the output from the command.
  862. X!  */
  863. X!         if (!ec && !quoted)
  864. X!         {
  865. X!             e.linep = e.cline;
  866. X!             if (collect (c, c) != 0)
  867. X!             return 0;
  868. X! 
  869. X!             e.iop->argp->aword = e.cline + 1;
  870. X!             quoted = MAYBE;
  871. X!         }
  872. X! 
  873. X!         if (grave (quoted) == 0)
  874. X!             return 0;
  875. X! 
  876. X! /* Re-read the character from the Grave function */
  877. X! 
  878. X!         e.iop->task = XGRAVE;
  879. X!         }
  880. X! 
  881. X! /* $ - check for environment variable subsitution */
  882. X! 
  883. X!         else if (c == '$' && (c = dollar (quoted)) == 0)
  884. X!         e.iop->task = XDOLL;
  885. X! 
  886. X! /* No special processing required - return the character */
  887. X! 
  888. X!         else
  889. X!         return c;
  890. X!     }
  891. X! 
  892. X!     else
  893. X!         return c;
  894. X!     }
  895. X  }
  896. X  
  897. X  /*
  898. X***************
  899. X*** 355,367 ****
  900. X   */
  901. X  
  902. X  static char    dollar (quoted)
  903. X! int        quoted;
  904. X  {
  905. X      IO_State        *oiop;
  906. X      char        *dolp, otask;
  907. X      register char    *s, c, *cp;
  908. X      Var_List        *vp;
  909. X      bool        colon_f = FALSE;
  910. X  
  911. X      c = (char)readc ();
  912. X      s = e.linep;
  913. X--- 400,413 ----
  914. X   */
  915. X  
  916. X  static char    dollar (quoted)
  917. X! bool        quoted;
  918. X  {
  919. X      IO_State        *oiop;
  920. X      char        *dolp, otask;
  921. X      register char    *s, c, *cp;
  922. X      Var_List        *vp;
  923. X      bool        colon_f = FALSE;
  924. X+     char        *dol_special = "$ ";
  925. X  
  926. X      c = (char)readc ();
  927. X      s = e.linep;
  928. X***************
  929. X*** 397,403 ****
  930. X      otask = e.iop->task;
  931. X      e.iop->task = XOTHER;
  932. X  
  933. X!     while (((c = (char)subgetc ('"', 0)) != 0) && (c != '}') && (c != NL))
  934. X      {
  935. X          if (e.linep < e.eline)
  936. X          *e.linep++ = c;
  937. X--- 443,450 ----
  938. X      otask = e.iop->task;
  939. X      e.iop->task = XOTHER;
  940. X  
  941. X!     while (((c = (char)subgetc ('"', FALSE)) != 0) &&
  942. X!            (c != '}') && (c != NL))
  943. X      {
  944. X          if (e.linep < e.eline)
  945. X          *e.linep++ = c;
  946. X***************
  947. X*** 414,421 ****
  948. X          gflg++;
  949. X          return c;
  950. X      }
  951. X-     }
  952. X  
  953. X  /* Check line length */
  954. X  
  955. X      if (e.linep >= e.eline)
  956. X--- 461,477 ----
  957. X          gflg++;
  958. X          return c;
  959. X      }
  960. X  
  961. X+ /* Check for zero length string */
  962. X+ 
  963. X+     if (s == e.linep)
  964. X+     {
  965. X+         print_error ("sh: bad substitution\n");
  966. X+         gflg++;
  967. X+         return c;
  968. X+     }
  969. X+     }
  970. X+ 
  971. X  /* Check line length */
  972. X  
  973. X      if (e.linep >= e.eline)
  974. X***************
  975. X*** 485,492 ****
  976. X      if (*s == '~')
  977. X      dolp = null;
  978. X  
  979. X!     else if ((dolp = (vp = lookup (s, FALSE))->value) == null)
  980. X      {
  981. X      switch (c)
  982. X      {
  983. X          case '=':
  984. X--- 541,554 ----
  985. X      if (*s == '~')
  986. X      dolp = null;
  987. X  
  988. X!     else if (!*s || !(isalnum (*s) || any (*s, "#-?$!")))
  989. X      {
  990. X+     dol_special[1] = *s;
  991. X+     dolp = dol_special;
  992. X+     }
  993. X+ 
  994. X+     else if ((dolp = (vp = lookup (s, FALSE))->value) == null)
  995. X+     {
  996. X      switch (c)
  997. X      {
  998. X          case '=':
  999. X***************
  1000. X*** 537,549 ****
  1001. X   */
  1002. X  
  1003. X  static bool    grave (quoted)
  1004. X! int        quoted;
  1005. X  {
  1006. X      char        *cp, *sp;
  1007. X      int            localpipe, rv;
  1008. X      jmp_buf        ev, rt;
  1009. X      C_Op        *outtree;
  1010. X      Break_C        bc;
  1011. X  
  1012. X  /* Save area */
  1013. X  
  1014. X--- 599,612 ----
  1015. X   */
  1016. X  
  1017. X  static bool    grave (quoted)
  1018. X! bool        quoted;
  1019. X  {
  1020. X      char        *cp, *sp;
  1021. X      int            localpipe, rv;
  1022. X      jmp_buf        ev, rt;
  1023. X      C_Op        *outtree;
  1024. X      Break_C        bc;
  1025. X+     int            (*iof)(IO_State *);
  1026. X  
  1027. X  /* Save area */
  1028. X  
  1029. X***************
  1030. X*** 625,630 ****
  1031. X--- 688,696 ----
  1032. X          }
  1033. X      }
  1034. X  
  1035. X+ /* Clean up any files around we nolonger need */
  1036. X+ 
  1037. X+     Clear_Extended_File ();
  1038. X      quitenv ();
  1039. X      }
  1040. X  
  1041. X***************
  1042. X*** 661,667 ****
  1043. X      *(cp++) = '`';
  1044. X      lseek (localpipe, 0L, SEEK_SET);
  1045. X      e.iop->argp->aword = cp;
  1046. X!     PUSHIO (afile, remap (localpipe), quoted ? qgravechar: gravechar);
  1047. X      return TRUE;
  1048. X  }
  1049. X  
  1050. X--- 727,735 ----
  1051. X      *(cp++) = '`';
  1052. X      lseek (localpipe, 0L, SEEK_SET);
  1053. X      e.iop->argp->aword = cp;
  1054. X!     iof = (!quoted) ? gravechar
  1055. X!             : ((quoted == MAYBE) ? sgravechar : qgravechar);
  1056. X!     PUSHIO (afile, remap (localpipe), iof);
  1057. X      return TRUE;
  1058. X  }
  1059. X  
  1060. X***************
  1061. X*** 989,995 ****
  1062. X   * Is any character from s1 in s2?  Return a boolean.
  1063. X   */
  1064. X  
  1065. X! static bool    anys (s1, s2)
  1066. X  register char    *s1, *s2;
  1067. X  {
  1068. X      while (*s1)
  1069. X--- 1057,1063 ----
  1070. X   * Is any character from s1 in s2?  Return a boolean.
  1071. X   */
  1072. X  
  1073. X! bool        anys (s1, s2)
  1074. X  register char    *s1, *s2;
  1075. X  {
  1076. X      while (*s1)
  1077. XIndex: shell/sh.h
  1078. XPrereq: 1.3
  1079. X*** ../sh15/shell/sh.h    Fri Feb 16 19:03:36 1990
  1080. X--- shell/sh.h    Tue May  1 20:01:03 1990
  1081. X***************
  1082. X*** 13,21 ****
  1083. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1084. X   *     (or parts of sources) cannot be sold under any circumstances.
  1085. X   *
  1086. X!  *    $Header: sh.h 1.3 90/02/16 16:58:48 MS_user Exp $
  1087. X   *
  1088. X   *    $Log:    sh.h $
  1089. X   * Revision 1.3  90/02/16  16:58:48  MS_user
  1090. X   * Set up 1.5 release
  1091. X   * 
  1092. X--- 13,64 ----
  1093. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1094. X   *     (or parts of sources) cannot be sold under any circumstances.
  1095. X   *
  1096. X!  *    $Header: sh.h 1.17 90/05/01 19:58:18 MS_user Exp $
  1097. X   *
  1098. X   *    $Log:    sh.h $
  1099. X+  * Revision 1.17  90/05/01  19:58:18  MS_user
  1100. X+  * Change Patchlevel
  1101. X+  * 
  1102. X+  * Revision 1.16  90/04/25  22:33:03  MS_user
  1103. X+  * The function anys is now global
  1104. X+  * 
  1105. X+  * Revision 1.15  90/04/25  10:58:05  MS_user
  1106. X+  * Add offset in buffer to IO_Args to handle TEXT mode
  1107. X+  * 
  1108. X+  * Revision 1.14  90/04/25  09:21:35  MS_user
  1109. X+  * Change version message processing
  1110. X+  * 
  1111. X+  * Revision 1.13  90/04/03  18:07:24  MS_user
  1112. X+  * Patchlevel
  1113. X+  * 
  1114. X+  * Revision 1.12  90/03/27  20:25:29  MS_user
  1115. X+  * Clear_Extended_File required by sh1 for Interrupt cleanup
  1116. X+  * 
  1117. X+  * Revision 1.11  90/03/26  20:58:24  MS_user
  1118. X+  * Change I/O restore so that "exec >filename" works
  1119. X+  * 
  1120. X+  * Revision 1.10  90/03/26  04:31:32  MS_user
  1121. X+  * Remove original Interrupt 24 save address
  1122. X+  * 
  1123. X+  * Revision 1.9  90/03/16  21:25:55  MS_user
  1124. X+  * Create the MAYBE boolean for stopping the removal of NL by grave.
  1125. X+  * 
  1126. X+  * Revision 1.8  90/03/14  19:29:42  MS_user
  1127. X+  * Add some new functions and Buffered Output typedef
  1128. X+  * Add IOTHERE for <<- redirection
  1129. X+  * 
  1130. X+  * Revision 1.7  90/03/09  16:10:07  MS_user
  1131. X+  * Add build file name function
  1132. X+  * 
  1133. X+  * Revision 1.6  90/03/07  09:43:00  MS_user
  1134. X+  * Change PATCHLEVEL
  1135. X+  * 
  1136. X+  * Revision 1.5  90/03/06  15:09:09  MS_user
  1137. X+  * Add some new procedures
  1138. X+  * 
  1139. X+  * Revision 1.4  90/02/22  16:40:49  MS_user
  1140. X+  * Add XMS Support
  1141. X+  * 
  1142. X   * Revision 1.3  90/02/16  16:58:48  MS_user
  1143. X   * Set up 1.5 release
  1144. X   * 
  1145. X***************
  1146. X*** 28,34 ****
  1147. X   * 
  1148. X   */
  1149. X  
  1150. X! #define PATCHLEVEL    1
  1151. X  #define    LINE_MAX    1000    /* Command line length            */
  1152. X  #define HISTORY_MAX    100    /* History array length            */
  1153. X                  /* Space for full file name        */
  1154. X--- 71,77 ----
  1155. X   * 
  1156. X   */
  1157. X  
  1158. X! #define PATCHLEVEL    4
  1159. X  #define    LINE_MAX    1000    /* Command line length            */
  1160. X  #define HISTORY_MAX    100    /* History array length            */
  1161. X                  /* Space for full file name        */
  1162. X***************
  1163. X*** 45,50 ****
  1164. X--- 88,100 ----
  1165. X  #define NL        '\n'
  1166. X  #define SP        ' '
  1167. X  #define    NOT        '^'
  1168. X+ 
  1169. X+ /* Here we introduce a new boolean value - MAYBE.  This is required for
  1170. X+  * a special case of the grave function
  1171. X+  */
  1172. X+ 
  1173. X+ #define MAYBE        (bool)(-1)
  1174. X+ 
  1175. X                  /* Open in create mode            */
  1176. X  #define O_CMASK        (O_WRONLY | O_CREAT | O_TRUNC | O_TEXT)
  1177. X                  /* Open in create mode for a pipe    */
  1178. X***************
  1179. X*** 135,141 ****
  1180. X  extern unsigned int    SW_Mode;    /* Type of swapping to do    */
  1181. X                      /* 1 - disk            */
  1182. X                      /* 2 - Extended    memory        */
  1183. X!                     /* 3 - Expanded    memory        */
  1184. X  extern unsigned int    SW_EMSFrame;    /* EMS Frame segment        */
  1185. X  
  1186. X  extern int        Swap_Mode;    /* Swapping mode        */
  1187. X--- 185,192 ----
  1188. X  extern unsigned int    SW_Mode;    /* Type of swapping to do    */
  1189. X                      /* 1 - disk            */
  1190. X                      /* 2 - Extended    memory        */
  1191. X!                     /* 3 - EMS Driver        */
  1192. X!                     /* 4 - XMS Driver        */
  1193. X  extern unsigned int    SW_EMSFrame;    /* EMS Frame segment        */
  1194. X  
  1195. X  extern int        Swap_Mode;    /* Swapping mode        */
  1196. X***************
  1197. X*** 155,172 ****
  1198. X  #define    DOBLANK        0x02    /* perform blank interpretation        */
  1199. X  #define    DOGLOB        0x04    /* interpret [?*            */
  1200. X  #define    DOKEY        0x08    /* move words with `=' to 2nd arg. list */
  1201. X! #define    DOTRIM        0x01    /* trim resulting string        */
  1202. X  
  1203. X  #define    DOALL        (DOSUB | DOBLANK | DOGLOB | DOKEY | DOTRIM)
  1204. X  
  1205. X- extern char        *Copy_Right1;
  1206. X- extern char        *Copy_Right2;
  1207. X  extern char        **dolv;        /* $<numeric> values        */
  1208. X  extern int        dolc;        /* $<numeric> count        */
  1209. X  extern int        fn_area_number;    /* Next function area number    */
  1210. X  extern int        exstat;
  1211. X  extern char        gflg;
  1212. X! extern int        talking;    /* interactive (talking-type    */
  1213. X  extern int        execflg;
  1214. X  extern int        multiline;    /* \n changed to ;        */
  1215. X  extern int        *failpt;
  1216. X--- 206,221 ----
  1217. X  #define    DOBLANK        0x02    /* perform blank interpretation        */
  1218. X  #define    DOGLOB        0x04    /* interpret [?*            */
  1219. X  #define    DOKEY        0x08    /* move words with `=' to 2nd arg. list */
  1220. X! #define    DOTRIM        0x10    /* trim resulting string        */
  1221. X  
  1222. X  #define    DOALL        (DOSUB | DOBLANK | DOGLOB | DOKEY | DOTRIM)
  1223. X  
  1224. X  extern char        **dolv;        /* $<numeric> values        */
  1225. X  extern int        dolc;        /* $<numeric> count        */
  1226. X  extern int        fn_area_number;    /* Next function area number    */
  1227. X  extern int        exstat;
  1228. X  extern char        gflg;
  1229. X! extern bool        talking;    /* interactive (talking-type    */
  1230. X  extern int        execflg;
  1231. X  extern int        multiline;    /* \n changed to ;        */
  1232. X  extern int        *failpt;
  1233. X***************
  1234. X*** 175,183 ****
  1235. X  extern int        Current_Event;    /* Current history event    */
  1236. X  
  1237. X  /*
  1238. X!  * Break/Continue (in for and while), Return and Exit handler
  1239. X   */
  1240. X  
  1241. X  typedef struct brkcon {
  1242. X      jmp_buf        brkpt;
  1243. X      struct brkcon    *nextlev;
  1244. X--- 224,244 ----
  1245. X  extern int        Current_Event;    /* Current history event    */
  1246. X  
  1247. X  /*
  1248. X!  * Buffered Output function
  1249. X   */
  1250. X  
  1251. X+ #define BIO_LENGTH    20        /* BIO size            */
  1252. X+ 
  1253. X+ typedef struct    Out_Buffer {
  1254. X+     int        ob_fid;            /* File handler            */
  1255. X+     char    *ob_start;        /* Start of buffer        */
  1256. X+     char    *ob_cur;        /* Current position        */
  1257. X+ } Out_Buf;
  1258. X+ 
  1259. X+ /*
  1260. X+  * Break/Continue (in for and while), Return and Exit handler
  1261. X+  */
  1262. X+ 
  1263. X  typedef struct brkcon {
  1264. X      jmp_buf        brkpt;
  1265. X      struct brkcon    *nextlev;
  1266. X***************
  1267. X*** 228,240 ****
  1268. X      char    *io_name;    /* file name                */
  1269. X  } IO_Actions;
  1270. X  
  1271. X! #define    IOREAD        1    /* <                    */
  1272. X! #define    IOHERE        2    /* << (here file)            */
  1273. X! #define    IOWRITE        4    /* >                    */
  1274. X! #define    IOCAT        8    /* >>                    */
  1275. X! #define    IOXHERE        16    /* ${}, ` in <<                */
  1276. X! #define    IODUP        32    /* >&digit                */
  1277. X! #define    IOCLOSE        64    /* >&-                    */
  1278. X  
  1279. X  #define    IODEFAULT    (-1)    /* token for default IO unit        */
  1280. X  
  1281. X--- 289,302 ----
  1282. X      char    *io_name;    /* file name                */
  1283. X  } IO_Actions;
  1284. X  
  1285. X! #define    IOREAD        0x01    /* <                    */
  1286. X! #define    IOHERE        0x02    /* << (here file)            */
  1287. X! #define    IOWRITE        0x04    /* >                    */
  1288. X! #define    IOCAT        0x08    /* >>                    */
  1289. X! #define    IOXHERE        0x10    /* ${}, ` in <<                */
  1290. X! #define    IODUP        0x20    /* >&digit                */
  1291. X! #define    IOCLOSE        0x40    /* >&-                    */
  1292. X! #define    IOTHERE        0x80    /* <<- (here file            */
  1293. X  
  1294. X  #define    IODEFAULT    (-1)    /* token for default IO unit        */
  1295. X  
  1296. X***************
  1297. X*** 249,254 ****
  1298. X--- 311,317 ----
  1299. X      struct io    *iobase;
  1300. X      struct io    *iop;
  1301. X      int        *errpt;
  1302. X+     bool    eof_p;            /* EOF processing enabled    */
  1303. X      int        iofd;
  1304. X      struct env    *oenv;            /* Previous environment        */
  1305. X  } Environ;
  1306. X***************
  1307. X*** 322,327 ****
  1308. X--- 385,391 ----
  1309. X  extern char    *shell;        /* Shell string                */
  1310. X  extern char    *hsymbol;    /* Hash string                */
  1311. X  extern char    *msymbol;    /* Minus string                */
  1312. X+ extern char    *Program_Name;    /* Program name from argv[0]        */
  1313. X  extern char    *spcl2;
  1314. X  extern char    *history_file;
  1315. X  
  1316. X***************
  1317. X*** 355,360 ****
  1318. X--- 419,425 ----
  1319. X      int            afile;        /* file descriptor        */
  1320. X      unsigned int    afid;        /* buffer id            */
  1321. X      long        afpos;        /* file position        */
  1322. X+     int            afoff;        /* Offset in buffer        */
  1323. X      IO_Buf        *afbuf;        /* buffer for this file        */
  1324. X  } IO_Args;
  1325. X  
  1326. X***************
  1327. X*** 401,409 ****
  1328. X   */
  1329. X  
  1330. X  extern IO_Args        temparg;    /* temporary for PUSHIO */
  1331. X! #define    PUSHIO(what,arg,gen)    ((temparg.what = (arg)), pushio(&temparg,(gen)))
  1332. X! #define    RUN(what,arg,gen)    ((temparg.what = (arg)), run(&temparg,(gen)))
  1333. X  
  1334. X  typedef struct wdblock {
  1335. X      short    w_bsize;
  1336. X      short    w_nword;
  1337. X--- 466,477 ----
  1338. X   */
  1339. X  
  1340. X  extern IO_Args        temparg;    /* temporary for PUSHIO */
  1341. X! #define    PUSHIO(what, arg, gen)        ((temparg.what = (arg)),    \
  1342. X!                       pushio (&temparg, (gen)))
  1343. X  
  1344. X+ #define    RUN(what, arg, gen, loop)    ((temparg.what = (arg)),    \
  1345. X+                       run (&temparg, (gen), loop))
  1346. X+ 
  1347. X  typedef struct wdblock {
  1348. X      short    w_bsize;
  1349. X      short    w_nword;
  1350. X***************
  1351. X*** 433,439 ****
  1352. X  extern bool    newenv (int);
  1353. X  extern void    quitenv (void);
  1354. X  extern char    *putn (int);
  1355. X- extern void    next (int);
  1356. X  extern void    onintr (int);
  1357. X  extern char    *space (int);
  1358. X  extern char    *strsave (char *, int);
  1359. X--- 501,506 ----
  1360. X***************
  1361. X*** 452,458 ****
  1362. X  extern int    getarea (char *);
  1363. X  extern C_Op    *yyparse (void);
  1364. X  extern int    execute (C_Op *, int, int, int);
  1365. X! extern int    run (IO_Args *, int (*)(IO_State *));
  1366. X  extern int    Getc (int);
  1367. X  extern void    unget (int);
  1368. X  extern int    eofc (void);
  1369. X--- 519,525 ----
  1370. X  extern int    getarea (char *);
  1371. X  extern C_Op    *yyparse (void);
  1372. X  extern int    execute (C_Op *, int, int, int);
  1373. X! extern int    run (IO_Args *, int (*)(IO_State *), bool);
  1374. X  extern int    Getc (int);
  1375. X  extern void    unget (int);
  1376. X  extern int    eofc (void);
  1377. X***************
  1378. X*** 466,471 ****
  1379. X--- 533,539 ----
  1380. X  extern int    filechar (IO_State *);
  1381. X  extern int    gravechar (IO_State *);
  1382. X  extern int    qgravechar (IO_State *);
  1383. X+ extern int    sgravechar (IO_State *);
  1384. X  extern int    linechar (IO_State *);
  1385. X  extern void    closeall (void);
  1386. X  extern int    remap (int);
  1387. X***************
  1388. X*** 480,486 ****
  1389. X  extern char    **eval (char **, int);
  1390. X  extern char    **makenv (void);
  1391. X  extern char    *evalstr (char *, int);
  1392. X! extern int    subgetc (char, int);
  1393. X  extern Word_B    *addword (char *, Word_B *);
  1394. X  extern char    **getwords (Word_B *);
  1395. X  extern void    put_prompt (char *);
  1396. X--- 548,554 ----
  1397. X  extern char    **eval (char **, int);
  1398. X  extern char    **makenv (void);
  1399. X  extern char    *evalstr (char *, int);
  1400. X! extern int    subgetc (char, bool);
  1401. X  extern Word_B    *addword (char *, Word_B *);
  1402. X  extern char    **getwords (Word_B *);
  1403. X  extern void    put_prompt (char *);
  1404. X***************
  1405. X*** 493,509 ****
  1406. X  extern int    S_close (int, bool);
  1407. X  extern int    S_dup (int);
  1408. X  extern int    S_dup2 (int, int);
  1409. X! extern void    S_Remap (int, int);
  1410. X  extern void    S_Delete (int);
  1411. X  extern void    Getcwd (void);
  1412. X  extern char    *g_tempname (void);
  1413. X  extern void    S_puts (char *);
  1414. X  extern void    S_putc (int);
  1415. X  extern bool    check_rsh (char *);
  1416. X! extern int    O_for_execute (char *);
  1417. X  extern int    SA_spawn (char **);
  1418. X  extern char    *findeq (char *);
  1419. X! extern int    restore_std (int);
  1420. X  extern void    Load_History (void);
  1421. X  extern void    Dump_History (void);
  1422. X  extern void    Display_History (void);
  1423. X--- 561,577 ----
  1424. X  extern int    S_close (int, bool);
  1425. X  extern int    S_dup (int);
  1426. X  extern int    S_dup2 (int, int);
  1427. X! extern int    S_Remap (int, int);
  1428. X  extern void    S_Delete (int);
  1429. X  extern void    Getcwd (void);
  1430. X  extern char    *g_tempname (void);
  1431. X  extern void    S_puts (char *);
  1432. X  extern void    S_putc (int);
  1433. X  extern bool    check_rsh (char *);
  1434. X! extern int    O_for_execute (char *, char **, int *);
  1435. X  extern int    SA_spawn (char **);
  1436. X  extern char    *findeq (char *);
  1437. X! extern int    restore_std (int, bool);
  1438. X  extern void    Load_History (void);
  1439. X  extern void    Dump_History (void);
  1440. X  extern void    Display_History (void);
  1441. X***************
  1442. X*** 525,537 ****
  1443. X  extern void    Restore_Dir (void);
  1444. X  extern void    Restore_Environment (int, int);
  1445. X  extern int    sort_compare (char **, char **);
  1446. X! extern int    Check_Script (char *);
  1447. X  
  1448. X  /*
  1449. X   * Interrupt handling
  1450. X   */
  1451. X  
  1452. X  extern void interrupt    SW_Int24 (void);    /* Int 24 New address    */
  1453. X- extern void (interrupt far *SW_I24_V) (void);    /*      Old address    */
  1454. X  extern void (interrupt far *SW_I0_V) (void);    /* Int 0 address    */
  1455. X  extern void (interrupt far *SW_I23_V) (void);    /* Int 23 address    */
  1456. X--- 593,626 ----
  1457. X  extern void    Restore_Dir (void);
  1458. X  extern void    Restore_Environment (int, int);
  1459. X  extern int    sort_compare (char **, char **);
  1460. X! extern int    Check_Script (char *, char **, int *);
  1461. X! extern bool    Interactive (void);
  1462. X! extern void    In_Col_Zero (void);
  1463. X! extern char    *Build_H_Filename (char *);
  1464. X! extern void    Configure_Keys (void);
  1465. X! extern bool    Ring_Bell (void);
  1466. X! extern void    Close_buffer (Out_Buf *);
  1467. X! extern void    Add_buffer (char, Out_Buf *);
  1468. X! extern void    Adds_buffer (char *, Out_Buf *);
  1469. X! extern Out_Buf    *Open_buffer (int, bool);
  1470. X! extern int    collect (int, int);
  1471. X! extern void    Clear_Extended_File (void);
  1472. X! extern void    Print_Version (int);
  1473. X! extern bool    anys (char *, char *);
  1474. X  
  1475. X  /*
  1476. X   * Interrupt handling
  1477. X   */
  1478. X  
  1479. X  extern void interrupt    SW_Int24 (void);    /* Int 24 New address    */
  1480. X  extern void (interrupt far *SW_I0_V) (void);    /* Int 0 address    */
  1481. X  extern void (interrupt far *SW_I23_V) (void);    /* Int 23 address    */
  1482. X+ 
  1483. X+ /*
  1484. X+  * XMS Driver functions
  1485. X+  */
  1486. X+ 
  1487. X+ extern void (far *SW_XMS_Driver) (void);    /* XMS Driver Interface    */
  1488. X+ extern int        SW_XMS_Gversion (void);
  1489. X+ extern int        SW_XMS_Allocate (unsigned int);
  1490. X+ extern int        SW_XMS_Free (int);
  1491. XIndex: shell/sh8.c
  1492. XPrereq: 1.1
  1493. X*** ../sh15/shell/sh8.c    Fri Feb 16 19:17:06 1990
  1494. X--- shell/sh8.c    Tue May  1 19:49:46 1990
  1495. X***************
  1496. X*** 12,20 ****
  1497. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1498. X   *     (or parts of sources) cannot be sold under any circumstances.
  1499. X   *
  1500. X!  *    $Header: sh8.c 1.1 90/01/29 17:46:37 MS_user Exp $
  1501. X   *
  1502. X   *    $Log:    sh8.c $
  1503. X   * Revision 1.1  90/01/29  17:46:37  MS_user
  1504. X   * Initial revision
  1505. X   * 
  1506. X--- 12,43 ----
  1507. X   * 2.  The sources (or parts thereof) or objects generated from the sources
  1508. X   *     (or parts of sources) cannot be sold under any circumstances.
  1509. X   *
  1510. X!  *    $Header: sh8.c 1.8 90/03/26 20:58:11 MS_user Exp $
  1511. X   *
  1512. X   *    $Log:    sh8.c $
  1513. X+  * Revision 1.8  90/03/26  20:58:11  MS_user
  1514. X+  * Change I/O restore so that "exec >filename" works
  1515. X+  * 
  1516. X+  * Revision 1.7  90/03/22  13:48:03  MS_user
  1517. X+  * MSDOS does not handle /dev/ files after find_first correctly
  1518. X+  * 
  1519. X+  * Revision 1.6  90/03/14  19:32:42  MS_user
  1520. X+  * Change buffered output to be re-entrant
  1521. X+  * 
  1522. X+  * Revision 1.5  90/03/14  16:46:21  MS_user
  1523. X+  * New Open_buffer parameter and Adds_buffer function
  1524. X+  * 
  1525. X+  * Revision 1.4  90/03/13  21:20:50  MS_user
  1526. X+  * Add Buffered Output functions
  1527. X+  * 
  1528. X+  * Revision 1.3  90/03/06  15:14:03  MS_user
  1529. X+  * Change script detection to look for a character less than 0x08
  1530. X+  * 
  1531. X+  * Revision 1.2  90/03/05  13:54:08  MS_user
  1532. X+  * Fix bug in S_dup
  1533. X+  * Change the way we detect shell scripts
  1534. X+  * Add support for alternate command interpreters a la V.4
  1535. X+  * 
  1536. X   * Revision 1.1  90/01/29  17:46:37  MS_user
  1537. X   * Initial revision
  1538. X   * 
  1539. X***************
  1540. X*** 32,42 ****
  1541. X  #include <string.h>
  1542. X  #include <unistd.h>
  1543. X  #include <limits.h>
  1544. X  #include "sh.h"
  1545. X  
  1546. X  #define F_START        4
  1547. X  
  1548. X! static char        *nopipe = "can't create pipe - try again\n";
  1549. X  
  1550. X  /* List of open files to allow us to simulate the Unix open and unlink
  1551. X   * operation for temporary files
  1552. X--- 55,66 ----
  1553. X  #include <string.h>
  1554. X  #include <unistd.h>
  1555. X  #include <limits.h>
  1556. X+ #include <ctype.h>
  1557. X  #include "sh.h"
  1558. X  
  1559. X  #define F_START        4
  1560. X  
  1561. X! static char    *nopipe = "can't create pipe - try again\n";
  1562. X  
  1563. X  /* List of open files to allow us to simulate the Unix open and unlink
  1564. X   * operation for temporary files
  1565. X***************
  1566. X*** 93,100 ****
  1567. X      return -1;
  1568. X      }
  1569. X  
  1570. X! /* Set up the structure */
  1571. X  
  1572. X      fp->fl_name  = strcpy (f_name, name);
  1573. X      fp->fl_close = d_flag;
  1574. X      fp->fl_size  = F_START;
  1575. X--- 117,137 ----
  1576. X      return -1;
  1577. X      }
  1578. X  
  1579. X! /* Set up the structure.  Change two Unix device names to the DOS
  1580. X!  * equivalents and disable create
  1581. SHAR_EOF
  1582. echo "End of part 5"
  1583. echo "File Patch1.6 is continued in part 6"
  1584. echo "6" > s2_seq_.tmp
  1585. exit 0
  1586.  
  1587.  
  1588.