home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume29 / pdksh / patch03e < prev    next >
Encoding:
Text File  |  1992-04-25  |  19.9 KB  |  864 lines

  1. Newsgroups: comp.sources.misc
  2. From: sjg@zen.void.oz.au (Simon J. Gerraty)
  3. Subject:  v29i087:  pdksh - Public Domain Korn Shell, v4, Patch03e/5
  4. Message-ID: <1992Apr26.041637.22464@sparky.imd.sterling.com>
  5. X-Md4-Signature: cea4d9a6305a182e181ba89082307ef9
  6. Date: Sun, 26 Apr 1992 04:16:37 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: sjg@zen.void.oz.au (Simon J. Gerraty)
  10. Posting-number: Volume 29, Issue 87
  11. Archive-name: pdksh/patch03e
  12. Environment: UNIX
  13. Patch-To: pdksh: Volume 25, Issue 47-55
  14.  
  15. *** sh/trap.c.old    Sat Apr 25 17:44:36 1992
  16. --- sh/trap.c    Sat Apr 25 18:32:36 1992
  17. ***************
  18. *** 3,10 ****
  19.    */
  20.   
  21.   #ifndef lint
  22. ! static char *RCSid = "$Id: trap.c,v 3.2 89/03/27 15:52:06 egisin Exp $";
  23. ! static char *sccs_id = "@(#)trap.c    1.2 91/11/22 22:54:00 (sjg)";
  24.   #endif
  25.   
  26.   #include "stdh.h"
  27. --- 3,9 ----
  28.    */
  29.   
  30.   #ifndef lint
  31. ! static char *RCSid = "$Id: trap.c,v 1.2 1992/04/24 12:01:38 sjg Exp $";
  32.   #endif
  33.   
  34.   #include "stdh.h"
  35. ***************
  36. *** 28,44 ****
  37. --- 27,62 ----
  38.       {SIGEMT, "EMT", "EMT trap"},
  39.       {SIGFPE, "FPE", "Floating exception"},
  40.       {SIGKILL, "KILL", "Killed"},
  41. + #ifdef _MINIX
  42. +     {SIGUSR1, "USR1", "User defined signal 1"},
  43. +     {SIGSEGV, "SEGV", "Memory fault"},
  44. +     {SIGUSR2, "USR2", "User defined signal 2"},
  45. + #else
  46.       {SIGBUS, "BUS", "Bus error"},
  47.       {SIGSEGV, "SEGV", "Memory fault"},
  48.       {SIGSYS, "SYS", "Bad system call"},
  49. + #endif
  50.       {SIGPIPE, "PIPE", "Broken pipe"},
  51.       {SIGALRM, "ALRM", "Alarm clock"},
  52.       {SIGTERM, "TERM", "Terminated"},
  53. + #ifdef _MINIX
  54. +     {SIGSTKFLT, "STKFLT", "Stack fault"},
  55. + #endif
  56.   #ifdef _SYSV
  57.       {SIGUSR1, "USR1", "User defined signal 1"},
  58.       {SIGUSR2, "USR2", "User defined signal 2"},
  59.       {SIGCLD, "CLD", "Death of a child"},
  60.       {SIGPWR, "PWR", "Power-fail restart"},
  61. + #ifdef JOBS            /* todo: need to be more portable */
  62. +     {SIGTSTP, "TSTP", "Stop"},
  63. +     {SIGTTIN, "TTIN", "Stop (tty input)"},
  64. + #ifdef SIGPOLL
  65. +     {SIGPOLL, "POLL", "Pollable event occured"},
  66. + #endif
  67. +     {SIGSTOP, "STOP", "Stop (signal)"},
  68. +     {SIGTTOU, "TTOU", "Stop (tty output)"},
  69. +     {SIGCONT, "CONT", "Continue"},
  70. + #endif
  71.   #else
  72.   #ifdef JOBS            /* todo: need to be more portable */
  73.       {SIGURG, "URG", "Urgent condition"}, /* BSDism */
  74. ***************
  75. *** 86,92 ****
  76.       if (i == SIGINT && e.type == E_PARSE)
  77.           /* dangerous but necessary to deal with BSD silly signals */
  78.           longjmp(e.jbuf, 1);
  79. !     (void) signal(i, trapsig); /* todo: use sigact */
  80.   }
  81.   
  82.   /*
  83. --- 104,114 ----
  84.       if (i == SIGINT && e.type == E_PARSE)
  85.           /* dangerous but necessary to deal with BSD silly signals */
  86.           longjmp(e.jbuf, 1);
  87. ! #ifdef USE_SIGACT
  88. !     sigaction(i, &Sigact_trap, NULL);
  89. ! #else
  90. !     (void) signal(i, trapsig);
  91. ! #endif
  92.   }
  93.   
  94.   /*
  95. ***************
  96. *** 126,138 ****
  97.       register Trap *p;
  98.   
  99.       if ((p = sigtraps)->trap != NULL) {    /* Maybe put in exchild() */
  100. !         afree((Void *)p->trap,APERM);    /* Necessary? */
  101.           p->trap = NULL;
  102.       }
  103.       for (i = SIGNALS, p = sigtraps; --i >= 0; p++) {
  104.           p->set = 0;
  105.           if (p->ourtrap && signal(p->signal, SIG_IGN) != SIG_IGN)
  106.               (void) signal(p->signal, SIG_DFL);
  107.       }
  108.   }
  109.   
  110. --- 148,169 ----
  111.       register Trap *p;
  112.   
  113.       if ((p = sigtraps)->trap != NULL) {    /* Maybe put in exchild() */
  114. !         afree((void *)p->trap,APERM);    /* Necessary? */
  115.           p->trap = NULL;
  116.       }
  117.       for (i = SIGNALS, p = sigtraps; --i >= 0; p++) {
  118.           p->set = 0;
  119. + #ifdef USE_SIGACT
  120. +         if (p->ourtrap)
  121. +         {
  122. +           sigaction(p->signal, &Sigact_ign, &Sigact);
  123. +           if (Sigact.sa_handler != SIG_IGN)
  124. +             sigaction(p->signal, &Sigact_dfl, NULL);
  125. +         }
  126. + #else
  127.           if (p->ourtrap && signal(p->signal, SIG_IGN) != SIG_IGN)
  128.               (void) signal(p->signal, SIG_DFL);
  129. + #endif
  130.       }
  131.   }
  132.   
  133. ***************
  134. *** 139,146 ****
  135.   ignoresig(i)
  136.       int i;
  137.   {
  138. !     if (signal(i, SIG_IGN) != SIG_IGN)
  139. !         sigtraps[i].sig_dfl = 1;
  140.   }
  141.   
  142.   restoresigs()
  143. --- 170,186 ----
  144.   ignoresig(i)
  145.       int i;
  146.   {
  147. ! #ifdef USE_SIGACT
  148. !   sigaction(i, &Sigact_ign, &Sigact);
  149. !   sigemptyset(&Sigact.sa_mask);
  150. !   Sigact.sa_flags = 0;
  151. !   if (Sigact.sa_handler != SIG_IGN)
  152. !     sigtraps[i].sig_dfl = 1;
  153. ! #else
  154. !   if (signal(i, SIG_IGN) != SIG_IGN)
  155. !     sigtraps[i].sig_dfl = 1;
  156. ! #endif
  157.   }
  158.   
  159.   restoresigs()
  160. ***************
  161. *** 151,157 ****
  162. --- 191,201 ----
  163.       for (p = sigtraps, i = SIGNALS; --i >= 0; p++)
  164.           if (p->sig_dfl) {
  165.               p->sig_dfl = 0;
  166. + #ifdef USE_SIGACT
  167. +             sigaction(p->signal, &Sigact_dfl, NULL);
  168. + #else
  169.               (void) signal(p->signal, SIG_DFL);
  170. + #endif
  171.           }
  172.   }
  173.   
  174. *** sh/tree.c.old    Sat Apr 25 17:44:36 1992
  175. --- sh/tree.c    Sat Apr 25 18:37:49 1992
  176. ***************
  177. *** 3,24 ****
  178.    */
  179.   
  180.   #ifndef lint
  181. ! static char *RCSid = "$Id: tree.c,v 3.2 89/03/27 15:52:13 egisin Exp $";
  182. ! static char *sccs_id = "@(#)tree.c    1.2 91/11/22 22:54:02 (sjg)";
  183.   #endif
  184.   
  185.   #include "stdh.h"
  186.   #include <errno.h>
  187.   #include <setjmp.h>
  188. ! #include <varargs.h>            /* TODO: use stdarg */
  189.   #include "sh.h"
  190. - #include "tree.h"
  191.   
  192.   #define    FSTRING    (FILE*)NULL
  193.   
  194. ! static    int    tputc ARGS((int c, FILE *f));
  195. ! static    void    tputC ARGS((int c, FILE *f));
  196. ! static    void    tputS ARGS((char *wp, FILE *f));
  197.   
  198.   /*
  199.    * print a command tree
  200. --- 3,29 ----
  201.    */
  202.   
  203.   #ifndef lint
  204. ! static char *RCSid = "$Id: tree.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  205.   #endif
  206.   
  207.   #include "stdh.h"
  208.   #include <errno.h>
  209.   #include <setjmp.h>
  210. ! #ifdef __STDC__
  211. ! # include <stdarg.h>
  212. ! #else
  213. ! # include <varargs.h>
  214. ! #endif
  215.   #include "sh.h"
  216.   
  217.   #define    FSTRING    (FILE*)NULL
  218.   
  219. ! static int      tputc       ARGS((int c, FILE *f));
  220. ! static void     tputC       ARGS((int c, FILE *f));
  221. ! static void     tputS       ARGS((char *wp, FILE *f));
  222. ! static struct ioword **iocopy ARGS((struct ioword **iow, Area *ap));
  223. ! static void     iofree      ARGS((struct ioword **iow, Area *ap));
  224.   
  225.   /*
  226.    * print a command tree
  227. ***************
  228. *** 205,211 ****
  229.   {
  230.       if ((c&0x60) == 0) {        /* C0|C1 */
  231.           tputc((c&0x80) ? '$' : '^', f);
  232. !         tputc((c&0x7F|0x40), f);
  233.       } else if ((c&0x7F) == 0x7F) {    /* DEL */
  234.           tputc((c&0x80) ? '$' : '^', f);
  235.           tputc('?', f);
  236. --- 210,216 ----
  237.   {
  238.       if ((c&0x60) == 0) {        /* C0|C1 */
  239.           tputc((c&0x80) ? '$' : '^', f);
  240. !         tputc(((c&0x7F)|0x40), f);
  241.       } else if ((c&0x7F) == 0x7F) {    /* DEL */
  242.           tputc((c&0x80) ? '$' : '^', f);
  243.           tputc('?', f);
  244. ***************
  245. *** 261,300 ****
  246.           }
  247.   }
  248.   
  249. ! /* TODO: use varargs properly */
  250.   /* VARARGS */ int
  251. ! fptreef(f, va_alist) va_dcl
  252. !     register FILE *f;
  253.   {
  254. !     va_list va;
  255. !     char *fmt;
  256.   
  257. !     va_start(va);
  258. !     fmt = va_arg(va, char *);
  259. !     vfptreef(f, fmt, va);
  260. !     va_end(va);
  261. !     return 0;
  262.   }
  263.   
  264.   /* VARARGS */ int
  265. ! snptreef(s, n, va_alist) va_dcl
  266. !     char *s;
  267. !     int n;
  268.   {
  269. !     va_list va;
  270. !     char *fmt;
  271.   
  272. !     snpf_s = s;
  273. !     snpf_n = n;
  274. !     va_start(va);
  275. !     fmt = va_arg(va, char *);
  276. !     vfptreef(FSTRING, fmt, va);
  277. !     tputc('\0', FSTRING);
  278. !     va_end(va);
  279. !     return 0;
  280.   }
  281.   
  282.   vfptreef(f, fmt, va)
  283.       register FILE *f;
  284.       register char *fmt;
  285. --- 266,333 ----
  286.           }
  287.   }
  288.   
  289. ! /*
  290. !  * this is the _only_ way to reliably handle
  291. !  * variable args with an ANSI compiler
  292. !  */
  293. ! #ifdef __STDC__
  294.   /* VARARGS */ int
  295. ! fptreef(FILE *f, char *fmt, ...)
  296.   {
  297. ! #else
  298. ! fptreef(va_alist) 
  299. !   va_dcl
  300. ! {
  301. !   FILE *f;
  302. !   char *fmt;
  303. ! #endif
  304. !   va_list    va;
  305.   
  306. ! #ifdef __STDC__
  307. !   va_start(va, fmt);
  308. ! #else
  309. !   va_start(va);
  310. !   f = va_arg(va, FILE *);
  311. !   fmt = va_arg(va, char *);
  312. ! #endif
  313. !   
  314. !   vfptreef(f, fmt, va);
  315. !   va_end(va);
  316. !   return 0;
  317.   }
  318.   
  319.   /* VARARGS */ int
  320. ! #ifdef __STDC__
  321. ! snptreef(char *s, int n, char *fmt, ...)
  322.   {
  323. ! #else
  324. ! snptreef(va_alist)
  325. !   va_dcl
  326. ! {
  327. !   char *s;
  328. !   int n;
  329. !   char *fmt;
  330. ! #endif
  331. !   va_list va;
  332.   
  333. ! #ifdef __STDC__
  334. !   va_start(va, fmt);
  335. ! #else
  336. !   va_start(va);
  337. !   s = va_arg(va, char *);
  338. !   n = va_arg(va, int);
  339. !   fmt = va_arg(va, char *);
  340. ! #endif
  341. !   snpf_s = s;
  342. !   snpf_n = n;
  343. !   vfptreef(FSTRING, fmt, va);
  344. !   tputc('\0', FSTRING);
  345. !   va_end(va);
  346. !   return 0;
  347.   }
  348.   
  349.   vfptreef(f, fmt, va)
  350.       register FILE *f;
  351.       register char *fmt;
  352. ***************
  353. *** 493,510 ****
  354.           return;
  355.   
  356.       if (t->str != NULL)
  357. !         afree((Void*)t->str, ap);
  358.   
  359.       if (t->vars != NULL) {
  360.           for (w = t->vars; *w != NULL; w++)
  361. !             afree((Void*)*w, ap);
  362. !         afree((Void*)t->vars, ap);
  363.       }
  364.   
  365.       if (t->args != NULL) {
  366.           for (w = t->args; *w != NULL; w++)
  367. !             afree((Void*)*w, ap);
  368. !         afree((Void*)t->args, ap);
  369.       }
  370.   
  371.       if (t->ioact != NULL)
  372. --- 526,543 ----
  373.           return;
  374.   
  375.       if (t->str != NULL)
  376. !         afree((void*)t->str, ap);
  377.   
  378.       if (t->vars != NULL) {
  379.           for (w = t->vars; *w != NULL; w++)
  380. !             afree((void*)*w, ap);
  381. !         afree((void*)t->vars, ap);
  382.       }
  383.   
  384.       if (t->args != NULL) {
  385.           for (w = t->args; *w != NULL; w++)
  386. !             afree((void*)*w, ap);
  387. !         afree((void*)t->args, ap);
  388.       }
  389.   
  390.       if (t->ioact != NULL)
  391. ***************
  392. *** 513,519 ****
  393.       tfree(t->left, ap);
  394.       tfree(t->right, ap);
  395.   
  396. !     afree((Void*)t, ap);
  397.   }
  398.   
  399.   static    void
  400. --- 546,552 ----
  401.       tfree(t->left, ap);
  402.       tfree(t->right, ap);
  403.   
  404. !     afree((void*)t, ap);
  405.   }
  406.   
  407.   static    void
  408. ***************
  409. *** 526,533 ****
  410.   
  411.       for (iop = iow; (p = *iop++) != NULL; ) {
  412.           if (p->name != NULL)
  413. !             afree((Void*)p->name, ap);
  414. !         afree((Void*)p, ap);
  415.       }
  416.   }
  417.   
  418. --- 559,566 ----
  419.   
  420.       for (iop = iow; (p = *iop++) != NULL; ) {
  421.           if (p->name != NULL)
  422. !             afree((void*)p->name, ap);
  423. !         afree((void*)p, ap);
  424.       }
  425.   }
  426.   
  427. *** sh/tree.h.old    Sat Apr 25 17:41:40 1992
  428. --- sh/tree.h    Sat Apr 25 18:37:51 1992
  429. ***************
  430. *** 2,8 ****
  431.    * command trees for compile/execute
  432.    */
  433.   
  434. ! /* $Id: tree.h,v 3.3 89/03/27 15:46:57 egisin Exp $ */
  435.   
  436.   #define    NOBLOCK    ((struct op *)NULL)
  437.   #define    NOWORD    ((char *)NULL)
  438. --- 2,8 ----
  439.    * command trees for compile/execute
  440.    */
  441.   
  442. ! /* $Id: tree.h,v 1.2 1992/04/25 08:33:28 sjg Exp $ */
  443.   
  444.   #define    NOBLOCK    ((struct op *)NULL)
  445.   #define    NOWORD    ((char *)NULL)
  446. ***************
  447. *** 95,100 ****
  448. --- 95,101 ----
  449.   #define    DOPAT    BIT(3)        /* quote *?[ */
  450.   #define    DOTILDE    BIT(5)        /* expand ~ */
  451.   
  452. + #if 0
  453.   /* job.c: job control primatives */
  454.   int    execute ARGS((struct op *, int flags));    /* execute tree */
  455.   int    exchild ARGS((struct op *, int flags));    /* execute tree as child */
  456. ***************
  457. *** 104,110 ****
  458.   /* eval.c: word expansion */
  459.   char  **eval ARGS((char **wv, int flag));     /* expand words */
  460.   char   *evalstr ARGS((char *wp, int flags));    /* expand word */
  461. ! char   *substitute ARGS((Const char *s, int flags)); /* compile and expand string */
  462.   
  463.   /* tree.c: command trees */
  464.   void    ptree ARGS((struct op *t, FILE *f));    /* print tree */
  465. --- 105,111 ----
  466.   /* eval.c: word expansion */
  467.   char  **eval ARGS((char **wv, int flag));     /* expand words */
  468.   char   *evalstr ARGS((char *wp, int flags));    /* expand word */
  469. ! char   *substitute ARGS((const char *s, int flags)); /* compile and expand string */
  470.   
  471.   /* tree.c: command trees */
  472.   void    ptree ARGS((struct op *t, FILE *f));    /* print tree */
  473. ***************
  474. *** 112,115 ****
  475.   char   *wdcopy ARGS((char *wp, Area *));    /* copy word */
  476.   struct op *tcopy ARGS((struct op *t, Area *));    /* copy tree */
  477.   void    tfree ARGS((struct op *t, Area *));    /* free tree */
  478. --- 113,116 ----
  479.   char   *wdcopy ARGS((char *wp, Area *));    /* copy word */
  480.   struct op *tcopy ARGS((struct op *t, Area *));    /* copy tree */
  481.   void    tfree ARGS((struct op *t, Area *));    /* free tree */
  482. ! #endif
  483. *** sh/tty.h.old    Sat Apr 25 17:41:48 1992
  484. --- sh/tty.h    Sun Apr 19 19:21:46 1992
  485. ***************
  486. *** 21,28 ****
  487. --- 21,37 ----
  488.   #endif
  489.   #else    /* !_BSD_SYSV */
  490.   #if _BSD
  491. + #ifdef _MINIX
  492. + #include <sgtty.h>
  493. + #define TIOCSETN    TIOCSETP
  494. + #else
  495.   #include <sys/ioctl.h>
  496. + #endif
  497.   #else
  498. + #ifdef    mips
  499. + #include <termios.h>
  500. + #else
  501.   #include <termio.h>
  502. + #endif
  503.   #endif
  504.   #endif    /* _BSD_SYSV */
  505. *** sh/do_ulimit.c.old    Sat Apr 25 17:44:37 1992
  506. --- sh/do_ulimit.c    Sat Apr 25 18:35:05 1992
  507. ***************
  508. *** 13,20 ****
  509.   */
  510.   
  511.   #ifndef lint
  512. ! static char *RCSid = "$Id: ulimit.c,v 3.2 89/03/27 15:52:19 egisin Exp $";
  513. ! static char *sccs_id = "@(#)ulimit.c    1.2 91/11/22 22:54:04 (sjg)";
  514.   #endif
  515.   
  516.   #include "stdh.h"
  517. --- 13,19 ----
  518.   */
  519.   
  520.   #ifndef lint
  521. ! static char *RCSid = "$Id: do_ulimit.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  522.   #endif
  523.   
  524.   #include "stdh.h"
  525. *** sh/var.c.old    Sat Apr 25 17:44:38 1992
  526. --- sh/var.c    Sat Apr 25 18:37:59 1992
  527. ***************
  528. *** 1,6 ****
  529.   #ifndef lint
  530. ! static char *RCSid = "$Id: var.c,v 3.2 89/03/27 15:52:21 egisin Exp $";
  531. ! static char *sccs_id = "@(#)var.c    1.4 91/11/22 22:53:13 (sjg)";
  532.   #endif
  533.   
  534.   #include "stdh.h"
  535. --- 1,5 ----
  536.   #ifndef lint
  537. ! static char *RCSid = "$Id: var.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  538.   #endif
  539.   
  540.   #include "stdh.h"
  541. ***************
  542. *** 8,14 ****
  543.   #include <setjmp.h>
  544.   #include <time.h>
  545.   #include "sh.h"
  546. - #include "table.h"
  547.   #include "expand.h"
  548.   
  549.   /*
  550. --- 7,12 ----
  551. ***************
  552. *** 22,30 ****
  553.    */
  554.   char    null []    = "";
  555.   static    struct tbl vtemp;
  556. ! static    void getspec(), setspec();
  557. ! static    void export ARGS((struct tbl *, char *val));
  558. ! static    int special ARGS ((char *name));
  559.   
  560.   /*
  561.    * create a new block for function calls and simple commands
  562. --- 20,29 ----
  563.    */
  564.   char    null []    = "";
  565.   static    struct tbl vtemp;
  566. ! static void     export      ARGS((struct tbl *vp, char *val));
  567. ! static int      special     ARGS((char *name));
  568. ! static void     getspec     ARGS((struct tbl *vp));
  569. ! static void     setspec     ARGS((struct tbl *vp));
  570.   
  571.   /*
  572.    * create a new block for function calls and simple commands
  573. ***************
  574. *** 219,225 ****
  575.   {
  576.       if (!(vq->flag&INTEGER)) { /* string dest */
  577.           if ((vq->flag&ALLOC))
  578. !             afree((Void*)vq->val.s, lastarea);
  579.           vq->flag &= ~ (ISSET|ALLOC);
  580.           vq->type = 0;
  581.           if ((vq->flag&EXPORT))
  582. --- 218,224 ----
  583.   {
  584.       if (!(vq->flag&INTEGER)) { /* string dest */
  585.           if ((vq->flag&ALLOC))
  586. !             afree((void*)vq->val.s, lastarea);
  587.           vq->flag &= ~ (ISSET|ALLOC);
  588.           vq->type = 0;
  589.           if ((vq->flag&EXPORT))
  590. ***************
  591. *** 348,354 ****
  592.       for (cp = val; (*xp++ = *cp++) != '\0'; )
  593.           ;
  594.       if (op != NULL)
  595. !         afree((Void*)op, lastarea);
  596.   }
  597.   
  598.   /*
  599. --- 347,353 ----
  600.       for (cp = val; (*xp++ = *cp++) != '\0'; )
  601.           ;
  602.       if (op != NULL)
  603. !         afree((void*)op, lastarea);
  604.   }
  605.   
  606.   /*
  607. ***************
  608. *** 385,391 ****
  609.           *val++ = '=';
  610.   
  611.       if (!(vp->flag&ISSET))
  612. !         vp->flag = vp->flag & ~clr | set;
  613.       else
  614.           if (!(vp->flag&INTEGER) && (set&INTEGER)) {
  615.           /* string to integer */
  616. --- 384,390 ----
  617.           *val++ = '=';
  618.   
  619.       if (!(vp->flag&ISSET))
  620. !         vp->flag = (vp->flag & ~clr) | set;
  621.       else
  622.           if (!(vp->flag&INTEGER) && (set&INTEGER)) {
  623.           /* string to integer */
  624. ***************
  625. *** 393,399 ****
  626.           vtemp.type = 0;
  627.           vtemp.val.s = vp->val.s + vp->type;
  628.           if ((vp->flag&ALLOC))
  629. !             afree((Void*)vp->val.s, lastarea); /* dangerous, used later */
  630.           vp->flag &= ~ ALLOC;
  631.           vp->flag |= INTEGER;
  632.           vp->type = 0;
  633. --- 392,398 ----
  634.           vtemp.type = 0;
  635.           vtemp.val.s = vp->val.s + vp->type;
  636.           if ((vp->flag&ALLOC))
  637. !             afree((void*)vp->val.s, lastarea); /* dangerous, used later */
  638.           vp->flag &= ~ ALLOC;
  639.           vp->flag |= INTEGER;
  640.           vp->type = 0;
  641. ***************
  642. *** 409,415 ****
  643.           setstr(vp, vtemp.val.s);
  644.           }
  645.   
  646. !     vp->flag = vp->flag & ~clr | set;
  647.   
  648.       if (val != NULL) {
  649.           if ((vp->flag&RDONLY))
  650. --- 408,414 ----
  651.           setstr(vp, vtemp.val.s);
  652.           }
  653.   
  654. !     vp->flag = (vp->flag & ~clr) | set;
  655.   
  656.       if (val != NULL) {
  657.           if ((vp->flag&RDONLY))
  658. ***************
  659. *** 432,438 ****
  660.       register struct tbl *vp;
  661.   {
  662.       if ((vp->flag&ALLOC))
  663. !         afree((Void*)vp->val.s, lastarea);
  664.       vp->flag &= SPECIAL;    /* Should ``unspecial'' some vars */
  665.   }
  666.   
  667. --- 431,437 ----
  668.       register struct tbl *vp;
  669.   {
  670.       if ((vp->flag&ALLOC))
  671. !         afree((void*)vp->val.s, lastarea);
  672.       vp->flag &= SPECIAL;    /* Should ``unspecial'' some vars */
  673.   }
  674.   
  675. *** sh/version.c.old    Sat Apr 25 17:44:38 1992
  676. --- sh/version.c    Sat Apr 25 18:38:04 1992
  677. ***************
  678. *** 3,21 ****
  679.    */
  680.   
  681.   #ifndef lint
  682. ! static char *RCSid = "$Id: version.c,v 3.3 89/03/27 15:52:29 egisin Exp $";
  683. ! static char *sccs_id = "@(#)version.c    4.2 91/11/22 22:53:29 (sjg)";
  684.   #endif
  685.   
  686.   #include "stdh.h"
  687.   #include <setjmp.h>
  688.   #include "sh.h"
  689.   
  690.   char ksh_version [] =
  691. !     "KSH_VERSION=@(#)PD KSH v4.2 91/11/22 22:53:29";
  692.   
  693.   /***
  694. ! $Log:    version.c,v $
  695.   Version  4.0  91/11/09  sjg
  696.   distribution
  697.   Revision 3.3  89/03/27  15:52:29  egisin
  698. --- 3,27 ----
  699.    */
  700.   
  701.   #ifndef lint
  702. ! static char *RCSid = "$Id: version.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  703.   #endif
  704.   
  705.   #include "stdh.h"
  706.   #include <setjmp.h>
  707.   #include "sh.h"
  708. + #include "patchlevel.h"
  709.   
  710.   char ksh_version [] =
  711. !     "KSH_VERSION=@(#)PD KSH v4.3 92/04/25";
  712.   
  713.   /***
  714. ! $Log: version.c,v $
  715. !  * Revision 1.2  1992/04/25  08:33:28  sjg
  716. !  * Added RCS key.
  717. !  *
  718. !  * Revision 1.1  1992/04/18  05:51:48  sjg
  719. !  * Initial revision
  720. !  *
  721.   Version  4.0  91/11/09  sjg
  722.   distribution
  723.   Revision 3.3  89/03/27  15:52:29  egisin
  724. *** sh/vi.c.old    Sat Apr 25 17:44:39 1992
  725. --- sh/vi.c    Sat Apr 25 18:38:09 1992
  726. ***************
  727. *** 9,16 ****
  728.   #ifdef VI
  729.   
  730.   #ifndef lint
  731. ! static char *RCSid = "$Id: vi.c,v 3.1 89/01/28 15:29:20 egisin Exp $";
  732. ! static char *sccs_id = "@(#)vi.c    1.4 91/11/22 22:53:02 (sjg)";
  733.   #endif
  734.   
  735.   #include "stdh.h"
  736. --- 9,15 ----
  737.   #ifdef VI
  738.   
  739.   #ifndef lint
  740. ! static char *RCSid = "$Id: vi.c,v 1.2 1992/04/25 08:33:28 sjg Exp $";
  741.   #endif
  742.   
  743.   #include "stdh.h"
  744. ***************
  745. *** 21,29 ****
  746.   #include <errno.h>
  747.   #include <setjmp.h>
  748.   #include "sh.h"
  749. - #include "lex.h"
  750. - #include "tree.h"        /* DOTILDE */
  751. - #include "table.h"
  752.   #include "expand.h"
  753.   #include "edit.h"
  754.   
  755. --- 20,25 ----
  756. ***************
  757. *** 32,65 ****
  758.   #define    bcopy(src, dst, len)    memmove(dst, src, len)
  759.   extern    int    histN();
  760.   
  761. ! static int    nextstate();
  762. ! static int    vi_insert();
  763. ! static int    vi_cmd();
  764. ! static int    domove();
  765. ! static int    redo_insert();
  766. ! static        yank_range();
  767. ! static int    bracktype();
  768. ! static        edit_prompt();
  769. ! static        edit_reset();
  770. ! static int    putbuf();
  771. ! static        stripblanks();
  772. ! static        del_range();
  773. ! static int    findch();
  774. ! static int    forwword();
  775. ! static int    backword();
  776. ! static int    endword();
  777. ! static int    Forwword();
  778. ! static int    Backword();
  779. ! static int    Endword();
  780. ! static int    grabhist();
  781. ! static int    grabsearch();
  782. ! static        redraw_line();
  783. ! static        refresh();
  784. ! static int    outofwin();
  785. ! static        rewindow();
  786. ! static int    newcol();
  787. ! static        display();
  788. ! static        ed_mov_opt();
  789.   
  790.   #define C_    0x1
  791.   #define M_    0x2
  792. --- 28,60 ----
  793.   #define    bcopy(src, dst, len)    memmove(dst, src, len)
  794.   extern    int    histN();
  795.   
  796. ! static int      nextstate   ARGS((int ch));
  797. ! static int      vi_insert   ARGS((int ch));
  798. ! static int      vi_cmd      ARGS((int argcnt, char *cmd));
  799. ! static int      domove      ARGS((int argcnt, char *cmd, int sub));
  800. ! static int      redo_insert ARGS((int count));
  801. ! static          yank_range  ARGS((int a, int b));
  802. ! static int      bracktype   ARGS((int ch));
  803. ! static          edit_reset  ARGS((char *buf, int len));
  804. ! static int      putbuf      ARGS((char *buf, int len, int repl));
  805. ! static          stripblanks ARGS((void));
  806. ! static          del_range   ARGS((int a, int b));
  807. ! static int      findch      ARGS((int ch, int cnt, int forw, int incl));
  808. ! static int      forwword    ARGS((int argcnt));
  809. ! static int      backword    ARGS((int argcnt));
  810. ! static int      endword     ARGS((int argcnt));
  811. ! static int      Forwword    ARGS((int argcnt));
  812. ! static int      Backword    ARGS((int argcnt));
  813. ! static int      Endword     ARGS((int argcnt));
  814. ! static int      grabhist    ARGS((int save, int n));
  815. ! static int      grabsearch  ARGS((int save, int start, int fwd, char *pat));
  816. ! static          redraw_line ARGS((void));
  817. ! static          refresh     ARGS((int leftside));
  818. ! static int      outofwin    ARGS((void));
  819. ! static          rewindow    ARGS((void));
  820. ! static int      newcol      ARGS((int ch, int col));
  821. ! static          display     ARGS((char *wb1, char *wb2, int leftside));
  822. ! static          ed_mov_opt  ARGS((int col, char *wb));
  823.   
  824.   #define C_    0x1
  825.   #define M_    0x2
  826. ***************
  827. *** 196,202 ****
  828.       static char    locpat[SRCHLEN];
  829.       static int    cmdlen;
  830.       static int    argc1, argc2;
  831. -     int        i;
  832.   
  833.       if (state != VSEARCH && (ch == '\r' || ch == '\n')) {
  834.           x_putc('\r');
  835. --- 191,196 ----
  836. ***************
  837. *** 539,545 ****
  838.   {
  839.       int        ncursor;
  840.       int        cur, c1, c2, c3 = 0;
  841. -     char        pos[10];
  842.       struct edstate    *t;
  843.   
  844.   
  845. --- 533,538 ----
  846. ***************
  847. *** 1388,1394 ****
  848.       int    n;
  849.   {
  850.       char    *hptr;
  851. -     char    pos[10];
  852.   
  853.       if (n < 0 || n > hlast)
  854.           return -1;
  855. --- 1381,1386 ----
  856.  
  857. exit 0 # Just in case...
  858.