home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume19 / zsh2.00 / patch02d < prev    next >
Encoding:
Text File  |  1991-05-16  |  50.3 KB  |  2,176 lines

  1. Newsgroups: comp.sources.misc
  2. From: Paul Falstad <pfalstad@phoenix.princeton.edu>
  3. Subject:  v19i070:  zsh2.00 - The Z shell, Patch02d/6
  4. Message-ID: <1991May15.220259.7409@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: d1c7c852ac487d0dbf2a39d81aab694b
  6. Date: Wed, 15 May 1991 22:02:59 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Paul Falstad <pfalstad@phoenix.princeton.edu>
  10. Posting-number: Volume 19, Issue 70
  11. Archive-name: zsh2.00/patch02d
  12. Patch-To: zsh2.00: Volume 18, Issue 84-98
  13.  
  14. #!/bin/sh
  15. # this is zpatch.04 (part 4 of a multipart archive)
  16. # do not concatenate these parts, unpack them in order with /bin/sh
  17. # file patches continued
  18. #
  19. if test ! -r _shar_seq_.tmp; then
  20.     echo 'Please unpack part 1 first!'
  21.     exit 1
  22. fi
  23. (read Scheck
  24.  if test "$Scheck" != 4; then
  25.     echo Please unpack part "$Scheck" next!
  26.     exit 1
  27.  else
  28.     exit 0
  29.  fi
  30. ) < _shar_seq_.tmp || exit 1
  31. echo 'x - continuing file patches'
  32. sed 's/^X//' << 'SHAR_EOF' >> 'patches' &&
  33. --- 480,486 ----
  34. X  /* ^X */ z_expandorcomplete,
  35. X  /* ^Y */ z_undefinedkey,
  36. X  /* ^Z */ z_undefinedkey,
  37. ! /* ^[ */ z_sequenceleadin,
  38. X  /* ^\ */ z_undefinedkey,
  39. X  /* ^] */ z_undefinedkey,
  40. X  /* ^^ */ z_undefinedkey,
  41. ***************
  42. *** 523,530 ****
  43. X  /* G */ z_vifetchhistory,
  44. X  /* H */ z_vicapslockpanic,
  45. X  /* I */ z_viinsertbol,
  46. ! /* J */ z_vijoin,
  47. ! /* K */ z_vicapslockpanic,
  48. X  /* L */ z_undefinedkey,
  49. X  /* M */ z_undefinedkey,
  50. X  /* N */ z_virevrepeatsearch,
  51. --- 527,534 ----
  52. X  /* G */ z_vifetchhistory,
  53. X  /* H */ z_vicapslockpanic,
  54. X  /* I */ z_viinsertbol,
  55. ! /* J */ z_historysearchforward,
  56. ! /* K */ z_historysearchbackward,
  57. X  /* L */ z_undefinedkey,
  58. X  /* M */ z_undefinedkey,
  59. X  /* N */ z_virevrepeatsearch,
  60. *** src/zsh0/zsh2.00/src/zle_emacs.c    Tue Apr 23 00:30:05 1991
  61. --- zsh2.00/src/zle_emacs.c    Wed May  8 22:34:14 1991
  62. ***************
  63. *** 32,38 ****
  64. X  
  65. X  #define ZLE
  66. X  #include "zsh.h"
  67. - #include "funcs.h"
  68. X  
  69. X  void beginningofline() /**/
  70. X  {
  71. --- 32,37 ----
  72. ***************
  73. *** 51,58 ****
  74. X  {
  75. X      while (mult--)
  76. X          {
  77. !         if (cs == ll)
  78. X              return;
  79. X          if (line[cs] == '\n')
  80. X              if (++cs == ll)
  81. X                  return;
  82. --- 50,59 ----
  83. X  {
  84. X      while (mult--)
  85. X          {
  86. !         if (cs >= ll) {
  87. !             cs = ll;
  88. X              return;
  89. +         }
  90. X          if (line[cs] == '\n')
  91. X              if (++cs == ll)
  92. X                  return;
  93. ***************
  94. *** 60,65 ****
  95. --- 61,103 ----
  96. X          }
  97. X  }
  98. X  
  99. + void beginningoflinehist() /**/
  100. + {
  101. +     while (mult)
  102. +         {
  103. +         if (cs == 0)
  104. +             break;
  105. +         if (line[cs-1] == '\n')
  106. +             if (!--cs)
  107. +                 break;
  108. +         while (cs && line[cs-1] != '\n') cs--;
  109. +         mult--;
  110. +         }
  111. +     if (mult)
  112. +         {
  113. +         uphistory();
  114. +         cs = 0;
  115. +         }
  116. + }
  117. + void endoflinehist() /**/
  118. + {
  119. +     while (mult)
  120. +         {
  121. +         if (cs >= ll) {
  122. +             cs = ll;
  123. +             break;
  124. +         }
  125. +         if (line[cs] == '\n')
  126. +             if (++cs == ll)
  127. +                 break;
  128. +         while (cs != ll && line[cs] != '\n') cs++;
  129. +         mult--;
  130. +         }
  131. +     if (mult)
  132. +         downhistory();
  133. + }
  134. X  void forwardchar() /**/
  135. X  {
  136. X      if ((cs += mult) > ll) cs = ll;
  137. ***************
  138. *** 100,107 ****
  139. X          return;
  140. X          }
  141. X      if (!(cs+mult > ll || line[cs] == '\n'))
  142. X          cs += mult;
  143. !     backdel(mult);
  144. X  }
  145. X  
  146. X  void backwarddeletechar() /**/
  147. --- 138,149 ----
  148. X          return;
  149. X          }
  150. X      if (!(cs+mult > ll || line[cs] == '\n'))
  151. +         {
  152. X          cs += mult;
  153. !         backdel(mult);
  154. !         }
  155. !     else
  156. !         feep();
  157. X  }
  158. X  
  159. X  void backwarddeletechar() /**/
  160. ***************
  161. *** 271,277 ****
  162. X          while (cs != ll && !iword(line[cs])) cs++;
  163. X          while (cs != ll && iword(line[cs]))
  164. X              {
  165. !             line[cs] = toupper(line[cs]);
  166. X              cs++;
  167. X              }
  168. X          }
  169. --- 313,319 ----
  170. X          while (cs != ll && !iword(line[cs])) cs++;
  171. X          while (cs != ll && iword(line[cs]))
  172. X              {
  173. !             line[cs] = tuupper(line[cs]);
  174. X              cs++;
  175. X              }
  176. X          }
  177. ***************
  178. *** 284,290 ****
  179. X          while (cs != ll && !iword(line[cs])) cs++;
  180. X          while (cs != ll && iword(line[cs]))
  181. X              {
  182. !             line[cs] = tolower(line[cs]);
  183. X              cs++;
  184. X              }
  185. X          }
  186. --- 326,332 ----
  187. X          while (cs != ll && !iword(line[cs])) cs++;
  188. X          while (cs != ll && iword(line[cs]))
  189. X              {
  190. !             line[cs] = tulower(line[cs]);
  191. X              cs++;
  192. X              }
  193. X          }
  194. ***************
  195. *** 300,306 ****
  196. X          while (cs != ll && !iword(line[cs])) cs++;
  197. X          while (cs != ll && iword(line[cs]))
  198. X              {
  199. !             line[cs] = (first) ? toupper(line[cs]) : tolower(line[cs]);
  200. X              first = 0;
  201. X              cs++;
  202. X              }
  203. --- 342,348 ----
  204. X          while (cs != ll && !iword(line[cs])) cs++;
  205. X          while (cs != ll && iword(line[cs]))
  206. X              {
  207. !             line[cs] = (first) ? tuupper(line[cs]) : tulower(line[cs]);
  208. X              first = 0;
  209. X              cs++;
  210. X              }
  211. ***************
  212. *** 386,397 ****
  213. X              return;
  214. X              }
  215. X          for (p1 = p2; p1 && iword(line[p1-1]); p1--);
  216. !         pp = temp = zalloc(p4-p1+1);
  217. X          struncpy(&pp,line+p3,p4-p3);
  218. X          struncpy(&pp,line+p2,p3-p2);
  219. X          struncpy(&pp,line+p1,p2-p1);
  220. X          strncpy(line+p1,temp,p4-p1);
  221. -         free(temp);
  222. X          cs = p4;
  223. X          }
  224. X  }
  225. --- 428,438 ----
  226. X              return;
  227. X              }
  228. X          for (p1 = p2; p1 && iword(line[p1-1]); p1--);
  229. !         pp = temp = halloc(p4-p1+1);
  230. X          struncpy(&pp,line+p3,p4-p3);
  231. X          struncpy(&pp,line+p2,p3-p2);
  232. X          struncpy(&pp,line+p1,p2-p1);
  233. X          strncpy(line+p1,temp,p4-p1);
  234. X          cs = p4;
  235. X          }
  236. X  }
  237. ***************
  238. *** 699,706 ****
  239. X  char *s,*t;
  240. X  int len,z = lithist;
  241. X  
  242. X      lithist = 0;
  243. !     if (!(s = qgetevent(curhist-1), lithist = z, s))
  244. X          {
  245. X          feep();
  246. X          return;
  247. --- 740,765 ----
  248. X  char *s,*t;
  249. X  int len,z = lithist;
  250. X  
  251. +     /* multiple calls will now search back through the history, pem */
  252. +     static char    *lastinsert;
  253. +     static int    lasthist, lastpos;
  254. +     int        evhist = curhist - 1;
  255. +     if (lastinsert) {
  256. +         int len = strlen(lastinsert);
  257. +         int pos = cs;
  258. +         if (    lastpos <= pos &&
  259. +             len == pos - lastpos &&
  260. +             strncmp(lastinsert, &line[lastpos], len) == 0) {
  261. +         evhist = --lasthist;
  262. +         cs = lastpos;
  263. +         foredel(pos-cs);
  264. +         }
  265. +         free(lastinsert);
  266. +         lastinsert = NULL;
  267. +     }
  268. X      lithist = 0;
  269. !     if (!(s = qgetevent(evhist), lithist = z, s))
  270. X          {
  271. X          feep();
  272. X          return;
  273. ***************
  274. *** 710,715 ****
  275. --- 769,777 ----
  276. X              break;
  277. X      if (t != s)
  278. X          t++;
  279. +     lasthist = evhist;
  280. +     lastpos = cs;
  281. +     lastinsert = ztrdup(t);
  282. X      spaceinline(len = strlen(t));
  283. X      strncpy(line+cs,t,len);
  284. X      cs += len;
  285. ***************
  286. *** 743,750 ****
  287. X  
  288. X  void pushline() /**/
  289. X  {
  290. !     while (mult--)
  291. !         pushnode(bufstack,ztrdup(line));
  292. X      stackcs = cs;
  293. X      *line = '\0';
  294. X      ll = cs = 0;
  295. --- 805,813 ----
  296. X  
  297. X  void pushline() /**/
  298. X  {
  299. !     pushnode(bufstack,ztrdup(line));
  300. !     while (--mult)
  301. !         pushnode(bufstack,ztrdup(""));
  302. X      stackcs = cs;
  303. X      *line = '\0';
  304. X      ll = cs = 0;
  305. ***************
  306. *** 790,796 ****
  307. X      strncpy(line+ue->pref,ue->change,ue->len);
  308. X      strcpy(line+ue->pref+ue->len,s);
  309. X      free(s);
  310. -     free(ue->change);
  311. X      ue->change = NULL;
  312. X      undoct = (undoct-1) & (UNDOCT-1);
  313. X      cs = ue->cs;
  314. --- 853,858 ----
  315. ***************
  316. *** 847,853 ****
  317. X                      if (!(chequiv && !hstrcmp(line,s)))
  318. X                          {
  319. X                          sethistline(s);
  320. !                         cs = t-s+sbptr;
  321. X                          break;
  322. X                          }
  323. X                  histline += dir;
  324. --- 909,915 ----
  325. X                      if (!(chequiv && !hstrcmp(line,s)))
  326. X                          {
  327. X                          sethistline(s);
  328. !                         cs = t-s+sbptr-(sbuf[0] == '^');
  329. X                          break;
  330. X                          }
  331. X                  histline += dir;
  332. ***************
  333. *** 855,865 ****
  334. X              chequiv = 0;
  335. X              }
  336. X          refresh();
  337. !         if ((ch = getkey(0)) == -1)
  338. X              break;
  339. X          if (ch == 22 || ch == 17)
  340. X              {
  341. !             if ((ch = getkey(0)) == -1)
  342. X                  break;
  343. X              }
  344. X          else if (ch == 8 || ch == 127)
  345. --- 917,927 ----
  346. X              chequiv = 0;
  347. X              }
  348. X          refresh();
  349. !         if ((ch = getkey(1)) == -1)
  350. X              break;
  351. X          if (ch == 22 || ch == 17)
  352. X              {
  353. !             if ((ch = getkey(1)) == -1)
  354. X                  break;
  355. X              }
  356. X          else if (ch == 8 || ch == 127)
  357. ***************
  358. *** 893,898 ****
  359. --- 955,965 ----
  360. X              chequiv = 1;
  361. X              continue;
  362. X              }
  363. +         else if (!(ch & 0x60))
  364. +             {
  365. +             ungetkey(ch);
  366. +             break;
  367. +             }
  368. X          if (!nomatch && sbptr != 39 && !icntrl(ch))
  369. X              {
  370. X              sbuf[sbptr++] = ch;
  371. ***************
  372. *** 916,922 ****
  373. X          mark = cs;
  374. X          cs = x;
  375. X          }
  376. !     s = zcalloc((y = mark-cs)+1);
  377. X      strncpy(s,line+cs,y);
  378. X      s[y] = '\0';
  379. X      foredel(mark-cs);
  380. --- 983,989 ----
  381. X          mark = cs;
  382. X          cs = x;
  383. X          }
  384. !     s = hcalloc((y = mark-cs)+1);
  385. X      strncpy(s,line+cs,y);
  386. X      s[y] = '\0';
  387. X      foredel(mark-cs);
  388. ***************
  389. *** 923,930 ****
  390. X      t = makequote(s);
  391. X      spaceinline(x = strlen(t));
  392. X      strncpy(line+cs,t,x);
  393. -     free(t);
  394. -     free(s);
  395. X      mark = cs;
  396. X      cs += x;
  397. X  }
  398. --- 990,995 ----
  399. ***************
  400. *** 936,942 ****
  401. X      line[ll] = '\0';
  402. X      s = makequote(line);
  403. X      setline(s);
  404. -     free(s);
  405. X  }
  406. X  
  407. X  char *makequote(s) /**/
  408. --- 1001,1006 ----
  409. ***************
  410. *** 948,954 ****
  411. X      for (l = s; *l; l++)
  412. X          if (*l == '\'')
  413. X              qtct++;
  414. !     l = ol = zalloc((qtct*3)+3+strlen(s));
  415. X      *l++ = '\'';
  416. X      for (; *s; s++)
  417. X          if (*s == '\'')
  418. --- 1012,1018 ----
  419. X      for (l = s; *l; l++)
  420. X          if (*l == '\'')
  421. X              qtct++;
  422. !     l = ol = halloc((qtct*3)+3+strlen(s));
  423. X      *l++ = '\'';
  424. X      for (; *s; s++)
  425. X          if (*s == '\'')
  426. ***************
  427. *** 1012,1017 ****
  428. --- 1076,1172 ----
  429. X          feep();
  430. X          return;
  431. X          }
  432. +     histline = t0+1;
  433. X      sethistline(s);
  434. + }
  435. + #define NAMLEN 70
  436. + int executenamedcommand() /**/
  437. + {
  438. + char buf[NAMLEN],*ptr;
  439. + int len,ch,t0;
  440. +     strcpy(buf,"execute: ");
  441. +     ptr = buf+9;
  442. +     len = 0;
  443. +     statusline = buf;
  444. +     refresh();
  445. +     for (;ch = getkey(1);refresh())
  446. +         {
  447. +         switch (ch)
  448. +             {
  449. +             case 8: case 127:
  450. +                 if (len)
  451. +                     {
  452. +                     len--;
  453. +                     *--ptr = '\0';
  454. +                     }
  455. +                 break;
  456. +             case 23:
  457. +                 while (len && (len--, *--ptr != '-'))
  458. +                     *ptr = '\0';
  459. +                 break;
  460. +             case 21:
  461. +                 len = 0;
  462. +                 ptr = buf+9;
  463. +                 *ptr = '\0';
  464. +                 break;
  465. +             case 10: case 13: goto brk;
  466. +             case 7: case -1: statusline = NULL; return;
  467. +             case 9: case 32:
  468. +                 {
  469. +                 Lklist ll;
  470. +                 int ambig = 100;
  471. +                 heapalloc();
  472. +                 ll = newlist();
  473. +                 for (t0 = 0; t0 != ZLECMDCOUNT; t0++)
  474. +                     if (strpfx(buf+9,zlecmds[t0].name))
  475. +                         {
  476. +                         int xx;
  477. +                         addnode(ll,zlecmds[t0].name);
  478. +                         xx = pfxlen(peekfirst(ll),zlecmds[t0].name);
  479. +                         if (xx < ambig)
  480. +                             ambig = xx;
  481. +                         }
  482. +                 permalloc();
  483. +                 if (!full(ll))
  484. +                     feep();
  485. +                 else if (!nextnode(firstnode(ll)))
  486. +                     {
  487. +                     strcpy(buf+9,peekfirst(ll));
  488. +                     ptr = buf+(len = strlen(buf));
  489. +                     }
  490. +                 else
  491. +                     {
  492. +                     strcpy(buf+9,peekfirst(ll));
  493. +                     len = ambig;
  494. +                     ptr = buf+9+len;
  495. +                     *ptr = '\0';
  496. +                     feep();
  497. +                     listmatches(ll,NULL);
  498. +                     }
  499. +                 break;
  500. +                 }
  501. +             default:
  502. +                 if (len == NAMLEN-10 || icntrl(ch))
  503. +                     feep();
  504. +                 else
  505. +                     *ptr++ = ch, *ptr = '\0', len++;
  506. +                 break;
  507. +             }
  508. +         }
  509. + brk:
  510. +     statusline = NULL;
  511. +     ptr = buf+9;
  512. +     for (t0 = 0; t0 != ZLECMDCOUNT; t0++)
  513. +         if (!strcmp(ptr,zlecmds[t0].name))
  514. +             break;
  515. +     if (t0 != ZLECMDCOUNT)
  516. +         return lastnamed = t0;
  517. +     else
  518. +         return z_undefinedkey;
  519. X  }
  520. X  
  521. *** src/zsh0/zsh2.00/src/zle_emacs.pro    Tue Apr 23 00:30:03 1991
  522. --- zsh2.00/src/zle_emacs.pro    Tue May  7 22:53:30 1991
  523. ***************
  524. *** 1,5 ****
  525. --- 1,7 ----
  526. X  void beginningofline DCLPROTO((void));
  527. X  void endofline DCLPROTO((void));
  528. + void beginningoflinehist DCLPROTO((void));
  529. + void endoflinehist DCLPROTO((void));
  530. X  void forwardchar DCLPROTO((void));
  531. X  void backwardchar DCLPROTO((void));
  532. X  void selfinsert DCLPROTO((void));
  533. ***************
  534. *** 62,64 ****
  535. --- 64,67 ----
  536. X  char *makequote DCLPROTO((char *s));
  537. X  void acceptandinfernexthistory DCLPROTO((void));
  538. X  void infernexthistory DCLPROTO((void));
  539. + int executenamedcommand DCLPROTO((void));
  540. *** src/zsh0/zsh2.00/src/zle_main.c    Tue Apr 23 00:30:05 1991
  541. --- zsh2.00/src/zle_main.c    Wed May  8 22:34:14 1991
  542. ***************
  543. *** 33,39 ****
  544. X  #define ZLEGLOBALS
  545. X  #define ZLE
  546. X  #include "zsh.h"
  547. - #include "funcs.h"
  548. X  #include <sys/types.h>
  549. X  #include <sys/errno.h>
  550. X  
  551. --- 33,38 ----
  552. ***************
  553. *** 41,57 ****
  554. X  
  555. X  /* set up terminal */
  556. X  
  557. X  void setterm() /**/
  558. X  {
  559. X  struct ttyinfo ti;
  560. - int t0;
  561. X  
  562. X      inittty();
  563. X      ti = shttyinfo;
  564. X  #ifdef TERMIOS
  565. X      ti.termios.c_lflag &= ~(ICANON|ECHO);
  566. !     for (t0 = 0; t0 <= NCCS; t0++)
  567. !         ti.termios.c_cc[t0] = 0;
  568. X      ti.termios.c_cc[VMIN] = 1;
  569. X      ti.termios.c_cc[VTIME] = 0;
  570. X      ti.termios.c_iflag &= ~(IXON|IXOFF|INLCR|ICRNL|ISTRIP);
  571. --- 40,57 ----
  572. X  
  573. X  /* set up terminal */
  574. X  
  575. X  void setterm() /**/
  576. X  {
  577. X  struct ttyinfo ti;
  578. X  
  579. X      inittty();
  580. X      ti = shttyinfo;
  581. X  #ifdef TERMIOS
  582. X      ti.termios.c_lflag &= ~(ICANON|ECHO);
  583. !     ti.termios.c_cc[VQUIT] = ti.termios.c_cc[VDISCARD] = 
  584. !         ti.termios.c_cc[VSUSP] = ti.termios.c_cc[VDSUSP] =
  585. !         ti.termios.c_cc[VSTOP] = ti.termios.c_cc[VSTART] = 0;
  586. X      ti.termios.c_cc[VMIN] = 1;
  587. X      ti.termios.c_cc[VTIME] = 0;
  588. X      ti.termios.c_iflag &= ~(IXON|IXOFF|INLCR|ICRNL|ISTRIP);
  589. ***************
  590. *** 58,79 ****
  591. X  #else
  592. X  #ifdef TERMIO
  593. X      ti.termio.c_lflag &= ~(ICANON|ECHO);
  594. !     for (t0 = 0; t0 <= NCCS; t0++)
  595. !         ti.termio.c_cc[t0] = 0;
  596. X      ti.termio.c_cc[VMIN] = 1;
  597. X      ti.termio.c_cc[VTIME] = 0;
  598. X      ti.termio.c_iflag &= ~(IXON|IXOFF|INLCR|ICRNL|ISTRIP);
  599. X  #else
  600. X      ti.sgttyb.sg_flags = (ti.sgttyb.sg_flags | CBREAK) & ~ECHO;
  601. !     ti.tchars.t_intrc = ti.tchars.t_quitc = ti.tchars.t_startc =
  602. !         ti.tchars.t_stopc = ti.tchars.t_eofc = ti.tchars.t_brkc =
  603. !         ti.ltchars.t_suspc = ti.ltchars.t_dsuspc =
  604. !         ti.ltchars.t_rprntc = ti.ltchars.t_flushc =
  605. !         ti.ltchars.t_werasc = ti.ltchars.t_lnextc = 
  606. !         ti.sgttyb.sg_erase = ti.sgttyb.sg_kill = -1;
  607. X  #endif
  608. X  #endif
  609. X      settyinfo(&ti);
  610. X  }
  611. X  
  612. X  void unsetterm() /**/
  613. --- 58,84 ----
  614. X  #else
  615. X  #ifdef TERMIO
  616. X      ti.termio.c_lflag &= ~(ICANON|ECHO);
  617. !     ti.termio.c_cc[VQUIT] =
  618. !         ti.termio.c_cc[VSTOP] = ti.termio.c_cc[VSTART] = 0;
  619. X      ti.termio.c_cc[VMIN] = 1;
  620. X      ti.termio.c_cc[VTIME] = 0;
  621. X      ti.termio.c_iflag &= ~(IXON|IXOFF|INLCR|ICRNL|ISTRIP);
  622. X  #else
  623. X      ti.sgttyb.sg_flags = (ti.sgttyb.sg_flags | CBREAK) & ~ECHO;
  624. ! #ifdef LPASS8OUT
  625. !     ti.lmodes |= LPASS8|LPASS8OUT;
  626. ! #else
  627. !     ti.lmodes |= LPASS8;
  628. X  #endif
  629. +     ti.tchars.t_quitc = ti.tchars.t_startc =
  630. +         ti.tchars.t_stopc = ti.ltchars.t_suspc =
  631. +         ti.ltchars.t_dsuspc = ti.ltchars.t_lnextc = -1;
  632. X  #endif
  633. + #endif
  634. X      settyinfo(&ti);
  635. + #ifdef TCXONC
  636. +     ioctl(SHTTY,TCXONC,1);
  637. + #endif
  638. X  }
  639. X  
  640. X  void unsetterm() /**/
  641. ***************
  642. *** 113,120 ****
  643. --- 118,129 ----
  644. X              continue;
  645. X          else if (errno == EINTR)
  646. X              {
  647. +             if (!errflag)
  648. +                 continue;
  649. +             errflag = 0;
  650. X              if (tmok)
  651. X                  return -1;
  652. +             return 3;
  653. X              }
  654. X          else
  655. X              {
  656. ***************
  657. *** 175,181 ****
  658. X          }
  659. X      initundo();
  660. X      setterm();
  661. !     if (unset(SHUTUPKARTIK))
  662. X          putchar('\r');
  663. X      refresh();
  664. X      if (tmout)
  665. --- 184,190 ----
  666. X          }
  667. X      initundo();
  668. X      setterm();
  669. !     if (unset(NOPROMPTCLOBBER))
  670. X          putchar('\r');
  671. X      refresh();
  672. X      if (tmout)
  673. ***************
  674. *** 207,214 ****
  675. X              if (lastcmd & ZLE_MOD)
  676. X                  addundo();
  677. X              }
  678. !         else if (errflag)
  679. X              break;
  680. X          FD_SET(0,&foofd);
  681. X          if ((tv.tv_usec = cost*costmult) > 500000)
  682. X              tv.tv_usec = 500000;
  683. --- 216,226 ----
  684. X              if (lastcmd & ZLE_MOD)
  685. X                  addundo();
  686. X              }
  687. !         else
  688. !             {
  689. !             errflag = 1;
  690. X              break;
  691. +             }
  692. X          FD_SET(0,&foofd);
  693. X          if ((tv.tv_usec = cost*costmult) > 500000)
  694. X              tv.tv_usec = 500000;
  695. ***************
  696. *** 247,253 ****
  697. X  int t0,ret;
  698. X  Key ky;
  699. X  
  700. - kludge:
  701. X      t0 = 1;
  702. X      cky = NULL;
  703. X      if ((c = getkey(1)) == -1)
  704. --- 259,264 ----
  705. ***************
  706. *** 261,270 ****
  707. X              buf[t0++] = (c) ? c : 0x80;
  708. X              buf[t0] = '\0';
  709. X              if (!(ky = (Key) gethnode(buf,xbindtab)))
  710. !                 {
  711. !                 feep();
  712. !                 return -1;
  713. !                 }
  714. X              if (ky->func != z_sequenceleadin)
  715. X                  {
  716. X                  cky = ky;
  717. --- 272,278 ----
  718. X              buf[t0++] = (c) ? c : 0x80;
  719. X              buf[t0] = '\0';
  720. X              if (!(ky = (Key) gethnode(buf,xbindtab)))
  721. !                 return z_undefinedkey;
  722. X              if (ky->func != z_sequenceleadin)
  723. X                  {
  724. X                  cky = ky;
  725. ***************
  726. *** 273,293 ****
  727. X                  }
  728. X              }
  729. X          }
  730. -     if (ret == z_metafynext)
  731. -         {
  732. -         metafynext();
  733. -         goto kludge;
  734. -         }
  735. X      if (ret == z_vidigitorbeginningofline)
  736. X          ret = (lastcmd & ZLE_ARG) ? z_digitargument : z_beginningofline;
  737. X      return ret;
  738. X  }
  739. X  
  740. - void metafynext() /**/
  741. - {
  742. -     ungetkey(getkey(0)|0x80);
  743. - }
  744. X  void sendstring() /**/
  745. X  {
  746. X  char buf[2];
  747. --- 281,295 ----
  748. X                  }
  749. X              }
  750. X          }
  751. X      if (ret == z_vidigitorbeginningofline)
  752. X          ret = (lastcmd & ZLE_ARG) ? z_digitargument : z_beginningofline;
  753. +     else if (ret == z_executenamedcmd)
  754. +         ret = executenamedcommand();
  755. +     else if (ret == z_executelastnamedcmd)
  756. +         ret = lastnamed;
  757. X      return ret;
  758. X  }
  759. X  
  760. X  void sendstring() /**/
  761. X  {
  762. X  char buf[2];
  763. ***************
  764. *** 312,321 ****
  765. X  
  766. X  void initxbindtab() /**/
  767. X  {
  768. ! int t0;
  769. X  
  770. !     for (t0 = 0; t0 != 256; t0++)
  771. !         mainbindtab[t0] = emacsbind[t0];
  772. X      for (t0 = 0; t0 != 128; t0++)
  773. X          altbindtab[t0] = vicmdbind[t0];
  774. X      for (t0 = 128; t0 != 256; t0++)
  775. --- 314,347 ----
  776. X  
  777. X  void initxbindtab() /**/
  778. X  {
  779. ! int t0,vi = 0;
  780. ! char buf[3],*s;
  781. X  
  782. !     lastnamed = z_undefinedkey;
  783. !     if (s = zgetenv("VISUAL"))
  784. !         {
  785. !         if (ztrstr(s,"vi"))
  786. !             vi = 1;
  787. !         }
  788. !     else if ((s = zgetenv("EDITOR")) && ztrstr(s,"vi"))
  789. !         vi = 1;
  790. !     if (vi)
  791. !         {
  792. !         for (t0 = 0; t0 != 32; t0++)
  793. !             mainbindtab[t0] = viinsbind[t0];
  794. !         for (t0 = 32; t0 != 256; t0++)
  795. !             mainbindtab[t0] = z_selfinsert;
  796. !         mainbindtab[127] = z_backwarddeletechar;
  797. !         }
  798. !     else
  799. !         {
  800. !         for (t0 = 0; t0 != 128; t0++)
  801. !             mainbindtab[t0] = emacsbind[t0];
  802. !         for (t0 = 128; t0 != 256; t0++)
  803. !             mainbindtab[t0] = z_selfinsert;
  804. !         }
  805. !     for (t0 = 0200; t0 != 0240; t0++)
  806. !         mainbindtab[t0] = z_undefinedkey;
  807. X      for (t0 = 0; t0 != 128; t0++)
  808. X          altbindtab[t0] = vicmdbind[t0];
  809. X      for (t0 = 128; t0 != 256; t0++)
  810. ***************
  811. *** 323,333 ****
  812. X      bindtab = mainbindtab;
  813. X      kungetbuf = zalloc(kungetsz = 32);
  814. X      kungetct = 0;
  815. !     xbindtab = newhtable(13);
  816. !     addhperm("\333C",makefunckey(z_forwardchar),xbindtab,NULL);
  817. !     addhperm("\333D",makefunckey(z_backwardchar),xbindtab,NULL);
  818. !     addhperm("\333A",makefunckey(z_uplineorhistory),xbindtab,NULL);
  819. !     addhperm("\333B",makefunckey(z_downlineorhistory),xbindtab,NULL);
  820. X      addhperm("\30*",makefunckey(z_expandword),xbindtab,NULL);
  821. X      addhperm("\30g",makefunckey(z_listexpand),xbindtab,NULL);
  822. X      addhperm("\30G",makefunckey(z_listexpand),xbindtab,NULL);
  823. --- 349,359 ----
  824. X      bindtab = mainbindtab;
  825. X      kungetbuf = zalloc(kungetsz = 32);
  826. X      kungetct = 0;
  827. !     xbindtab = newhtable(67);
  828. !     addhperm("\33\133C",makefunckey(z_forwardchar),xbindtab,NULL);
  829. !     addhperm("\33\133D",makefunckey(z_backwardchar),xbindtab,NULL);
  830. !     addhperm("\33\133A",makefunckey(z_uplineorhistory),xbindtab,NULL);
  831. !     addhperm("\33\133B",makefunckey(z_downlineorhistory),xbindtab,NULL);
  832. X      addhperm("\30*",makefunckey(z_expandword),xbindtab,NULL);
  833. X      addhperm("\30g",makefunckey(z_listexpand),xbindtab,NULL);
  834. X      addhperm("\30G",makefunckey(z_listexpand),xbindtab,NULL);
  835. ***************
  836. *** 343,348 ****
  837. --- 369,381 ----
  838. X          xbindtab,NULL);
  839. X      addhperm("run-help",mkanode(ztrdup("man"),1),aliastab,NULL);
  840. X      addhperm("which-command",mkanode(ztrdup("whence"),1),aliastab,NULL);
  841. +     strcpy(buf,"\33q");
  842. +     for (t0 = 128; t0 != 256; t0++)
  843. +         if (emacsbind[t0] != z_undefinedkey)
  844. +             {
  845. +             buf[1] = t0 & 0x7f;
  846. +             addhnode(ztrdup(buf),makefunckey(emacsbind[t0]),xbindtab,NULL);
  847. +             }
  848. X      stackhist = stackcs = -1;
  849. X  }
  850. X  
  851. ***************
  852. *** 355,366 ****
  853. X  
  854. X      for (;*s;s++)
  855. X          {
  856. !         if (*s == '\33' && s[1] && first && bindtab[033] == z_metafynext)
  857. !             {
  858. !             *t++ = s[1]|0x80;
  859. !             s++;
  860. !             }
  861. !         else if (*s == '\\' && s[1])
  862. X              switch(*++s)
  863. X                  {
  864. X                  case 'a': *t++ = '\07'; break;
  865. --- 388,394 ----
  866. X  
  867. X      for (;*s;s++)
  868. X          {
  869. !         if (*s == '\\' && s[1])
  870. X              switch(*++s)
  871. X                  {
  872. X                  case 'a': *t++ = '\07'; break;
  873. ***************
  874. *** 422,428 ****
  875. X          if (icntrl(ch))
  876. X              switch(ch)
  877. X                  {
  878. !                 case '\x7f': printf("^?"); break;
  879. X                  default: printf("^%c",(ch|0x40)); break;
  880. X                  }
  881. X          else
  882. --- 450,456 ----
  883. X          if (icntrl(ch))
  884. X              switch(ch)
  885. X                  {
  886. !                 case 0x7f: printf("^?"); break;
  887. X                  default: printf("^%c",(ch|0x40)); break;
  888. X                  }
  889. X          else
  890. ***************
  891. *** 445,451 ****
  892. X          printf("\"\n");
  893. X          }
  894. X      else
  895. !         printf("%s\n",zlecmds[k->func]);
  896. X  }
  897. X  
  898. X  int bin_bindkey(name,argv,ops,junc) /**/
  899. --- 473,479 ----
  900. X          printf("\"\n");
  901. X          }
  902. X      else
  903. !         printf("%s\n",zlecmds[k->func].name);
  904. X  }
  905. X  
  906. X  int bin_bindkey(name,argv,ops,junc) /**/
  907. ***************
  908. *** 464,471 ****
  909. X              return 1;
  910. X              }
  911. X          if (ops['d'] || ops['e'])
  912. !             for (t0 = 0; t0 != 256; t0++)
  913. !                 tab[t0] = emacsbind[t0];
  914. X          else
  915. X              {
  916. X              for (t0 = 0; t0 != 32; t0++)
  917. --- 492,507 ----
  918. X              return 1;
  919. X              }
  920. X          if (ops['d'] || ops['e'])
  921. !             if (ops['m'])
  922. !                 for (t0 = 0; t0 != 256; t0++)
  923. !                     tab[t0] = emacsbind[t0];
  924. !             else
  925. !                 {
  926. !                 for (t0 = 0; t0 != 128; t0++)
  927. !                     tab[t0] = emacsbind[t0];
  928. !                 for (t0 = 128; t0 != 256; t0++)
  929. !                     tab[t0] = z_selfinsert;
  930. !                 }
  931. X          else
  932. X              {
  933. X              for (t0 = 0; t0 != 32; t0++)
  934. ***************
  935. *** 478,483 ****
  936. --- 514,521 ----
  937. X              altbindtab[t0] = vicmdbind[t0];
  938. X          for (t0 = 128; t0 != 256; t0++)
  939. X              altbindtab[t0] = emacsbind[t0];
  940. +         for (t0 = 0200; t0 != 0240; t0++)
  941. +             tab[t0] = z_undefinedkey;
  942. X          return 0;
  943. X          }
  944. X      if (!*argv)
  945. ***************
  946. *** 541,546 ****
  947. --- 579,585 ----
  948. X              if (func == z_sendstring)
  949. X                  {
  950. X                  printbind(ky->str,ky->len);
  951. +                 putchar('\n');
  952. X                  return 0;
  953. X                  }
  954. X              printf("%s\n",zlecmds[func].name);
  955. ***************
  956. *** 614,620 ****
  957. X  }
  958. X  
  959. X  void freekey(x) /**/
  960. ! void *x;
  961. X  {
  962. X  Key k = x;
  963. X  
  964. --- 653,659 ----
  965. X  }
  966. X  
  967. X  void freekey(x) /**/
  968. ! vptr x;
  969. X  {
  970. X  Key k = x;
  971. X  
  972. *** src/zsh0/zsh2.00/src/zle_refresh.c    Tue Apr 23 00:30:05 1991
  973. --- zsh2.00/src/zle_refresh.c    Wed May  8 22:34:14 1991
  974. ***************
  975. *** 32,38 ****
  976. X  
  977. X  #define ZLE
  978. X  #include "zsh.h"
  979. - #include "funcs.h"
  980. X  
  981. X  char **obuf = NULL,**nbuf = NULL;
  982. X  int olnct,nlnct;
  983. --- 32,37 ----
  984. *** src/zsh0/zsh2.00/src/zle_utils.c    Tue Apr 23 00:30:05 1991
  985. --- zsh2.00/src/zle_utils.c    Wed May  8 22:34:14 1991
  986. ***************
  987. *** 32,38 ****
  988. X  
  989. X  #define ZLE
  990. X  #include "zsh.h"
  991. - #include "funcs.h"
  992. X  
  993. X  /* make sure that the line buffer has at least sz chars */
  994. X  
  995. --- 32,37 ----
  996. ***************
  997. *** 171,176 ****
  998. --- 170,177 ----
  999. X      *b = findeol();
  1000. X  }
  1001. X  
  1002. + static int lastlinelen;
  1003. X  void initundo() /**/
  1004. X  {
  1005. X  int t0;
  1006. ***************
  1007. *** 178,184 ****
  1008. X      for (t0 = 0; t0 != UNDOCT; t0++)
  1009. X          undos[t0].change = NULL;
  1010. X      undoct = 0;
  1011. !     lastline = ztrdup(line);
  1012. X      lastcs = cs;
  1013. X  }
  1014. X  
  1015. --- 179,186 ----
  1016. X      for (t0 = 0; t0 != UNDOCT; t0++)
  1017. X          undos[t0].change = NULL;
  1018. X      undoct = 0;
  1019. !     lastline = zalloc(lastlinelen = (ll+1 < 32) ? 32 : ll+1);
  1020. !     strcpy(lastline,line);
  1021. X      lastcs = cs;
  1022. X  }
  1023. X  
  1024. ***************
  1025. *** 196,220 ****
  1026. X          s2 > s && t > t2 && s2[-1] == t2[-1]; s2--,t2--);
  1027. X      sf = strlen(s2);
  1028. X      ue = undos+(undoct = (UNDOCT-1) & (undoct+1));
  1029. -     if (ue->change)
  1030. -         free(ue->change);
  1031. X      ue->pref = pf;
  1032. X      ue->suff = sf;
  1033. X      ue->len = t2-t;
  1034. X      ue->cs = lastcs;
  1035. !     strncpy(ue->change = zalloc(ue->len),t,ue->len);
  1036. !     free(lastline);
  1037. !     lastline = ztrdup(line);
  1038. X      lastcs = cs;
  1039. X  }
  1040. X  
  1041. X  void freeundo() /**/
  1042. X  {
  1043. - int t0;
  1044. -     for (t0 = 0; t0 != UNDOCT; t0++)
  1045. -         if (undos[t0].change)
  1046. -             free(undos[t0].change);
  1047. X      free(lastline);
  1048. X  }
  1049. X  
  1050. --- 198,219 ----
  1051. X          s2 > s && t > t2 && s2[-1] == t2[-1]; s2--,t2--);
  1052. X      sf = strlen(s2);
  1053. X      ue = undos+(undoct = (UNDOCT-1) & (undoct+1));
  1054. X      ue->pref = pf;
  1055. X      ue->suff = sf;
  1056. X      ue->len = t2-t;
  1057. X      ue->cs = lastcs;
  1058. !     strncpy(ue->change = halloc(ue->len),t,ue->len);
  1059. !     while (ll+1 > lastlinelen)
  1060. !         {
  1061. !         free(lastline);
  1062. !         lastline = zalloc(lastlinelen *= 2);
  1063. !         }
  1064. !     strcpy(lastline,line);
  1065. X      lastcs = cs;
  1066. X  }
  1067. X  
  1068. X  void freeundo() /**/
  1069. X  {
  1070. X      free(lastline);
  1071. X  }
  1072. X  
  1073. *** src/zsh0/zsh2.00/src/zle_vi.c    Tue Apr 23 00:30:05 1991
  1074. --- zsh2.00/src/zle_vi.c    Wed May  8 22:34:14 1991
  1075. ***************
  1076. *** 32,38 ****
  1077. X  
  1078. X  #define ZLE
  1079. X  #include "zsh.h"
  1080. - #include "funcs.h"
  1081. X  
  1082. X  int vigetkey() /**/
  1083. X  {
  1084. --- 32,37 ----
  1085. ***************
  1086. *** 63,69 ****
  1087. X              feep();
  1088. X              return -1;
  1089. X              }
  1090. !         if (k2 == z_metafynext || zlecmds[k2].flags & ZLE_ARG)
  1091. X              zlecmds[k2].func();
  1092. X          else
  1093. X              break;
  1094. --- 62,68 ----
  1095. X              feep();
  1096. X              return -1;
  1097. X              }
  1098. !         if (zlecmds[k2].flags & ZLE_ARG)
  1099. X              zlecmds[k2].func();
  1100. X          else
  1101. X              break;
  1102. ***************
  1103. *** 150,156 ****
  1104. X  int cq;
  1105. X  
  1106. X      findline(&cs,&cq);
  1107. !     foredel(cq-cs+1);
  1108. X      bindtab = mainbindtab;
  1109. X      insmode = 1;
  1110. X  }
  1111. --- 149,155 ----
  1112. X  int cq;
  1113. X  
  1114. X      findline(&cs,&cq);
  1115. !     foredel(cq-cs);
  1116. X      bindtab = mainbindtab;
  1117. X      insmode = 1;
  1118. X  }
  1119. ***************
  1120. *** 403,411 ****
  1121. X          int ch = line[cs];
  1122. X  
  1123. X          if (ch >= 'a' && ch <= 'z')
  1124. !             ch = toupper(ch);
  1125. X          else if (ch >= 'A' && ch <= 'Z')
  1126. !             ch = tolower(ch);
  1127. X          line[cs++] = ch;
  1128. X          }
  1129. X  }
  1130. --- 402,410 ----
  1131. X          int ch = line[cs];
  1132. X  
  1133. X          if (ch >= 'a' && ch <= 'z')
  1134. !             ch = tuupper(ch);
  1135. X          else if (ch >= 'A' && ch <= 'Z')
  1136. !             ch = tulower(ch);
  1137. X          line[cs++] = ch;
  1138. X          }
  1139. X  }
  1140. ***************
  1141. *** 421,429 ****
  1142. X          int ch = line[cs];
  1143. X  
  1144. X          if (ch >= 'a' && ch <= 'z')
  1145. !             ch = toupper(ch);
  1146. X          else if (ch >= 'A' && ch <= 'Z')
  1147. !             ch = tolower(ch);
  1148. X          line[cs++] = ch;
  1149. X          }
  1150. X  }
  1151. --- 420,428 ----
  1152. X          int ch = line[cs];
  1153. X  
  1154. X          if (ch >= 'a' && ch <= 'z')
  1155. !             ch = tuupper(ch);
  1156. X          else if (ch >= 'A' && ch <= 'Z')
  1157. !             ch = tulower(ch);
  1158. X          line[cs++] = ch;
  1159. X          }
  1160. X  }
  1161. *** src/zsh0/zsh2.00/src/zsh.h    Wed Apr 24 17:49:49 1991
  1162. --- zsh2.00/src/zsh.h    Wed May  8 22:13:27 1991
  1163. ***************
  1164. *** 50,59 ****
  1165. X  #endif
  1166. X  #endif
  1167. X  #include <sys/param.h>
  1168. - #include <sys/stat.h>
  1169. X  
  1170. ! #define VERSIONSTR "zsh v2.00.01"
  1171. X  
  1172. X  #define DEFWORDCHARS "*?_-.[]~=/&;!#$%^(){}<>"
  1173. X  #define DEFTIMEFMT "%E real  %U user  %S system  %P"
  1174. X  #ifdef UTMP_HOST
  1175. --- 50,74 ----
  1176. X  #endif
  1177. X  #endif
  1178. X  #include <sys/param.h>
  1179. X  
  1180. ! #define VERSIONSTR "zsh v2.00.02"
  1181. X  
  1182. + #if 0 /* __STDC__ */
  1183. + #include <unistd.h>
  1184. + #include <stdlib.h>
  1185. + #include <fcntl.h>
  1186. + #include <stat.h>
  1187. + #define DCLPROTO(X) X
  1188. + #undef NULL
  1189. + #define NULL ((void *)0)
  1190. + #else /* not __STDC__ */
  1191. + #include <sys/stat.h>
  1192. + #define DCLPROTO(X) ()
  1193. + #ifndef NULL
  1194. + #define NULL 0
  1195. + #endif
  1196. + #endif /* __STDC__ */
  1197. X  #define DEFWORDCHARS "*?_-.[]~=/&;!#$%^(){}<>"
  1198. X  #define DEFTIMEFMT "%E real  %U user  %S system  %P"
  1199. X  #ifdef UTMP_HOST
  1200. ***************
  1201. *** 62,69 ****
  1202. X  #define DEFWATCHFMT "%n has %a %l."
  1203. X  #endif
  1204. X  
  1205. - #define DCLPROTO(X) ()
  1206. X  #ifdef GLOBALS
  1207. X  #define EXTERN
  1208. X  #else
  1209. --- 77,82 ----
  1210. ***************
  1211. *** 72,85 ****
  1212. X  
  1213. X  #include "zle.h"
  1214. X  
  1215. ! /* size of job list - set small on purpose */
  1216. X  
  1217. ! #define MAXJOB 16
  1218. X  
  1219. X  /* memory allocation routines - changed with permalloc()/heapalloc() */
  1220. X  
  1221. ! void *(*alloc)DCLPROTO((int));
  1222. ! void *(*ncalloc)DCLPROTO((int));
  1223. X  
  1224. X  #define addhnode(A,B,C,D) Addhnode(A,B,C,D,1)
  1225. X  #define addhperm(A,B,C,D) Addhnode(A,B,C,D,0)
  1226. --- 85,98 ----
  1227. X  
  1228. X  #include "zle.h"
  1229. X  
  1230. ! /* size of job list */
  1231. X  
  1232. ! #define MAXJOB 80
  1233. X  
  1234. X  /* memory allocation routines - changed with permalloc()/heapalloc() */
  1235. X  
  1236. ! vptr (*alloc)DCLPROTO((int));
  1237. ! vptr (*ncalloc)DCLPROTO((int));
  1238. X  
  1239. X  #define addhnode(A,B,C,D) Addhnode(A,B,C,D,1)
  1240. X  #define addhperm(A,B,C,D) Addhnode(A,B,C,D,0)
  1241. ***************
  1242. *** 87,93 ****
  1243. X  /* character tokens */
  1244. X  
  1245. X  #define ALPOP            ((char) 0x81)
  1246. - #define HERR            ((char) 0x82)
  1247. X  #define HISTSPACE        ((char) 0x83)
  1248. X  #define Pound            ((char) 0x84)
  1249. X  #define String            ((char) 0x85)
  1250. --- 100,105 ----
  1251. ***************
  1252. *** 141,150 ****
  1253. X  typedef struct lklist *Lklist;
  1254. X  typedef struct lknode *Lknode;
  1255. X  typedef struct comp *Comp;
  1256. X  typedef struct complist *Complist;
  1257. X  typedef struct heap *Heap;
  1258. ! typedef void (*FFunc)DCLPROTO((void *));
  1259. ! typedef void *(*VFunc)DCLPROTO((void *));
  1260. X  typedef void (*HFunc)DCLPROTO((char *,char *));
  1261. X  
  1262. X  /* linked list abstract data type */
  1263. --- 153,163 ----
  1264. X  typedef struct lklist *Lklist;
  1265. X  typedef struct lknode *Lknode;
  1266. X  typedef struct comp *Comp;
  1267. + typedef struct redir *Redir;
  1268. X  typedef struct complist *Complist;
  1269. X  typedef struct heap *Heap;
  1270. ! typedef void (*FFunc)DCLPROTO((vptr));
  1271. ! typedef vptr (*VFunc)DCLPROTO((vptr));
  1272. X  typedef void (*HFunc)DCLPROTO((char *,char *));
  1273. X  
  1274. X  /* linked list abstract data type */
  1275. ***************
  1276. *** 154,160 ****
  1277. X  
  1278. X  struct lknode {
  1279. X     Lknode next,last;
  1280. !    void *dat;
  1281. X     };
  1282. X  struct lklist {
  1283. X     Lknode first,last;
  1284. --- 167,173 ----
  1285. X  
  1286. X  struct lknode {
  1287. X     Lknode next,last;
  1288. !    vptr dat;
  1289. X     };
  1290. X  struct lklist {
  1291. X     Lknode first,last;
  1292. ***************
  1293. *** 181,197 ****
  1294. X  
  1295. X  struct node {
  1296. X      int data[4];            /* arbitrary integer data */
  1297. !     void *ptrs[4];            /* arbitrary pointer data */
  1298. X      int types[4];            /* what ptrs[] are pointing to */
  1299. X      int type;                /* node type */
  1300. X      };
  1301. X  
  1302. ! enum node_type {
  1303. !     N_LIST,N_SUBLIST,N_PLINE,N_CMD,
  1304. !     N_REDIR,N_COND,N_FOR,N_CASE,
  1305. !     N_IF,N_WHILE,N_VARASG,
  1306. !     N_COUNT
  1307. !     };
  1308. X  
  1309. X  /* values for types[4] */
  1310. X  
  1311. --- 194,216 ----
  1312. X  
  1313. X  struct node {
  1314. X      int data[4];            /* arbitrary integer data */
  1315. !     vptr ptrs[4];            /* arbitrary pointer data */
  1316. X      int types[4];            /* what ptrs[] are pointing to */
  1317. X      int type;                /* node type */
  1318. X      };
  1319. X  
  1320. ! #define N_LIST 0
  1321. ! #define N_SUBLIST 1
  1322. ! #define N_PLINE 2
  1323. ! #define N_CMD 3
  1324. ! #define N_REDIR 4
  1325. ! #define N_COND 5
  1326. ! #define N_FOR 6
  1327. ! #define N_CASE 7
  1328. ! #define N_IF 8
  1329. ! #define N_WHILE 9
  1330. ! #define N_VARASG 10
  1331. ! #define N_COUNT 11
  1332. X  
  1333. X  /* values for types[4] */
  1334. X  
  1335. ***************
  1336. *** 210,220 ****
  1337. X     List right;
  1338. X     };
  1339. X  
  1340. ! enum list_type {
  1341. !    SYNC,        /* ; */
  1342. !     ASYNC,    /* & */
  1343. !     TIMED
  1344. !    };
  1345. X  
  1346. X  /* tree element for sublists */
  1347. X  
  1348. --- 229,237 ----
  1349. X     List right;
  1350. X     };
  1351. X  
  1352. ! #define SYNC 0        /* ; */
  1353. ! #define ASYNC 1    /* & */
  1354. ! #define TIMED 2
  1355. X  
  1356. X  /* tree element for sublists */
  1357. X  
  1358. ***************
  1359. *** 226,235 ****
  1360. X      Sublist right;
  1361. X      };
  1362. X  
  1363. ! enum sublist_type {
  1364. !     ORNEXT = 10,    /* || */
  1365. !     ANDNEXT            /* && */
  1366. !     };
  1367. X  
  1368. X  #define PFLAG_NOT 1            /* ! ... */
  1369. X  #define PFLAG_COPROC 32        /* coproc ... */
  1370. --- 243,250 ----
  1371. X      Sublist right;
  1372. X      };
  1373. X  
  1374. ! #define ORNEXT 10        /* || */
  1375. ! #define ANDNEXT 11    /* && */
  1376. X  
  1377. X  #define PFLAG_NOT 1            /* ! ... */
  1378. X  #define PFLAG_COPROC 32        /* coproc ... */
  1379. ***************
  1380. *** 243,252 ****
  1381. X     Pline right;
  1382. X     };
  1383. X  
  1384. ! enum pline_type {
  1385. !    END,        /* pnode *right is null */
  1386. !     PIPE        /* pnode *right is the rest of the pipeline */
  1387. !    };
  1388. X  
  1389. X  /* tree element for commands */
  1390. X  
  1391. --- 258,265 ----
  1392. X     Pline right;
  1393. X     };
  1394. X  
  1395. ! #define END        0    /* pnode *right is null */
  1396. ! #define PIPE    1    /* pnode *right is the rest of the pipeline */
  1397. X  
  1398. X  /* tree element for commands */
  1399. X  
  1400. ***************
  1401. *** 268,287 ****
  1402. X      Lklist vars;            /* param assignments (struct varasg *'s) */
  1403. X     };
  1404. X  
  1405. ! enum cmd_type {
  1406. !     SIMPLE,        /* simple command */
  1407. !     SUBSH,        /* ( list ) */
  1408. !     ZCTIME,        /* time pline */
  1409. !     CURSH,        /* { list } */
  1410. !     FUNCDEF,        /* foo ... () { list } */
  1411. !     CFOR,
  1412. !     CWHILE,
  1413. !     CREPEAT,
  1414. !     CIF,
  1415. !     CCASE,
  1416. !     CSELECT,
  1417. !     COND,            /* [[ ... ]] */
  1418. !     };
  1419. X  
  1420. X  #define CFLAG_EXEC 1            /* exec ... */
  1421. X  #define CFLAG_COMMAND 2        /* command ... */
  1422. --- 281,298 ----
  1423. X      Lklist vars;            /* param assignments (struct varasg *'s) */
  1424. X     };
  1425. X  
  1426. ! #define SIMPLE 0
  1427. ! #define SUBSH 1
  1428. ! #define ZCTIME 2
  1429. ! #define CURSH 3
  1430. ! #define FUNCDEF 4
  1431. ! #define CFOR 5
  1432. ! #define CWHILE 6
  1433. ! #define CREPEAT 7
  1434. ! #define CIF 8
  1435. ! #define CCASE 9
  1436. ! #define CSELECT 10
  1437. ! #define COND 11
  1438. X  
  1439. X  #define CFLAG_EXEC 1            /* exec ... */
  1440. X  #define CFLAG_COMMAND 2        /* command ... */
  1441. ***************
  1442. *** 296,336 ****
  1443. X      struct redir *pair;        /* used by the parser */
  1444. X     };
  1445. X  
  1446. ! enum ftype {
  1447. !     WRITE,            /* fd1 > name */
  1448. !     WRITENOW,        /* fd1 >! name */
  1449. !     APP,                /* fd1 >> name */
  1450. !     APPNOW,            /* fd1 >>! name */
  1451. !     MERGEOUT,        /* fd1 >& fd2 */
  1452. !     MERGEOUTNOW,    /* fd1 >&! fd2 */
  1453. !     ERRAPP,        /* fd1 >>& */
  1454. !     ERRAPPNOW,     /* fd1 >>&! */
  1455. !     READ,                /* fd1 < name */
  1456. !     HEREDOC,            /* fd1 << foo */
  1457. !     MERGE,            /* fd1 <& fd2 */
  1458. X  
  1459. -     CLOSE,            /* fd1 >&-, #<&- */
  1460. -     INPIPE,            /* fd1 < name, where name is <(...) */
  1461. -     OUTPIPE,            /* fd1 > name, where name is >(...)  */
  1462. -     HERESTR,            /* fd1 <<< foo */
  1463. -     NONE
  1464. -     };
  1465. X  /* tree element for conditionals */
  1466. X  
  1467. X  struct cond {
  1468. X      int type;        /* can be cond_type, or a single letter (-a, -b, ...) */
  1469. X      int ifil[3];
  1470. !     void *left,*right,*vfil[2];
  1471. X      int types[4],typ;    /* from struct node.  DO NOT REMOVE */
  1472. X      };
  1473. X  
  1474. ! enum cond_type {
  1475. !     COND_NOT,COND_AND,COND_OR,
  1476. !     COND_STREQ,COND_STRNEQ,COND_STRLT,COND_STRGTR,
  1477. !     COND_NT,COND_OT,COND_EF,
  1478. !     COND_EQ,COND_NE,COND_LT,COND_GT,COND_LE,COND_GE
  1479. !     };
  1480. X  
  1481. X  struct forcmd {        /* for/select */
  1482. X                              /* Cmd->args contains list of words to loop thru */
  1483. --- 307,355 ----
  1484. X      struct redir *pair;        /* used by the parser */
  1485. X     };
  1486. X  
  1487. ! #define WRITE 0
  1488. ! #define WRITENOW 1
  1489. ! #define APP 2
  1490. ! #define APPNOW 3
  1491. ! #define MERGEOUT 4
  1492. ! #define MERGEOUTNOW 5
  1493. ! #define ERRAPP 6
  1494. ! #define ERRAPPNOW 7
  1495. ! #define READ 8
  1496. ! #define HEREDOC 9
  1497. ! #define MERGE 10
  1498. ! #define CLOSE 11
  1499. ! #define INPIPE 12
  1500. ! #define OUTPIPE 13
  1501. ! #define HERESTR 14
  1502. ! #define NONE 15
  1503. ! #define HEREDOCDASH 16
  1504. X  
  1505. X  /* tree element for conditionals */
  1506. X  
  1507. X  struct cond {
  1508. X      int type;        /* can be cond_type, or a single letter (-a, -b, ...) */
  1509. X      int ifil[3];
  1510. !     vptr left,right,vfil[2];
  1511. X      int types[4],typ;    /* from struct node.  DO NOT REMOVE */
  1512. X      };
  1513. X  
  1514. ! #define COND_NOT 0
  1515. ! #define COND_AND 1
  1516. ! #define COND_OR 2
  1517. ! #define COND_STREQ 3
  1518. ! #define COND_STRNEQ 4
  1519. ! #define COND_STRLT 5
  1520. ! #define COND_STRGTR 6
  1521. ! #define COND_NT 7
  1522. ! #define COND_OT 8
  1523. ! #define COND_EF 9
  1524. ! #define COND_EQ 10
  1525. ! #define COND_NE 11
  1526. ! #define COND_LT 12
  1527. ! #define COND_GT 13
  1528. ! #define COND_LE 14
  1529. ! #define COND_GE 15
  1530. X  
  1531. X  struct forcmd {        /* for/select */
  1532. X                              /* Cmd->args contains list of words to loop thru */
  1533. ***************
  1534. *** 395,406 ****
  1535. X          } u;
  1536. X      };
  1537. X  
  1538. ! enum cmdnam_type {
  1539. !     EXCMD_PREDOT,        /* external command in path before . */
  1540. !     EXCMD_POSTDOT,        /* external command in path after . */
  1541. !     BUILTIN,
  1542. !     SHFUNC
  1543. !     };
  1544. X  
  1545. X  /* node used in parameter hash table (paramtab) */
  1546. X  
  1547. --- 414,423 ----
  1548. X          } u;
  1549. X      };
  1550. X  
  1551. ! #define EXCMD_PREDOT 0
  1552. ! #define EXCMD_POSTDOT 1
  1553. ! #define BUILTIN 2
  1554. ! #define SHFUNC 3
  1555. X  
  1556. X  /* node used in parameter hash table (paramtab) */
  1557. X  
  1558. ***************
  1559. *** 422,428 ****
  1560. X          } gets;
  1561. X      int ct;                /* output base or field width */
  1562. X      int flags;
  1563. !     void *data;            /* used by getfns */
  1564. X      char *env;            /* location in environment, if exported */
  1565. X      char *ename;        /* name of corresponding environment var */
  1566. X      };
  1567. --- 439,445 ----
  1568. X          } gets;
  1569. X      int ct;                /* output base or field width */
  1570. X      int flags;
  1571. !     vptr data;            /* used by getfns */
  1572. X      char *env;            /* location in environment, if exported */
  1573. X      char *ename;        /* name of corresponding environment var */
  1574. X      };
  1575. ***************
  1576. *** 475,480 ****
  1577. --- 492,498 ----
  1578. X      struct termio termio;
  1579. X  #else
  1580. X      struct sgttyb sgttyb;
  1581. +     int lmodes;
  1582. X      struct tchars tchars;
  1583. X      struct ltchars ltchars;
  1584. X  #endif
  1585. ***************
  1586. *** 485,490 ****
  1587. --- 503,509 ----
  1588. X      };
  1589. X  
  1590. X  EXTERN struct ttyinfo shttyinfo;
  1591. + EXTERN struct ttyinfo savedttyinfo;
  1592. X  
  1593. X  /* entry in job table */
  1594. X  
  1595. ***************
  1596. *** 559,565 ****
  1597. X  struct hashnode {
  1598. X      struct hashnode *next;
  1599. X      char *nam;
  1600. !     void *dat;
  1601. X      int canfree;        /* nam is free()able */
  1602. X      };
  1603. X  
  1604. --- 578,584 ----
  1605. X  struct hashnode {
  1606. X      struct hashnode *next;
  1607. X      char *nam;
  1608. !     vptr dat;
  1609. X      int canfree;        /* nam is free()able */
  1610. X      };
  1611. X  
  1612. ***************
  1613. *** 617,625 ****
  1614. X  #define RECEXACT 'S'
  1615. X  #define CDABLEVARS 'T'
  1616. X  #define MAILWARNING 'U'
  1617. ! #define SHUTUPKARTIK 'V'
  1618. X  #define AUTORESUME 'W'
  1619. ! #define NICEAPPENDAGES 'X'            /* historical */
  1620. X  #define MENUCOMPLETE 'Y'
  1621. X  #define USEZLE 'Z'
  1622. X  #define ALLEXPORT 'a'
  1623. --- 636,644 ----
  1624. X  #define RECEXACT 'S'
  1625. X  #define CDABLEVARS 'T'
  1626. X  #define MAILWARNING 'U'
  1627. ! #define NOPROMPTCLOBBER 'V'
  1628. X  #define AUTORESUME 'W'
  1629. ! #define LISTTYPES 'X'
  1630. X  #define MENUCOMPLETE 'Y'
  1631. X  #define USEZLE 'Z'
  1632. X  #define ALLEXPORT 'a'
  1633. ***************
  1634. *** 639,644 ****
  1635. --- 658,667 ----
  1636. X  #define CHASELINKS 'w'
  1637. X  #define XTRACE 'x'
  1638. X  #define SHWORDSPLIT 'y'
  1639. + #define MENUCOMPLETEBEEP '\2'
  1640. + #define HISTNOSTORE '\3'
  1641. + #define EXTENDEDGLOB '\5'
  1642. + #define GLOBCOMPLETE '\6'
  1643. X  
  1644. X  #ifndef GLOBALS
  1645. X  extern struct option optns[];
  1646. ***************
  1647. *** 696,701 ****
  1648. --- 719,728 ----
  1649. X      "chaselinks",'w',
  1650. X      "xtrace",'x',
  1651. X      "shwordsplit",'y',
  1652. +     "menucompletebeep",'\2',
  1653. +     "histnostore",'\3',
  1654. +     "extendedglob",'\5',
  1655. +     "globcomplete",'\6',
  1656. X      NULL,0
  1657. X  };
  1658. X  #endif
  1659. ***************
  1660. *** 744,749 ****
  1661. --- 771,780 ----
  1662. X  #define    S_ISSOCK(m)    (((m)&_IFMT) == _IFSOCK)
  1663. X  #endif
  1664. X  
  1665. + #if S_IFIFO == S_IFSOCK
  1666. + #undef S_IFIFO
  1667. + #endif
  1668. X  /* buffered shell input for non-interactive shells */
  1669. X  
  1670. X  EXTERN FILE *bshin;
  1671. ***************
  1672. *** 768,773 ****
  1673. --- 799,808 ----
  1674. X  
  1675. X  EXTERN int errflag;
  1676. X  
  1677. + /* lexical analyzer error flag */
  1678. + EXTERN int lexstop;
  1679. X  /* suppress error messages */
  1680. X  
  1681. X  EXTERN int noerrs;
  1682. ***************
  1683. *** 977,982 ****
  1684. --- 1012,1018 ----
  1685. X  EXTERN char *timefmt;
  1686. X  EXTERN char *watchfmt;
  1687. X  EXTERN char *wordchars;
  1688. + EXTERN char *fceditparam;
  1689. X  
  1690. X  EXTERN char *argzero;    /* $0 */
  1691. X  
  1692. ***************
  1693. *** 1030,1035 ****
  1694. --- 1066,1075 ----
  1695. X  
  1696. X  EXTERN int spaceflag;
  1697. X  
  1698. + /* don't do spelling correction */
  1699. + EXTERN int nocorrect;
  1700. X  /* != 0 means we have removed the current event from the history List */
  1701. X  
  1702. X  EXTERN int histremmed;
  1703. ***************
  1704. *** 1150,1162 ****
  1705. X  
  1706. X  /* interesting termcap strings */
  1707. X  
  1708. ! enum xtcaps {
  1709. !     TCCLEARSCREEN,TCLEFT,TCMULTLEFT,TCRIGHT,
  1710. !     TCMULTRIGHT,TCUP,TCMULTUP,TCDOWN,
  1711. !     TCMULTDOWN,TCDEL,TCMULTDEL,TCINS,
  1712. !     TCMULTINS,TCCLEAREOD,TCCLEAREOL,TCINSLINE,
  1713. !     TCDELLINE,TC_COUNT
  1714. !     };
  1715. X  
  1716. X  /* lengths of each string */
  1717. X  
  1718. --- 1190,1213 ----
  1719. X  
  1720. X  /* interesting termcap strings */
  1721. X  
  1722. ! #define TCCLEARSCREEN 0
  1723. ! #define TCLEFT 1
  1724. ! #define TCMULTLEFT 2
  1725. ! #define TCRIGHT 3
  1726. ! #define TCMULTRIGHT 4
  1727. ! #define TCUP 5
  1728. ! #define TCMULTUP 6
  1729. ! #define TCDOWN 7
  1730. ! #define TCMULTDOWN 8
  1731. ! #define TCDEL 9
  1732. ! #define TCMULTDEL 10
  1733. ! #define TCINS 11
  1734. ! #define TCMULTINS 12
  1735. ! #define TCCLEAREOD 13
  1736. ! #define TCCLEAREOL 14
  1737. ! #define TCINSLINE 15
  1738. ! #define TCDELLINE 16
  1739. ! #define TC_COUNT 17
  1740. X  
  1741. X  /* lengths of each string */
  1742. X  
  1743. ***************
  1744. *** 1180,1182 ****
  1745. --- 1231,1235 ----
  1746. X  #define tccan(X) (!!tclen[X])
  1747. X  
  1748. X  #include "ztype.h"
  1749. + #include "funcs.h"
  1750. SHAR_EOF
  1751. echo 'File patches is complete' &&
  1752. chmod 0644 patches ||
  1753. echo 'restore of patches failed'
  1754. Wc_c="`wc -c < 'patches'`"
  1755. test 182334 -eq "$Wc_c" ||
  1756.     echo 'patches: original size 182334, current size' "$Wc_c"
  1757. # ============= zsh2.00/README ==============
  1758. if test ! -d 'zsh2.00'; then
  1759.     echo 'x - creating directory zsh2.00'
  1760.     mkdir 'zsh2.00'
  1761. fi
  1762. echo 'x - extracting zsh2.00/README (Text)'
  1763. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/README' &&
  1764. zsh is free software.  See the file COPYING for copying permission.
  1765. X
  1766. This is zsh 2.00.02.
  1767. X
  1768. To get this shell running, cd into the src directory and type
  1769. "buildzsh".  I tested it on the following machines, where it compiled
  1770. just by running this script:
  1771. X
  1772. Sun SPARCServer 4/490 running SunOS 4.1.1
  1773. X
  1774. Past versions have been tested successfully on the following machines:
  1775. X
  1776. Sun 3/60C running SunOS 4.1.1
  1777. NeXTstation running Mach 2.0
  1778. SGI-4D/25 running IRIX 3.3.1
  1779. hp9000 running BSD 4.3
  1780. DECSystem-5000 running ULTRIX 4.0
  1781. X
  1782. If it doesn't work, either complain to me, or tweak config.h, Makefile, and
  1783. signals.h until it does.  Ignore the 5 shift/reduce conflicts reported
  1784. by yacc.
  1785. X
  1786. Tabstops are 3 spaces.  If you're going to look at my code, run it
  1787. though "expand -3" first, or set your tab stops to the same as mine.
  1788. X
  1789. If anyone has any questions, suggestions, comments, bugs, flames, or
  1790. any other mail of any kind, send it to pfalstad@phoenix.princeton.edu.
  1791. I did not supply any patches or bug fixes for version 1, because I junked
  1792. most of it as soon as I released it.  This version will be more permanent,
  1793. hopefully, so I'll be able to fix bugs quickly as soon as they're found.
  1794. X
  1795. Thanks to the following people for help, ideas, comments, patches, etc.:
  1796. X _
  1797. Goran Larsson
  1798. Paul E. Maisano
  1799. Josh Diamond
  1800. Peter Moore
  1801. XXev Gittler
  1802. Rick Ohnemus
  1803. Gary D. Kline
  1804. Byron Rakitzis
  1805. Dan Bernstein
  1806. Jonathan I. Kamens
  1807. Bruce Varney
  1808. Greg Noel
  1809. Paul Lew
  1810. Kartik Subbarao
  1811. Michael Marucheck
  1812. Steve Giovanetti
  1813. Kennedy Lemke
  1814. Emin Gun Sirer
  1815. Kazuo Itoh
  1816. X
  1817. Modification history:
  1818. X
  1819. 00-01:
  1820. X    - %M and %m now work as documented.
  1821. X    - bad things no longer happen if COLUMNS is set to 0
  1822. X    - SH_WORD_SPLIT and ${=foo} now work
  1823. X    - the default value of WORDCHARS includes more characters
  1824. X    - if the cursor is at the end of the line, vi-cmd-mode
  1825. X      moves it back one position.
  1826. X    - delete-char now acts more like x in vi.
  1827. X    - a "prompt" parameter has been added, which is equivalent to
  1828. X      PROMPT and PS1.
  1829. X    - zsh no longer expands symbolic links.  The CHASELINKS option
  1830. X      has been provided to get the old behavior.
  1831. X    - history searches ignore lines that are the same as the line
  1832. X      in the buffer.
  1833. X    - you can get a literal ! in your prompt now with \!.
  1834. X    - -z, -n, and != in [[ ... ]] expressions work.
  1835. X    - the shell no longer hangs when inputting "[[ ]\n"
  1836. X    - the "menu-complete" and "menu-expand-or-complete" bindings have
  1837. X      been added.
  1838. X    - menu-complete no longer beeps.
  1839. X    - reverse-menu-complete no longer dumps core if it gets called before
  1840. X      a normal completion.
  1841. X    - typeahead lines are no longer thrown away on machines with sgttyb.
  1842. X    - !foo no longer matches lines with 'foo' in them (not at the beginning)
  1843. X    - kill -9 % no longer kills the shell
  1844. X    - no longer sources .zshrc from shell scripts or with -c
  1845. X    - no longer needs limits.h, strtol
  1846. X    - exporting HOSTTYPE, etc. works
  1847. X    - fixed serious bugs related to . in path
  1848. X    - numbers in weird bases now work
  1849. X
  1850. 01-02:
  1851. X    - added script to convert most csh aliases to zsh aliases or functions
  1852. X    - fc -l (history) now appears in the history itself; HISTNOSTORE
  1853. X      option added to get old behavior
  1854. X    - the POSIX process group race has been fixed; so 'w | more' should
  1855. X      no longer hang
  1856. X    - FCEDIT added, to match the documentation
  1857. X    - %{...%} in the prompt added
  1858. X    - execute-named-cmd and execute-last-named-cmd bindings added
  1859. X    - sources ~/.zshenv in all shells, even if not interactive, unless
  1860. X      -f is given
  1861. X    - ^ and # are no longer `magic' by default; use EXTENDEDGLOB option
  1862. X      to use them
  1863. X    - now checks for tty sanity before each command
  1864. X    - if the right side of a variable assignment expands to more than
  1865. X      one word, array assignment is assumed; so foo=*.c now works
  1866. X    - ~foo is no longer expanded in completion
  1867. X    - select now works even if the argument list is not sorted
  1868. X    - menucompletebeep option added
  1869. X    - emacs mode is now 8-bit clean by default; use bindkey -em
  1870. X      to get your meta key back
  1871. X    - fc -R, fc -W added
  1872. X    - nocorrect added
  1873. X    - lines from history file are now split into words at spaces
  1874. X    - glob-complete, accept-and-menu-complete,
  1875. X      beginning-of-line-hist, end-of-line-hist bindings added
  1876. X    - insert-last-word bound to M-. in emacs mode by default; now moves
  1877. X      back through the history if run repeatedly
  1878. X    - J and K now bound to history search in vi mode
  1879. X    - delete-char no longer core dumps on an empty line
  1880. X    - menu-complete works better
  1881. X    - the editor checks the settings of VISUAL and EDITOR to set
  1882. X      default bindings
  1883. X    - using [[ ... ]] expressions on a symbolic link works as expected
  1884. X    - various problems with globbing were fixed
  1885. X    - xx is now the same as !! if HISTCHARS=x
  1886. X    - added config.h entry for compilers that don't know about void *
  1887. X    - lexical analysis made more efficient
  1888. X    - "if echo $? ; then : ; fi" no longer always prints 0
  1889. X    - removed all enums, '\x7f's from code
  1890. X    - in "case foo in bar) xxx ;; esac", foo and bar are no longer subject
  1891. X      to command alias expansion
  1892. X    - works on platforms where toupper('A') != 'A'
  1893. X    - \e sequence added to echo
  1894. X    - + options now work with set
  1895. X    - AUTORESUME and AUTOCD work better
  1896. X    - getopts works better (?)
  1897. X    - spell checking works better
  1898. X    - "let 2+3=" no longer crashes the shell
  1899. X    - "foo=bar; echo ${=foo}" no longer crashes the shell
  1900. X    - "zsh -c" or "zsh -o" no longer causes a core dump
  1901. X    - "unset MAIL; echo $MAIL" no longer causes a core dump
  1902. X    - "(xterm&xterm&)&" no longer causes a core dump
  1903. X    - "echo $HOM[tab]" beeps instead of deleting "$HOM"
  1904. X    - incremental history search works better
  1905. X    - the pwd of a fg'd job is now printed _before_ resuming it
  1906. X    - rv=`echo -n foo` no longer puts garbage in $rv
  1907. X    - "=1/*" now works as expected
  1908. X    - ^Z can now be bound to something
  1909. X    - the STTY parameter and the builtin builtin are now documented
  1910. X    - IFS=x; foo=`echo foo` no longer puts a newline in $foo
  1911. X    - $status added for csh compatibility
  1912. X    - arrays are automatically expanded if you say 'foo[1234]=x'
  1913. X    - shell now ignores SIGQUIT (it was commented out before :-)
  1914. X    - the times builtin works on systems where times() returns > 0
  1915. X    - no longer hangs the terminal if you ^S before flow control
  1916. X      is turned off
  1917. X    - "date ; read foo" now works in interactive shells
  1918. X    - <<-foo is now parsed as <<- foo, not << -foo
  1919. X    - fixed various errors in the documentation
  1920. X
  1921. Stuff that needs to be done
  1922. X    - port zsh to more places
  1923. X    - improve vi emulation
  1924. X
  1925. Known Bugs
  1926. X    - terminal acts weird under OpenWindows cmdtool
  1927. X    - xterm run in background inherits bad terminal modes
  1928. X    - here documents don't appear in the history, and cannot be
  1929. X      used inside eval statements
  1930. X
  1931. SHAR_EOF
  1932. chmod 0644 zsh2.00/README ||
  1933. echo 'restore of zsh2.00/README failed'
  1934. Wc_c="`wc -c < 'zsh2.00/README'`"
  1935. test 6468 -eq "$Wc_c" ||
  1936.     echo 'zsh2.00/README: original size 6468, current size' "$Wc_c"
  1937. # ============= zsh2.00/src/funcs.h ==============
  1938. if test ! -d 'zsh2.00/src'; then
  1939.     echo 'x - creating directory zsh2.00/src'
  1940.     mkdir 'zsh2.00/src'
  1941. fi
  1942. echo 'x - extracting zsh2.00/src/funcs.h (Text)'
  1943. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/src/funcs.h' &&
  1944. struct asgment;
  1945. struct utmp;
  1946. X
  1947. #include "glob.pro"
  1948. #include "hist.pro"
  1949. #include "table.pro"
  1950. #include "subst.pro"
  1951. #include "params.pro"
  1952. #include "builtin.pro"
  1953. #include "loop.pro"
  1954. #include "jobs.pro"
  1955. #include "exec.pro"
  1956. #include "init.pro"
  1957. #include "lex.pro"
  1958. #include "parse.pro"
  1959. #include "utils.pro"
  1960. #include "cond.pro"
  1961. #include "mem.pro"
  1962. #include "text.pro"
  1963. #include "watch.pro"
  1964. X
  1965. #include "zle_emacs.pro"
  1966. #include "zle_utils.pro"
  1967. #include "zle_main.pro"
  1968. #include "zle_refresh.pro"
  1969. #include "zle_tricky.pro"
  1970. #include "zle_vi.pro"
  1971. X
  1972. char *mktemp DCLPROTO((char *));
  1973. char *malloc DCLPROTO((int));
  1974. #ifndef __STDC__
  1975. char *realloc DCLPROTO((char *,int));
  1976. char *calloc DCLPROTO((int,int));
  1977. #endif /* __STDC__ */
  1978. char *ttyname DCLPROTO((int));
  1979. X
  1980. extern char PC, *BC, *UP;
  1981. extern short ospeed;
  1982. extern int tgetent DCLPROTO((char *bp, char *name));
  1983. extern int tgetnum DCLPROTO((char *id));
  1984. extern int tgetflag DCLPROTO((char *id));
  1985. extern char *tgetstr DCLPROTO((char *id, char **area));
  1986. extern char *tgoto DCLPROTO((char *cm, int destcol, int destline));
  1987. extern int tputs DCLPROTO((char *cp, int affcnt, int (*outc)()));
  1988. SHAR_EOF
  1989. chmod 0644 zsh2.00/src/funcs.h ||
  1990. echo 'restore of zsh2.00/src/funcs.h failed'
  1991. Wc_c="`wc -c < 'zsh2.00/src/funcs.h'`"
  1992. test 1108 -eq "$Wc_c" ||
  1993.     echo 'zsh2.00/src/funcs.h: original size 1108, current size' "$Wc_c"
  1994. # ============= zsh2.00/src/lex.c ==============
  1995. echo 'x - extracting zsh2.00/src/lex.c (Text)'
  1996. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.00/src/lex.c' &&
  1997. /*
  1998. X
  1999. X    lex.c - lexical analysis
  2000. X
  2001. X    This file is part of zsh, the Z shell.
  2002. X
  2003. X   zsh is free software; no one can prevent you from reading the source
  2004. X   code, or giving it to someone else.
  2005. X   This file is copyrighted under the GNU General Public License, which
  2006. X   can be found in the file called COPYING.
  2007. X
  2008. X   Copyright (C) 1990, 1991 Paul Falstad
  2009. X
  2010. X   zsh is distributed in the hope that it will be useful, but
  2011. X   WITHOUT ANY WARRANTY.  No author or distributor accepts
  2012. X   responsibility to anyone for the consequences of using it or for
  2013. X   whether it serves any particular purpose or works at all, unless he
  2014. X   says so in writing.  Refer to the GNU General Public License
  2015. X   for full details.
  2016. X
  2017. X   Everyone is granted permission to copy, modify and redistribute
  2018. X   zsh, but only under the conditions described in the GNU General Public
  2019. X   License.   A copy of this license is supposed to have been given to you
  2020. X   along with zsh so you can know your rights and responsibilities.
  2021. X   It should be in a file named COPYING.
  2022. X
  2023. X   Among other things, the copyright notice and this notice must be
  2024. X   preserved on all copies.
  2025. X
  2026. */
  2027. X
  2028. #include "zsh.h"
  2029. #include "y.tab.h"
  2030. X
  2031. /* lexical state */
  2032. X
  2033. static int ignl;
  2034. X
  2035. static int xignl,xlsep,xincmd,xincond,xinfunc,xinredir,xincase;
  2036. static int dbparens,xdbparens,xalstat;
  2037. static char *xhlastw;
  2038. X
  2039. static int xisfirstln, xisfirstch, xhistremmed, xhistdone,
  2040. X    xspaceflag, xstophist, xlithist, xalstackind,xhlinesz;
  2041. static char *xhline, *xhptr;
  2042. X
  2043. static char *tokstr;
  2044. X
  2045. /* save the lexical state */
  2046. X
  2047. /* is this a hack or what? */
  2048. X
  2049. void lexsave() /**/
  2050. {
  2051. X    xignl = ignl;
  2052. X    xlsep = lsep;
  2053. X    xincmd = incmd;
  2054. X    xincond = incond;
  2055. X    xinredir = inredir;
  2056. X    xinfunc = infunc;
  2057. X    xincase = incase;
  2058. X    xdbparens = dbparens;
  2059. X    xalstat = alstat;
  2060. X    xalstackind = alstackind;
  2061. X    xisfirstln = isfirstln;
  2062. X    xisfirstch = isfirstch;
  2063. X    xhistremmed = histremmed;
  2064. X    xhistdone = histdone;
  2065. X    xspaceflag = spaceflag;
  2066. X    xstophist = stophist;
  2067. X    xlithist = lithist;
  2068. X    xhline = hline;
  2069. X    xhptr = hptr;
  2070. X    xhlastw = hlastw;
  2071. X    xhlinesz = hlinesz;
  2072. }
  2073. X
  2074. /* restore lexical state */
  2075. X
  2076. void lexrestore() /**/
  2077. {
  2078. X    ignl = xignl;
  2079. X    lsep = xlsep;
  2080. X    incmd = xincmd;
  2081. X    incond = xincond;
  2082. X    inredir = xinredir;
  2083. X    infunc = xinfunc;
  2084. X    incase = xincase;
  2085. X    dbparens = xdbparens;
  2086. X    alstat = xalstat;
  2087. X    isfirstln = xisfirstln;
  2088. X    isfirstch = xisfirstch;
  2089. X    histremmed = xhistremmed;
  2090. X    histdone = xhistdone;
  2091. X    spaceflag = xspaceflag;
  2092. X    stophist = xstophist;
  2093. X    lithist = xlithist;
  2094. X    hline = xhline;
  2095. X    hptr = xhptr;
  2096. X    hlastw = xhlastw;
  2097. X    alstackind = xalstackind;
  2098. X    hlinesz = xhlinesz;
  2099. X    lexstop = eofseen = errflag = 0;
  2100. }
  2101. X
  2102. int yylex() /**/
  2103. {
  2104. int x;
  2105. X
  2106. X    for (;;)
  2107. X        {
  2108. X        do
  2109. X            x = gettok();
  2110. X        while (x != ENDINPUT && exalias(&x));
  2111. X        if (x == NEWLIN && ignl)
  2112. X            continue;
  2113. X        if (x == SEMI || x == NEWLIN)
  2114. X            {
  2115. X            if (lsep)
  2116. X                continue;
  2117. X            x = SEPER;
  2118. X            lsep = 1;
  2119. X            }
  2120. X        else
  2121. X            lsep = (x == AMPER);
  2122. X        break;
  2123. X        }
  2124. X    ignl = 0;
  2125. X    switch (x)
  2126. X        {
  2127. X        case OUTPAR: infunc = incmd = incase = 0; break;
  2128. X        case INPAR:case INBRACE:case DBAR:case DAMPER:case DO:
  2129. X        case THEN:case ELIF:case BAR:case BARAMP:case IF:case WHILE:
  2130. X        case ELSE:ignl = 1;infunc = 0;
  2131. X            case INOUTPAR: case SEPER:
  2132. X            case AMPER:incmd = nocorrect = 0; break;
  2133. X        case ESAC: incase = 0; break;
  2134. X        case STRING: case ENVARRAY:
  2135. X            if (!inredir && !infunc) incmd = 1; inredir = 0; break;
  2136. X        case FOR: case SELECT: incmd = 1; break;
  2137. X        case OUTANG:case OUTANGBANG:case DOUTANG:case INANG:
  2138. X        case DINANG:case TRINANG:case INANGAMP:case OUTANGAMP:case OUTANGAMPBANG:
  2139. SHAR_EOF
  2140. true || echo 'restore of zsh2.00/src/lex.c failed'
  2141. echo 'End of  part 4'
  2142. echo 'File zsh2.00/src/lex.c is continued in part 5'
  2143. echo 5 > _shar_seq_.tmp
  2144. exit 0
  2145.               Paul Falstad  pfalstad@phoenix.princeton.edu
  2146.          And on the roads, too, vicious gangs of KEEP LEFT signs!
  2147.      If Princeton knew my opinions, they'd have expelled me long ago.
  2148.  
  2149. exit 0 # Just in case...
  2150. -- 
  2151. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2152. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2153. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2154. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2155.