home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume25 / perl / patch13 < prev    next >
Encoding:
Text File  |  1991-11-13  |  48.1 KB  |  2,015 lines

  1. Newsgroups: comp.sources.misc
  2. From: lwall@netlabs.com (Larry Wall)
  3. Subject:  v25i062:  perl - The perl programming language, Patch13
  4. Message-ID: <1991Nov13.214304.3635@sparky.imd.sterling.com>
  5. X-Md4-Signature: 17152091640fcdfbbad255056f547d34
  6. Date: Wed, 13 Nov 1991 21:43:04 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: lwall@netlabs.com (Larry Wall)
  10. Posting-number: Volume 25, Issue 62
  11. Archive-name: perl/patch13
  12. Environment: UNIX, MS-DOS, OS2
  13. Patch-To: perl: Volume 18, Issue 19-54
  14.  
  15. System: perl version 4.0
  16. Patch #: 13
  17. Priority: MED-HIGH
  18. Subject: patch #11, continued
  19.  
  20. Description:
  21.     See patch #11.
  22.  
  23. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your perl source
  24.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  25.     If you don't have the patch program, apply the following by hand,
  26.     or get patch (version 2.0, latest patchlevel).
  27.  
  28.     After patching:
  29.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #18 FIRST ***
  30.  
  31.     If patch indicates that patchlevel is the wrong version, you may need
  32.     to apply one or more previous patches, or the patch may already
  33.     have been applied.  See the patchlevel.h file to find out what has or
  34.     has not been applied.  In any event, don't continue with the patch.
  35.  
  36.     If you are missing previous patches they can be obtained from me:
  37.  
  38.     Larry Wall
  39.     lwall@netlabs.com
  40.  
  41.     If you send a mail message of the following form it will greatly speed
  42.     processing:
  43.  
  44.     Subject: Command
  45.     @SH mailpatch PATH perl 4.0 LIST
  46.            ^ note the c
  47.  
  48.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  49.     or in bang notation from some well-known host, and LIST is the number
  50.     of one or more patches you need, separated by spaces, commas, and/or
  51.     hyphens.  Saying 35- says everything from 35 to the end.
  52.  
  53.  
  54. Index: patchlevel.h
  55. Prereq: 12
  56. 1c1
  57. < #define PATCHLEVEL 12
  58. ---
  59. > #define PATCHLEVEL 13
  60.  
  61. Index: config_h.SH
  62. *** config_h.SH.old    Tue Nov  5 19:25:44 1991
  63. --- config_h.SH    Tue Nov  5 19:25:45 1991
  64. ***************
  65. *** 24,29 ****
  66. --- 24,30 ----
  67.    * that running config.h.SH again will wipe out any changes you've made.
  68.    * For a more permanent change edit config.sh and rerun config.h.SH.
  69.    */
  70. +  /*SUPPRESS 460*/
  71.   
  72.   
  73.   /* EUNICE
  74. ***************
  75. *** 55,61 ****
  76.   
  77.   /* BYTEORDER
  78.    *    This symbol contains an encoding of the order of bytes in a long.
  79. !  *    Usual values (in octal) are 01234, 04321, 02143, 03412...
  80.    */
  81.   #define BYTEORDER 0x$byteorder        /**/
  82.   
  83. --- 56,62 ----
  84.   
  85.   /* BYTEORDER
  86.    *    This symbol contains an encoding of the order of bytes in a long.
  87. !  *    Usual values (in hex) are 0x1234, 0x4321, 0x2143, 0x3412...
  88.    */
  89.   #define BYTEORDER 0x$byteorder        /**/
  90.   
  91. ***************
  92. *** 752,760 ****
  93. --- 753,766 ----
  94.   #$i_my_dir    I_MY_DIR    /**/
  95.   #$d_dirnamlen    DIRNAMLEN    /**/
  96.   
  97. + /* MYMALLOC
  98. +  *    This symbol, if defined, indicates that we're using our own malloc.
  99. +  */
  100.   /* MALLOCPTRTYPE
  101.    *    This symbol defines the kind of ptr returned by malloc and realloc.
  102.    */
  103. + #$d_mymalloc MYMALLOC            /**/
  104.   #define MALLOCPTRTYPE $mallocptrtype         /**/
  105.   
  106.   
  107.  
  108. Index: cons.c
  109. *** cons.c.old    Tue Nov  5 19:25:47 1991
  110. --- cons.c    Tue Nov  5 19:25:48 1991
  111. ***************
  112. *** 1,4 ****
  113. ! /* $RCSfile: cons.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:31:15 $
  114.    *
  115.    *    Copyright (c) 1991, Larry Wall
  116.    *
  117. --- 1,4 ----
  118. ! /* $RCSfile: cons.c,v $$Revision: 4.0.1.2 $$Date: 91/11/05 16:15:13 $
  119.    *
  120.    *    Copyright (c) 1991, Larry Wall
  121.    *
  122. ***************
  123. *** 6,11 ****
  124. --- 6,15 ----
  125.    *    License or the Artistic License, as specified in the README file.
  126.    *
  127.    * $Log:    cons.c,v $
  128. +  * Revision 4.0.1.2  91/11/05  16:15:13  lwall
  129. +  * patch11: debugger got confused over nested subroutine definitions
  130. +  * patch11: prepared for ctype implementations that don't define isascii()
  131. +  * 
  132.    * Revision 4.0.1.1  91/06/07  10:31:15  lwall
  133.    * patch4: new copyright notice
  134.    * patch4: added global modifier for pattern matches
  135. ***************
  136. *** 74,81 ****
  137.       STR *str;
  138.       STR *tmpstr = str_mortal(&str_undef);
  139.   
  140. !     sprintf(buf,"%s:%ld",stab_val(curcmd->c_filestab)->str_ptr,
  141. !       (long)subline);
  142.       str = str_make(buf,0);
  143.       str_cat(str,"-");
  144.       sprintf(buf,"%ld",(long)curcmd->c_line);
  145. --- 78,84 ----
  146.       STR *str;
  147.       STR *tmpstr = str_mortal(&str_undef);
  148.   
  149. !     sprintf(buf,"%s:%ld",stab_val(curcmd->c_filestab)->str_ptr, subline);
  150.       str = str_make(buf,0);
  151.       str_cat(str,"-");
  152.       sprintf(buf,"%ld",(long)curcmd->c_line);
  153. ***************
  154. *** 83,91 ****
  155.       name = str_get(subname);
  156.       stab_fullname(tmpstr,stab);
  157.       hstore(stab_xhash(DBsub), tmpstr->str_ptr, tmpstr->str_cur, str, 0);
  158. -     str_set(subname,"main");
  159.       }
  160. -     subline = 0;
  161.       return sub;
  162.   }
  163.   
  164. --- 86,92 ----
  165. ***************
  166. *** 732,737 ****
  167. --- 733,739 ----
  168.            arg->arg_type == O_SLT || arg->arg_type == O_SGT) {
  169.       if (arg[1].arg_type == A_STAB || arg[1].arg_type == A_LVAL) {
  170.           if (arg[2].arg_type == A_SINGLE) {
  171. +         /*SUPPRESS 594*/
  172.           char *junk = str_get(arg[2].arg_ptr.arg_str);
  173.   
  174.           cmd->c_stab  = arg[1].arg_ptr.arg_stab;
  175. ***************
  176. *** 908,914 ****
  177.   
  178.       if (bufptr > oldoldbufptr && bufptr - oldoldbufptr < 200 &&
  179.         oldoldbufptr != oldbufptr && oldbufptr != bufptr) {
  180. !     while (isspace(*oldoldbufptr))
  181.           oldoldbufptr++;
  182.       strncpy(tmp2buf, oldoldbufptr, bufptr - oldoldbufptr);
  183.       tmp2buf[bufptr - oldoldbufptr] = '\0';
  184. --- 910,916 ----
  185.   
  186.       if (bufptr > oldoldbufptr && bufptr - oldoldbufptr < 200 &&
  187.         oldoldbufptr != oldbufptr && oldbufptr != bufptr) {
  188. !     while (isSPACE(*oldoldbufptr))
  189.           oldoldbufptr++;
  190.       strncpy(tmp2buf, oldoldbufptr, bufptr - oldoldbufptr);
  191.       tmp2buf[bufptr - oldoldbufptr] = '\0';
  192. ***************
  193. *** 916,922 ****
  194.       }
  195.       else if (bufptr > oldbufptr && bufptr - oldbufptr < 200 &&
  196.         oldbufptr != bufptr) {
  197. !     while (isspace(*oldbufptr))
  198.           oldbufptr++;
  199.       strncpy(tmp2buf, oldbufptr, bufptr - oldbufptr);
  200.       tmp2buf[bufptr - oldbufptr] = '\0';
  201. --- 918,924 ----
  202.       }
  203.       else if (bufptr > oldbufptr && bufptr - oldbufptr < 200 &&
  204.         oldbufptr != bufptr) {
  205. !     while (isSPACE(*oldbufptr))
  206.           oldbufptr++;
  207.       strncpy(tmp2buf, oldbufptr, bufptr - oldbufptr);
  208.       tmp2buf[bufptr - oldbufptr] = '\0';
  209. ***************
  210. *** 1083,1088 ****
  211. --- 1085,1091 ----
  212.           break;
  213.           tail = tail->c_next;
  214.       }
  215. +     /*SUPPRESS 530*/
  216.       for ( ; tail->c_next; tail = tail->c_next) ;
  217.       }
  218.   
  219. ***************
  220. *** 1118,1124 ****
  221.       cmd->c_flags &= ~CF_OPTIMIZE;    /* clear optimization type */
  222.       cmd->c_flags |= CFT_ARRAY;        /* and set it to do the iteration */
  223.       cmd->c_stab = eachstab;
  224. !     cmd->c_short = str_new(0);        /* just to save a field in struct cmd */
  225.       cmd->c_short->str_u.str_useful = -1;
  226.   
  227.       return cmd;
  228. --- 1121,1127 ----
  229.       cmd->c_flags &= ~CF_OPTIMIZE;    /* clear optimization type */
  230.       cmd->c_flags |= CFT_ARRAY;        /* and set it to do the iteration */
  231.       cmd->c_stab = eachstab;
  232. !     cmd->c_short = Str_new(23,0);    /* just to save a field in struct cmd */
  233.       cmd->c_short->str_u.str_useful = -1;
  234.   
  235.       return cmd;
  236. ***************
  237. *** 1268,1273 ****
  238. --- 1271,1277 ----
  239.           for (sp = stash->tbl_spatroot;
  240.             sp && sp->spat_next != spat;
  241.             sp = sp->spat_next)
  242. +         /*SUPPRESS 530*/
  243.           ;
  244.           if (sp)
  245.           sp->spat_next = spat->spat_next;
  246.  
  247. Index: consarg.c
  248. *** consarg.c.old    Tue Nov  5 19:25:51 1991
  249. --- consarg.c    Tue Nov  5 19:25:52 1991
  250. ***************
  251. *** 1,4 ****
  252. ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:33:12 $
  253.    *
  254.    *    Copyright (c) 1991, Larry Wall
  255.    *
  256. --- 1,4 ----
  257. ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 16:21:16 $
  258.    *
  259.    *    Copyright (c) 1991, Larry Wall
  260.    *
  261. ***************
  262. *** 6,11 ****
  263. --- 6,18 ----
  264.    *    License or the Artistic License, as specified in the README file.
  265.    *
  266.    * $Log:    consarg.c,v $
  267. +  * Revision 4.0.1.3  91/11/05  16:21:16  lwall
  268. +  * patch11: random cleanup
  269. +  * patch11: added eval {}
  270. +  * patch11: added sort {} LIST
  271. +  * patch11: "foo" x -1 dumped core
  272. +  * patch11: substr() and vec() weren't allowed in an lvalue list
  273. +  * 
  274.    * Revision 4.0.1.2  91/06/07  10:33:12  lwall
  275.    * patch4: new copyright notice
  276.    * patch4: length($`), length($&), length($') now optimized to avoid string copy
  277. ***************
  278. *** 54,61 ****
  279.           arg[3].arg_ptr.arg_arg = limarg;
  280.       }
  281.       }
  282. !     else
  283.       arg[3].arg_type = A_NULL;
  284.       arg->arg_type = O_SPLIT;
  285.       spat = arg[2].arg_ptr.arg_spat;
  286.       spat->spat_repl = stab2arg(A_STAB,aadd(stab));
  287. --- 61,71 ----
  288.           arg[3].arg_ptr.arg_arg = limarg;
  289.       }
  290.       }
  291. !     else {
  292. !     arg[3].arg_flags = 0;
  293.       arg[3].arg_type = A_NULL;
  294. +     arg[3].arg_ptr.arg_arg = Nullarg;
  295. +     }
  296.       arg->arg_type = O_SPLIT;
  297.       spat = arg[2].arg_ptr.arg_spat;
  298.       spat->spat_repl = stab2arg(A_STAB,aadd(stab));
  299. ***************
  300. *** 154,159 ****
  301. --- 164,170 ----
  302.   
  303.       arg = op_new(newlen);
  304.       arg->arg_type = type;
  305. +     /*SUPPRESS 560*/
  306.       if (chld = arg1) {
  307.       if (chld->arg_type == O_ITEM &&
  308.           (hoistable[ i = (chld[1].arg_type&A_MASK)] || i == A_LVAL ||
  309. ***************
  310. *** 173,178 ****
  311. --- 184,190 ----
  312.           arg[1].arg_ptr.arg_arg = chld;
  313.       }
  314.       }
  315. +     /*SUPPRESS 560*/
  316.       if (chld = arg2) {
  317.       if (chld->arg_type == O_ITEM && 
  318.           (hoistable[chld[1].arg_type&A_MASK] || 
  319. ***************
  320. *** 193,198 ****
  321. --- 205,211 ----
  322.           arg[2].arg_ptr.arg_arg = chld;
  323.       }
  324.       }
  325. +     /*SUPPRESS 560*/
  326.       if (chld = arg3) {
  327.       if (chld->arg_type == O_ITEM && hoistable[chld[1].arg_type&A_MASK]) {
  328.           arg[3].arg_type = chld[1].arg_type;
  329. ***************
  330. *** 300,305 ****
  331. --- 313,331 ----
  332.       switch (arg->arg_type) {
  333.       default:
  334.       return arg;
  335. +     case O_SORT:
  336. +     if (arg[1].arg_type == A_CMD)
  337. +         arg[1].arg_type |= A_DONT;
  338. +     return arg;
  339. +     case O_EVAL:
  340. +     if (arg[1].arg_type == A_CMD) {
  341. +         arg->arg_type = O_TRY;
  342. +         arg[1].arg_type |= A_DONT;
  343. +         return arg;
  344. +     }
  345. +     CHECK1;
  346. +     arg->arg_type = O_EVALONCE;
  347. +     return arg;
  348.       case O_AELEM:
  349.       CHECK2;
  350.       i = (int)str_gnum(s2);
  351. ***************
  352. *** 322,331 ****
  353.       i = (int)str_gnum(s2);
  354.       tmps = str_get(s1);
  355.       str_nset(str,"",0);
  356. !     STR_GROW(str, i * s1->str_cur + 1);
  357. !     repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
  358. !     str->str_cur = i * s1->str_cur;
  359. !     str->str_ptr[str->str_cur] = '\0';
  360.       break;
  361.       case O_MULTIPLY:
  362.       CHECK12;
  363. --- 348,359 ----
  364.       i = (int)str_gnum(s2);
  365.       tmps = str_get(s1);
  366.       str_nset(str,"",0);
  367. !     if (i > 0) {
  368. !         STR_GROW(str, i * s1->str_cur + 1);
  369. !         repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
  370. !         str->str_cur = i * s1->str_cur;
  371. !         str->str_ptr[str->str_cur] = '\0';
  372. !     }
  373.       break;
  374.       case O_MULTIPLY:
  375.       CHECK12;
  376. ***************
  377. *** 338,344 ****
  378.       if (value == 0.0)
  379.           yyerror("Illegal division by constant zero");
  380.       else
  381. ! #ifdef cray
  382.       /* insure that 20./5. == 4. */
  383.       {
  384.           double x;
  385. --- 366,372 ----
  386.       if (value == 0.0)
  387.           yyerror("Illegal division by constant zero");
  388.       else
  389. ! #ifdef SLOPPYDIVIDE
  390.       /* insure that 20./5. == 4. */
  391.       {
  392.           double x;
  393. ***************
  394. *** 497,503 ****
  395. --- 525,535 ----
  396.       break;
  397.       case O_NOT:
  398.       CHECK1;
  399. + #ifdef NOTNOT
  400. +     { char xxx = str_true(s1); str_numset(str,(double)!xxx); }
  401. + #else
  402.       str_numset(str,(double)(!str_true(s1)));
  403. + #endif
  404.       break;
  405.       case O_COMPLEMENT:
  406.       CHECK1;
  407. ***************
  408. *** 704,709 ****
  409. --- 736,747 ----
  410.               case O_HSLICE: case O_LHSLICE:
  411.               arg1[i].arg_ptr.arg_arg->arg_type = O_LHSLICE;
  412.               break;
  413. +             case O_SUBSTR: case O_VEC:
  414. +             (void)l(arg1[i].arg_ptr.arg_arg);
  415. +             Renewc(arg1[i].arg_ptr.arg_arg->arg_ptr.arg_str, 1,
  416. +               struct lstring, STR);
  417. +                 /* grow string struct to hold an lstring struct */
  418. +             break;
  419.               default:
  420.               goto ill_item;
  421.               }
  422. ***************
  423. *** 802,811 ****
  424.           Renewc(arg1->arg_ptr.arg_str, 1, struct lstring, STR);
  425.               /* grow string struct to hold an lstring struct */
  426.       }
  427. !     else if (arg1->arg_type == O_ASSIGN) {
  428. ! /*        if (arg->arg_type == O_CHOP)
  429. !         arg[1].arg_flags &= ~AF_ARYOK;    /* grandfather chop idiom */
  430. !     }
  431.       else {
  432.           (void)sprintf(tokenbuf,
  433.             "Illegal expression (%s) as lvalue",opname[arg1->arg_type]);
  434. --- 840,848 ----
  435.           Renewc(arg1->arg_ptr.arg_str, 1, struct lstring, STR);
  436.               /* grow string struct to hold an lstring struct */
  437.       }
  438. !     else if (arg1->arg_type == O_ASSIGN)
  439. !         /*SUPPRESS 530*/
  440. !         ;
  441.       else {
  442.           (void)sprintf(tokenbuf,
  443.             "Illegal expression (%s) as lvalue",opname[arg1->arg_type]);
  444. ***************
  445. *** 980,986 ****
  446.   listish(arg)
  447.   ARG *arg;
  448.   {
  449. !     if (arg->arg_flags & AF_LISTISH)
  450.       arg = make_op(O_LIST,1,arg,Nullarg,Nullarg);
  451.       return arg;
  452.   }
  453. --- 1017,1023 ----
  454.   listish(arg)
  455.   ARG *arg;
  456.   {
  457. !     if (arg && arg->arg_flags & AF_LISTISH)
  458.       arg = make_op(O_LIST,1,arg,Nullarg,Nullarg);
  459.       return arg;
  460.   }
  461.  
  462. Index: usub/curses.mus
  463. Prereq: 4.0
  464. *** usub/curses.mus.old    Tue Nov  5 19:28:20 1991
  465. --- usub/curses.mus    Tue Nov  5 19:28:20 1991
  466. ***************
  467. *** 1,6 ****
  468. ! /* $Header: curses.mus,v 4.0 91/03/20 01:56:13 lwall Locked $
  469.    *
  470.    * $Log:    curses.mus,v $
  471.    * Revision 4.0  91/03/20  01:56:13  lwall
  472.    * 4.0 baseline.
  473.    * 
  474. --- 1,9 ----
  475. ! /* $RCSfile: curses.mus,v $$Revision: 4.0.1.1 $$Date: 91/11/05 19:06:19 $
  476.    *
  477.    * $Log:    curses.mus,v $
  478. +  * Revision 4.0.1.1  91/11/05  19:06:19  lwall
  479. +  * patch11: usub/curses.mus now supports SysV curses
  480. +  * 
  481.    * Revision 4.0  91/03/20  01:56:13  lwall
  482.    * 4.0 baseline.
  483.    * 
  484. ***************
  485. *** 11,32 ****
  486.   
  487.   #include "EXTERN.h"
  488.   #include "perl.h"
  489. - extern int wantarray;
  490.   
  491.   char *savestr();
  492.   
  493.   #include <curses.h>
  494.   
  495.   static enum uservars {
  496.       UV_curscr,
  497.       UV_stdscr,
  498. -     UV_Def_term,
  499. -     UV_My_term,
  500.       UV_ttytype,
  501.       UV_LINES,
  502.       UV_COLS,
  503.       UV_ERR,
  504.       UV_OK,
  505.   };
  506.   
  507.   static enum usersubs {
  508. --- 14,63 ----
  509.   
  510.   #include "EXTERN.h"
  511.   #include "perl.h"
  512.   
  513.   char *savestr();
  514.   
  515. + #undef bool
  516.   #include <curses.h>
  517.   
  518. + #ifndef A_UNDERLINE
  519. + #define NOSETATTR
  520. + #define A_STANDOUT  0x0200
  521. + #define A_UNDERLINE 0x0100
  522. + #define A_REVERSE   0x0200
  523. + #define A_BLINK     0x0400
  524. + #define A_BOLD      0x0800
  525. + #define A_ALTCHARSET 0x1000    
  526. + #define A_NORMAL    0
  527. + #endif
  528. + #ifdef USG
  529. + static char *tcbuf = NULL;
  530. + #endif
  531. + #ifdef NOSETATTR
  532. + static unsigned curattr = NORMAL;
  533. + #endif
  534.   static enum uservars {
  535.       UV_curscr,
  536.       UV_stdscr,
  537.       UV_ttytype,
  538.       UV_LINES,
  539.       UV_COLS,
  540.       UV_ERR,
  541.       UV_OK,
  542. + #ifdef BSD
  543. +     UV_Def_term,
  544. +     UV_My_term,
  545. + #endif    
  546. +     UV_A_STANDOUT,
  547. +     UV_A_UNDERLINE,
  548. +     UV_A_REVERSE,
  549. +     UV_A_BLINK,
  550. +     UV_A_DIM,
  551. +     UV_A_BOLD,
  552. +     UV_A_NORMAL,
  553.   };
  554.   
  555.   static enum usersubs {
  556. ***************
  557. *** 48,54 ****
  558.       US_wdeleteln,
  559.       US_erase,
  560.       US_werase,
  561. -     US_flushok,
  562.       US_idlok,
  563.       US_insch,
  564.       US_winsch,
  565. --- 79,84 ----
  566. ***************
  567. *** 58,65 ****
  568.       US_wmove,
  569.       US_overlay,
  570.       US_overwrite,
  571. -     US_printw,
  572. -     US_wprintw,
  573.       US_refresh,
  574.       US_wrefresh,
  575.       US_standout,
  576. --- 88,93 ----
  577. ***************
  578. *** 76,88 ****
  579.       US_wgetstr,
  580.       US_raw,
  581.       US_noraw,
  582. -     US_scanw,
  583. -     US_wscanw,
  584.       US_baudrate,
  585.       US_delwin,
  586.       US_endwin,
  587.       US_erasechar,
  588. -     US_getcap,
  589.       US_getyx,
  590.       US_inch,
  591.       US_winch,
  592. --- 104,113 ----
  593. ***************
  594. *** 90,96 ****
  595.       US_killchar,
  596.       US_leaveok,
  597.       US_longname,
  598. -     US_fullname,
  599.       US_mvwin,
  600.       US_newwin,
  601.       US_nl,
  602. --- 115,120 ----
  603. ***************
  604. *** 98,104 ****
  605.       US_scrollok,
  606.       US_subwin,
  607.       US_touchline,
  608. -     US_touchoverlap,
  609.       US_touchwin,
  610.       US_unctrl,
  611.       US_gettmode,
  612. --- 122,127 ----
  613. ***************
  614. *** 107,114 ****
  615. --- 130,157 ----
  616.       US_savetty,
  617.       US_resetty,
  618.       US_setterm,
  619. +     US_attroff,
  620. +     US_wattroff,
  621. +     US_attron,
  622. +     US_wattron,
  623. +     US_attrset,
  624. +     US_wattrset,
  625. + #ifdef CURSEFMT
  626. +     US_printw, /* remove */
  627. +     US_wprintw, /* remove */
  628. +     US_scanw,     /* delete */
  629. +     US_wscanw,     /* delete */
  630. + #endif
  631. +     US_getcap,
  632. + #ifdef BSD
  633. +     US_flushok,
  634. +     US_fullname,
  635. +     US_touchoverlap,
  636.       US_tstp,
  637.       US__putchar,
  638. + #endif
  639. +     US_mysub,
  640. +     US_testcallback,
  641.   };
  642.   
  643.   static int usersub();
  644. ***************
  645. *** 128,140 ****
  646.   
  647.       MAGICVAR("curscr",    UV_curscr);
  648.       MAGICVAR("stdscr",    UV_stdscr);
  649. -     MAGICVAR("Def_term",UV_Def_term);
  650. -     MAGICVAR("My_term",    UV_My_term);
  651.       MAGICVAR("ttytype",    UV_ttytype);
  652.       MAGICVAR("LINES",    UV_LINES);
  653.       MAGICVAR("COLS",    UV_COLS);
  654.       MAGICVAR("ERR",    UV_ERR);
  655.       MAGICVAR("OK",    UV_OK);
  656.   
  657.       make_usub("addch",        US_addch,    usersub, filename);
  658.       make_usub("waddch",        US_waddch,    usersub, filename);
  659. --- 171,192 ----
  660.   
  661.       MAGICVAR("curscr",    UV_curscr);
  662.       MAGICVAR("stdscr",    UV_stdscr);
  663.       MAGICVAR("ttytype",    UV_ttytype);
  664.       MAGICVAR("LINES",    UV_LINES);
  665.       MAGICVAR("COLS",    UV_COLS);
  666.       MAGICVAR("ERR",    UV_ERR);
  667.       MAGICVAR("OK",    UV_OK);
  668. + #ifdef BSD
  669. +     MAGICVAR("Def_term",UV_Def_term);
  670. +     MAGICVAR("My_term",    UV_My_term);
  671. + #endif
  672. +     MAGICVAR("A_STANDOUT", UV_A_STANDOUT);
  673. +     MAGICVAR("A_UNDERLINE", UV_A_UNDERLINE);
  674. +     MAGICVAR("A_REVERSE", UV_A_REVERSE);
  675. +     MAGICVAR("A_BLINK", UV_A_BLINK);
  676. +     MAGICVAR("A_DIM", UV_A_DIM);
  677. +     MAGICVAR("A_BOLD", UV_A_BOLD);
  678. +     MAGICVAR("A_NORMAL", UV_A_NORMAL);
  679.   
  680.       make_usub("addch",        US_addch,    usersub, filename);
  681.       make_usub("waddch",        US_waddch,    usersub, filename);
  682. ***************
  683. *** 154,160 ****
  684.       make_usub("wdeleteln",    US_wdeleteln,    usersub, filename);
  685.       make_usub("erase",        US_erase,    usersub, filename);
  686.       make_usub("werase",        US_werase,    usersub, filename);
  687. -     make_usub("flushok",    US_flushok,    usersub, filename);
  688.       make_usub("idlok",        US_idlok,    usersub, filename);
  689.       make_usub("insch",        US_insch,    usersub, filename);
  690.       make_usub("winsch",        US_winsch,    usersub, filename);
  691. --- 206,211 ----
  692. ***************
  693. *** 164,171 ****
  694.       make_usub("wmove",        US_wmove,    usersub, filename);
  695.       make_usub("overlay",    US_overlay,    usersub, filename);
  696.       make_usub("overwrite",    US_overwrite,    usersub, filename);
  697. -     make_usub("printw",        US_printw,    usersub, filename);
  698. -     make_usub("wprintw",    US_wprintw,    usersub, filename);
  699.       make_usub("refresh",    US_refresh,    usersub, filename);
  700.       make_usub("wrefresh",    US_wrefresh,    usersub, filename);
  701.       make_usub("standout",    US_standout,    usersub, filename);
  702. --- 215,220 ----
  703. ***************
  704. *** 182,194 ****
  705.       make_usub("wgetstr",    US_wgetstr,    usersub, filename);
  706.       make_usub("raw",        US_raw,        usersub, filename);
  707.       make_usub("noraw",        US_noraw,    usersub, filename);
  708. -     make_usub("scanw",        US_scanw,    usersub, filename);
  709. -     make_usub("wscanw",        US_wscanw,    usersub, filename);
  710.       make_usub("baudrate",    US_baudrate,    usersub, filename);
  711.       make_usub("delwin",        US_delwin,    usersub, filename);
  712.       make_usub("endwin",        US_endwin,    usersub, filename);
  713.       make_usub("erasechar",    US_erasechar,    usersub, filename);
  714. -     make_usub("getcap",        US_getcap,    usersub, filename);
  715.       make_usub("getyx",        US_getyx,    usersub, filename);
  716.       make_usub("inch",        US_inch,    usersub, filename);
  717.       make_usub("winch",        US_winch,    usersub, filename);
  718. --- 231,240 ----
  719. ***************
  720. *** 196,202 ****
  721.       make_usub("killchar",    US_killchar,    usersub, filename);
  722.       make_usub("leaveok",    US_leaveok,    usersub, filename);
  723.       make_usub("longname",    US_longname,    usersub, filename);
  724. -     make_usub("fullname",    US_fullname,    usersub, filename);
  725.       make_usub("mvwin",        US_mvwin,    usersub, filename);
  726.       make_usub("newwin",        US_newwin,    usersub, filename);
  727.       make_usub("nl",        US_nl,        usersub, filename);
  728. --- 242,247 ----
  729. ***************
  730. *** 204,210 ****
  731.       make_usub("scrollok",    US_scrollok,    usersub, filename);
  732.       make_usub("subwin",        US_subwin,    usersub, filename);
  733.       make_usub("touchline",    US_touchline,    usersub, filename);
  734. -     make_usub("touchoverlap",    US_touchoverlap,usersub, filename);
  735.       make_usub("touchwin",    US_touchwin,    usersub, filename);
  736.       make_usub("unctrl",        US_unctrl,    usersub, filename);
  737.       make_usub("gettmode",    US_gettmode,    usersub, filename);
  738. --- 249,254 ----
  739. ***************
  740. *** 213,222 ****
  741.       make_usub("savetty",    US_savetty,    usersub, filename);
  742.       make_usub("resetty",    US_resetty,    usersub, filename);
  743.       make_usub("setterm",    US_setterm,    usersub, filename);
  744.       make_usub("tstp",        US_tstp,    usersub, filename);
  745.       make_usub("_putchar",    US__putchar,    usersub, filename);
  746. ! };
  747.   
  748.   static int
  749.   usersub(ix, sp, items)
  750.   int ix;
  751. --- 257,353 ----
  752.       make_usub("savetty",    US_savetty,    usersub, filename);
  753.       make_usub("resetty",    US_resetty,    usersub, filename);
  754.       make_usub("setterm",    US_setterm,    usersub, filename);
  755. +     make_usub("getcap",        US_getcap,    usersub, filename);
  756. +     make_usub("attroff",        US_attroff,    usersub, filename);
  757. +     make_usub("wattroff",       US_wattroff,    usersub, filename);
  758. +     make_usub("attron",         US_attron,    usersub, filename);
  759. +     make_usub("wattron",        US_wattron,    usersub, filename);
  760. +     make_usub("attrset",        US_attrset,    usersub, filename);
  761. +     make_usub("wattrset",       US_wattrset,    usersub, filename);
  762. + #ifdef CURSEFMT
  763. +     make_usub("printw",        US_printw,    usersub, filename);
  764. +     make_usub("wprintw",    US_wprintw,    usersub, filename);
  765. +     make_usub("scanw",        US_scanw,    usersub, filename);
  766. +     make_usub("wscanw",        US_wscanw,    usersub, filename);
  767. + #endif
  768. + #ifdef BSD
  769. +     make_usub("flushok",    US_flushok,    usersub, filename);
  770. +     make_usub("fullname",    US_fullname,    usersub, filename);
  771. +     make_usub("touchoverlap",    US_touchoverlap,usersub, filename);
  772.       make_usub("tstp",        US_tstp,    usersub, filename);
  773.       make_usub("_putchar",    US__putchar,    usersub, filename);
  774. ! #endif
  775. !     make_usub("testcallback",    US_testcallback,usersub, filename);
  776. !   };
  777. !   
  778. ! #ifdef USG
  779. ! static char
  780. ! *getcap(cap)
  781. ! register char *cap;
  782. ! {
  783. !     static char nocaperr[] = "Cannot read termcap entry.";
  784.   
  785. +     extern char *tgetstr();
  786. +     if (tcbuf == NULL) {
  787. +     if ((tcbuf = malloc(1024)) == NULL) {
  788. +         fatal(nocaperr);
  789. +     }
  790. +     if (tgetent(tcbuf, ttytype) == -1) {
  791. +         fatal(nocaperr);
  792. +     }
  793. +     }
  794. +     return (tgetstr(cap, NULL));
  795. + }
  796. + #endif
  797. + #ifdef NOSETATTR
  798. + #define attron(attr)    wattron(stdscr, attr)
  799. + #define attroff(attr)   wattroff(stdscr, attr)
  800. + #define attset(attr)    wattset(stdscr, attr)
  801. + int
  802. + wattron(win, attr)
  803. + WINDOW *win;
  804. + chtype attr;
  805. + {
  806. +     curattr |= attr;
  807. +     if (curattr & A_STANDOUT) {
  808. +     return(wstandout(win));
  809. +     } else {
  810. +     return(wstandend(win));
  811. +     }
  812. + }
  813. + int
  814. + wattroff(win, attr)
  815. + WINDOW *win;
  816. + chtype attr;
  817. + {
  818. +     curattr &= (~attr);
  819. +     if (curattr & A_STANDOUT) {
  820. +     return(wstandout(win));
  821. +     } else {
  822. +     return(wstandend(win));
  823. +     }
  824. + }
  825. + int
  826. + wattrset(win, attr)
  827. + WINDOW *win;
  828. + chtype attr;
  829. + {
  830. +     curattr = attr;
  831. +     if (curattr & A_STANDOUT) {
  832. +     return(wstandout(win));
  833. +     } else {
  834. +     return(wstandend(win));
  835. +     }
  836. + }
  837. + #endif
  838. +     
  839.   static int
  840.   usersub(ix, sp, items)
  841.   int ix;
  842. ***************
  843. *** 300,310 ****
  844.   I    WINDOW*        win
  845.   END
  846.   
  847. - CASE int flushok
  848. - I    WINDOW*        win
  849. - I    bool        boolf
  850. - END
  851.   CASE int idlok
  852.   I    WINDOW*        win
  853.   I    bool        boolf
  854. --- 431,436 ----
  855. ***************
  856. *** 347,381 ****
  857.   I    WINDOW*        win2
  858.   END
  859.   
  860. -     case US_printw:
  861. -     if (items < 1)
  862. -         fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
  863. -     else {
  864. -         int retval;
  865. -         STR*    str =        str_new(0);
  866. -         do_sprintf(str, items - 1, st + 1);
  867. -         retval = addstr(str->str_ptr);
  868. -         str_numset(st[0], (double) retval);
  869. -         str_free(str);
  870. -     }
  871. -     return sp;
  872. -     case US_wprintw:
  873. -     if (items < 2)
  874. -         fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
  875. -     else {
  876. -         int retval;
  877. -         STR*    str =        str_new(0);
  878. -         WINDOW*    win =        *(WINDOW**)    str_get(st[1]);
  879. -         do_sprintf(str, items - 1, st + 1);
  880. -         retval = waddstr(win, str->str_ptr);
  881. -         str_numset(st[0], (double) retval);
  882. -         str_free(str);
  883. -     }
  884. -     return sp;
  885.   CASE int refresh
  886.   END
  887.   
  888. --- 473,478 ----
  889. ***************
  890. *** 410,422 ****
  891.   END
  892.   
  893.       case US_getch:
  894. !         if (items != 0)
  895. !             fatal("Usage: &getch()");
  896. !         else {
  897. !             int retval;
  898.           char retch;
  899.   
  900. !             retval = getch();
  901.           if (retval == EOF)
  902.           st[0] = &str_undef;
  903.           else {
  904. --- 507,519 ----
  905.   END
  906.   
  907.       case US_getch:
  908. !     if (items != 0)
  909. !         fatal("Usage: &getch()");
  910. !     else {
  911. !         int retval;
  912.           char retch;
  913.   
  914. !         retval = getch();
  915.           if (retval == EOF)
  916.           st[0] = &str_undef;
  917.           else {
  918. ***************
  919. *** 423,440 ****
  920.           retch = retval;
  921.           str_nset(st[0], &retch, 1);
  922.           }
  923. !         }
  924. !         return sp;
  925.   
  926.       case US_wgetch:
  927. !         if (items != 1)
  928. !             fatal("Usage: &wgetch($win)");
  929. !         else {
  930. !             int retval;
  931.           char retch;
  932. !             WINDOW*     win =           *(WINDOW**)     str_get(st[1]);
  933.   
  934. !             retval = wgetch(win);
  935.           if (retval == EOF)
  936.           st[0] = &str_undef;
  937.           else {
  938. --- 520,537 ----
  939.           retch = retval;
  940.           str_nset(st[0], &retch, 1);
  941.           }
  942. !     }
  943. !     return sp;
  944.   
  945.       case US_wgetch:
  946. !     if (items != 1)
  947. !         fatal("Usage: &wgetch($win)");
  948. !     else {
  949. !         int retval;
  950.           char retch;
  951. !         WINDOW*     win =           *(WINDOW**)     str_get(st[1]);
  952.   
  953. !         retval = wgetch(win);
  954.           if (retval == EOF)
  955.           st[0] = &str_undef;
  956.           else {
  957. ***************
  958. *** 441,456 ****
  959.           retch = retval;
  960.           str_nset(st[0], &retch, 1);
  961.           }
  962. !         }
  963. !         return sp;
  964.   
  965.   CASE int getstr
  966. ! IO    char*        str
  967.   END
  968.   
  969.   CASE int wgetstr
  970.   I    WINDOW*        win
  971. ! IO    char*        str
  972.   END
  973.   
  974.   CASE int raw
  975. --- 538,553 ----
  976.           retch = retval;
  977.           str_nset(st[0], &retch, 1);
  978.           }
  979. !     }
  980. !     return sp;
  981.   
  982.   CASE int getstr
  983. ! O    char*        str
  984.   END
  985.   
  986.   CASE int wgetstr
  987.   I    WINDOW*        win
  988. ! O    char*        str
  989.   END
  990.   
  991.   CASE int raw
  992. ***************
  993. *** 472,481 ****
  994.   CASE int erasechar
  995.   END
  996.   
  997. - CASE char* getcap
  998. - I    char*        str
  999. - END
  1000.       case US_getyx:
  1001.       if (items != 3)
  1002.           fatal("Usage: &getyx($win, $y, $x)");
  1003. --- 569,574 ----
  1004. ***************
  1005. *** 494,500 ****
  1006.           str_free(str);
  1007.       }
  1008.       return sp;
  1009.       
  1010.   CASE int inch
  1011.   END
  1012. --- 587,592 ----
  1013. ***************
  1014. *** 514,528 ****
  1015.   I    bool        boolf
  1016.   END
  1017.   
  1018.   CASE char* longname
  1019.   I    char*        termbuf
  1020.   IO    char*        name
  1021.   END
  1022. ! CASE int fullname
  1023. ! I    char*        termbuf
  1024. ! IO    char*        name
  1025.   END
  1026.   
  1027.   CASE int mvwin
  1028.   I    WINDOW*        win
  1029. --- 606,622 ----
  1030.   I    bool        boolf
  1031.   END
  1032.   
  1033. + #ifdef BSD
  1034.   CASE char* longname
  1035.   I    char*        termbuf
  1036.   IO    char*        name
  1037.   END
  1038. ! #else
  1039. ! CASE char* longname
  1040. ! I    char*        termbug
  1041. ! I    char*        name
  1042.   END
  1043. + #endif
  1044.   
  1045.   CASE int mvwin
  1046.   I    WINDOW*        win
  1047. ***************
  1048. *** 563,573 ****
  1049.   I    int        endx
  1050.   END
  1051.   
  1052. - CASE int touchoverlap
  1053. - I    WINDOW*        win1
  1054. - I    WINDOW*        win2
  1055. - END
  1056.   CASE int touchwin
  1057.   I    WINDOW*        win
  1058.   END
  1059. --- 657,662 ----
  1060. ***************
  1061. *** 600,605 ****
  1062. --- 689,770 ----
  1063.   I    char*        name
  1064.   END
  1065.   
  1066. + CASE int attroff
  1067. + I       chtype          str
  1068. + END
  1069. + CASE int wattroff
  1070. + I       chtype          str
  1071. + END
  1072. + CASE int wattron
  1073. + I       chtype          str
  1074. + END
  1075. + CASE int attron
  1076. + I       chtype          str
  1077. + END
  1078. + CASE int attrset
  1079. + I       chtype          str
  1080. + END
  1081. + CASE int wattrset
  1082. + I       chtype          str
  1083. + END
  1084. + #ifdef    CURSEFMT
  1085. +     case US_printw:
  1086. +     if (items < 1)
  1087. +         fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
  1088. +     else {
  1089. +         int retval;
  1090. +         STR*    str =        str_new(0);
  1091. +         do_sprintf(str, items - 1, st + 1);
  1092. +         retval = addstr(str->str_ptr);
  1093. +         str_numset(st[0], (double) retval);
  1094. +         str_free(str);
  1095. +     }
  1096. +     return sp;
  1097. +     case US_wprintw:
  1098. +     if (items < 2)
  1099. +         fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
  1100. +     else {
  1101. +         int retval;
  1102. +         STR*    str =        str_new(0);
  1103. +         WINDOW*    win =        *(WINDOW**)    str_get(st[1]);
  1104. +         do_sprintf(str, items - 1, st + 1);
  1105. +         retval = waddstr(win, str->str_ptr);
  1106. +         str_numset(st[0], (double) retval);
  1107. +         str_free(str);
  1108. +     }
  1109. +     return sp;
  1110. + #endif
  1111. + CASE char* getcap
  1112. + I    char*        str
  1113. + END
  1114. + #ifdef BSD
  1115. + CASE int flushok
  1116. + I    WINDOW*        win
  1117. + I    bool        boolf
  1118. + END
  1119. + CASE int fullname
  1120. + I    char*        termbuf
  1121. + IO    char*        name
  1122. + END
  1123. + CASE int touchoverlap
  1124. + I    WINDOW*        win1
  1125. + I    WINDOW*        win2
  1126. + END
  1127.   CASE int tstp
  1128.   END
  1129.   
  1130. ***************
  1131. *** 607,612 ****
  1132. --- 772,783 ----
  1133.   I    char        ch
  1134.   END
  1135.   
  1136. +     case US_testcallback:
  1137. +     sp = callback("callback", sp + items, curcsv->wantarray, 1, items);
  1138. +     break;
  1139. + #endif
  1140.       default:
  1141.       fatal("Unimplemented user-defined subroutine");
  1142.       }
  1143. ***************
  1144. *** 622,630 ****
  1145.       case UV_COLS:
  1146.       str_numset(str, (double)COLS);
  1147.       break;
  1148. -     case UV_Def_term:
  1149. -     str_set(str, Def_term);
  1150. -     break;
  1151.       case UV_ERR:
  1152.       str_numset(str, (double)ERR);
  1153.       break;
  1154. --- 793,798 ----
  1155. ***************
  1156. *** 631,639 ****
  1157.       case UV_LINES:
  1158.       str_numset(str, (double)LINES);
  1159.       break;
  1160. -     case UV_My_term:
  1161. -     str_numset(str, (double)My_term);
  1162. -     break;
  1163.       case UV_OK:
  1164.       str_numset(str, (double)OK);
  1165.       break;
  1166. --- 799,804 ----
  1167. ***************
  1168. *** 646,651 ****
  1169. --- 811,845 ----
  1170.       case UV_ttytype:
  1171.       str_set(str, ttytype);
  1172.       break;
  1173. + #ifdef BSD
  1174. +     case UV_Def_term:
  1175. +     str_set(str, Def_term);
  1176. +     break;
  1177. +     case UV_My_term:
  1178. +     str_numset(str, (double)My_term);
  1179. +     break;
  1180. + #endif
  1181. +     case UV_A_STANDOUT:
  1182. +     str_numset(str, (double)A_STANDOUT);
  1183. +     break;
  1184. +     case UV_A_UNDERLINE:
  1185. +     str_numset(str, (double)A_UNDERLINE);
  1186. +     break;
  1187. +     case UV_A_REVERSE:
  1188. +     str_numset(str, (double)A_REVERSE);
  1189. +     break;
  1190. +     case UV_A_BLINK:
  1191. +     str_numset(str, (double)A_BLINK);
  1192. +     break;
  1193. +     case UV_A_DIM:
  1194. +     str_numset(str, (double)A_DIM);
  1195. +     break;
  1196. +     case UV_A_BOLD:
  1197. +     str_numset(str, (double)A_BOLD);
  1198. +     break;
  1199. +     case UV_A_NORMAL:
  1200. +     str_numset(str, (double)A_NORMAL);
  1201. +     break;
  1202.       }
  1203.       return 0;
  1204.   }
  1205. ***************
  1206. *** 659,676 ****
  1207.       case UV_COLS:
  1208.       COLS = (int)str_gnum(str);
  1209.       break;
  1210. -     case UV_Def_term:
  1211. -     Def_term = savestr(str_get(str));    /* never freed */
  1212. -     break;
  1213.       case UV_LINES:
  1214.       LINES = (int)str_gnum(str);
  1215.       break;
  1216. -     case UV_My_term:
  1217. -     My_term = (bool)str_gnum(str);
  1218. -     break;
  1219.       case UV_ttytype:
  1220.       strcpy(ttytype, str_get(str));        /* hope it fits */
  1221.       break;
  1222.       }
  1223.       return 0;
  1224.   }
  1225. --- 853,878 ----
  1226.       case UV_COLS:
  1227.       COLS = (int)str_gnum(str);
  1228.       break;
  1229.       case UV_LINES:
  1230.       LINES = (int)str_gnum(str);
  1231.       break;
  1232.       case UV_ttytype:
  1233.       strcpy(ttytype, str_get(str));        /* hope it fits */
  1234. + #ifdef USG
  1235. +     if (tcbuf != NULL) {
  1236. +         free(tcbuf);
  1237. +         tcbuf = NULL;
  1238. +     }
  1239. + #endif    
  1240.       break;
  1241. + #ifdef BSD
  1242. +     case UV_Def_term:
  1243. +     Def_term = savestr(str_get(str));    /* never freed */
  1244. +     break;
  1245. +     case UV_My_term:
  1246. +     My_term = (bool)str_gnum(str);
  1247. +     break;
  1248. + #endif
  1249.       }
  1250.       return 0;
  1251.   }
  1252.  
  1253. Index: doSH
  1254. *** doSH.old    Tue Nov  5 19:25:54 1991
  1255. --- doSH    Tue Nov  5 19:25:54 1991
  1256. ***************
  1257. *** 3,8 ****
  1258. --- 3,10 ----
  1259.   : if this fails, just run all the .SH files by hand
  1260.   . ./config.sh
  1261.   
  1262. + rm -f x2p/config.sh
  1263.   echo " "
  1264.   echo "Doing variable substitutions on .SH files..."
  1265.   set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
  1266. ***************
  1267. *** 21,30 ****
  1268.       */*)
  1269.       dir=`expr X$file : 'X\(.*\)/'`
  1270.       file=`expr X$file : 'X.*/\(.*\)'`
  1271. !     (cd $dir && . $file)
  1272.       ;;
  1273.       *)
  1274. !     . $file
  1275.       ;;
  1276.       esac
  1277.   done
  1278. --- 23,32 ----
  1279.       */*)
  1280.       dir=`expr X$file : 'X\(.*\)/'`
  1281.       file=`expr X$file : 'X.*/\(.*\)'`
  1282. !     (cd $dir && . ./$file)
  1283.       ;;
  1284.       *)
  1285. !     . ./$file
  1286.       ;;
  1287.       esac
  1288.   done
  1289. ***************
  1290. *** 31,36 ****
  1291.   if test -f config.h.SH; then
  1292.       if test ! -f config.h; then
  1293.       : oops, they left it out of MANIFEST, probably, so do it anyway.
  1294. !     . config.h.SH
  1295.       fi
  1296.   fi
  1297. --- 33,39 ----
  1298.   if test -f config.h.SH; then
  1299.       if test ! -f config.h; then
  1300.       : oops, they left it out of MANIFEST, probably, so do it anyway.
  1301. !     . ./config.h.SH
  1302.       fi
  1303.   fi
  1304. + exit 0
  1305.  
  1306. Index: doarg.c
  1307. *** doarg.c.old    Tue Nov  5 19:25:57 1991
  1308. --- doarg.c    Tue Nov  5 19:25:58 1991
  1309. ***************
  1310. *** 1,4 ****
  1311. ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.3 $$Date: 91/06/10 01:18:41 $
  1312.    *
  1313.    *    Copyright (c) 1991, Larry Wall
  1314.    *
  1315. --- 1,4 ----
  1316. ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.4 $$Date: 91/11/05 16:35:06 $
  1317.    *
  1318.    *    Copyright (c) 1991, Larry Wall
  1319.    *
  1320. ***************
  1321. *** 6,11 ****
  1322. --- 6,20 ----
  1323.    *    License or the Artistic License, as specified in the README file.
  1324.    *
  1325.    * $Log:    doarg.c,v $
  1326. +  * Revision 4.0.1.4  91/11/05  16:35:06  lwall
  1327. +  * patch11: /$foo/o optimizer could access deallocated data
  1328. +  * patch11: minimum match length calculation in regexp is now cumulative
  1329. +  * patch11: added some support for 64-bit integers
  1330. +  * patch11: prepared for ctype implementations that don't define isascii()
  1331. +  * patch11: sprintf() now supports any length of s field
  1332. +  * patch11: indirect subroutine calls through magic vars (e.g. &$1) didn't work
  1333. +  * patch11: defined(&$foo) and undef(&$foo) didn't work
  1334. +  * 
  1335.    * Revision 4.0.1.3  91/06/10  01:18:41  lwall
  1336.    * patch10: pack(hh,1) dumped core
  1337.    * 
  1338. ***************
  1339. *** 78,86 ****
  1340.       spat->spat_regexp = regcomp(m,m+dstr->str_cur,
  1341.           spat->spat_flags & SPAT_FOLD);
  1342.       if (spat->spat_flags & SPAT_KEEP) {
  1343.           arg_free(spat->spat_runtime);    /* it won't change, so */
  1344.           spat->spat_runtime = Nullarg;    /* no point compiling again */
  1345. -         scanconst(spat, m, dstr->str_cur);
  1346.           hoistmust(spat);
  1347.               if (curcmd->c_expr && (curcmd->c_flags & CF_OPTIMIZE) == CFT_EVAL) {
  1348.                   curcmd->c_flags &= ~CF_OPTIMIZE;
  1349. --- 87,95 ----
  1350.       spat->spat_regexp = regcomp(m,m+dstr->str_cur,
  1351.           spat->spat_flags & SPAT_FOLD);
  1352.       if (spat->spat_flags & SPAT_KEEP) {
  1353. +         scanconst(spat, m, dstr->str_cur);
  1354.           arg_free(spat->spat_runtime);    /* it won't change, so */
  1355.           spat->spat_runtime = Nullarg;    /* no point compiling again */
  1356.           hoistmust(spat);
  1357.               if (curcmd->c_expr && (curcmd->c_flags & CF_OPTIMIZE) == CFT_EVAL) {
  1358.                   curcmd->c_flags &= ~CF_OPTIMIZE;
  1359. ***************
  1360. *** 151,157 ****
  1361.       }
  1362.       c = str_get(dstr);
  1363.       clen = dstr->str_cur;
  1364. !     if (clen <= spat->spat_slen + (int)spat->spat_regexp->regback) {
  1365.                       /* can do inplace substitution */
  1366.           if (regexec(spat->spat_regexp, s, strend, orig, 0,
  1367.             str->str_pok & SP_STUDIED ? str : Nullstr, safebase)) {
  1368. --- 160,166 ----
  1369.       }
  1370.       c = str_get(dstr);
  1371.       clen = dstr->str_cur;
  1372. !     if (clen <= spat->spat_regexp->minlen) {
  1373.                       /* can do inplace substitution */
  1374.           if (regexec(spat->spat_regexp, s, strend, orig, 0,
  1375.             str->str_pok & SP_STUDIED ? str : Nullstr, safebase)) {
  1376. ***************
  1377. *** 181,186 ****
  1378. --- 190,196 ----
  1379.               stack->ary_array[++sp] = arg->arg_ptr.arg_str;
  1380.               return sp;
  1381.               }
  1382. +             /*SUPPRESS 560*/
  1383.               else if (i = m - s) {    /* faster from front */
  1384.               d -= clen;
  1385.               m = d;
  1386. ***************
  1387. *** 217,222 ****
  1388. --- 227,233 ----
  1389.               if (iters++ > maxiters)
  1390.               fatal("Substitution loop");
  1391.               m = spat->spat_regexp->startp[0];
  1392. +             /*SUPPRESS 560*/
  1393.               if (i = m - s) {
  1394.               if (s != d)
  1395.                   (void)bcopy(s,d,i);
  1396. ***************
  1397. *** 407,412 ****
  1398. --- 418,424 ----
  1399.       register int len;
  1400.       int datumtype;
  1401.       STR *fromstr;
  1402. +     /*SUPPRESS 442*/
  1403.       static char *null10 = "\0\0\0\0\0\0\0\0\0\0";
  1404.       static char *space10 = "          ";
  1405.   
  1406. ***************
  1407. *** 417,422 ****
  1408. --- 429,438 ----
  1409.       unsigned int auint;
  1410.       long along;
  1411.       unsigned long aulong;
  1412. + #ifdef QUAD
  1413. +     quad aquad;
  1414. +     unsigned quad auquad;
  1415. + #endif
  1416.       char *aptr;
  1417.       float afloat;
  1418.       double adouble;
  1419. ***************
  1420. *** 431,439 ****
  1421.           len = index("@Xxu",datumtype) ? 0 : items;
  1422.           pat++;
  1423.       }
  1424. !     else if (isdigit(*pat)) {
  1425.           len = *pat++ - '0';
  1426. !         while (isdigit(*pat))
  1427.           len = (len * 10) + (*pat++ - '0');
  1428.       }
  1429.       else
  1430. --- 447,455 ----
  1431.           len = index("@Xxu",datumtype) ? 0 : items;
  1432.           pat++;
  1433.       }
  1434. !     else if (isDIGIT(*pat)) {
  1435.           len = *pat++ - '0';
  1436. !         while (isDIGIT(*pat))
  1437.           len = (len * 10) + (*pat++ - '0');
  1438.       }
  1439.       else
  1440. ***************
  1441. *** 573,579 ****
  1442.           items = 0;
  1443.           if (datumtype == 'H') {
  1444.               for (len = 0; len++ < aint;) {
  1445. !             if (isalpha(*pat))
  1446.                   items |= ((*pat++ & 15) + 9) & 15;
  1447.               else
  1448.                   items |= *pat++ & 15;
  1449. --- 589,595 ----
  1450.           items = 0;
  1451.           if (datumtype == 'H') {
  1452.               for (len = 0; len++ < aint;) {
  1453. !             if (isALPHA(*pat))
  1454.                   items |= ((*pat++ & 15) + 9) & 15;
  1455.               else
  1456.                   items |= *pat++ & 15;
  1457. ***************
  1458. *** 587,593 ****
  1459.           }
  1460.           else {
  1461.               for (len = 0; len++ < aint;) {
  1462. !             if (isalpha(*pat))
  1463.                   items |= (((*pat++ & 15) + 9) & 15) << 4;
  1464.               else
  1465.                   items |= (*pat++ & 15) << 4;
  1466. --- 603,609 ----
  1467.           }
  1468.           else {
  1469.               for (len = 0; len++ < aint;) {
  1470. !             if (isALPHA(*pat))
  1471.                   items |= (((*pat++ & 15) + 9) & 15) << 4;
  1472.               else
  1473.                   items |= (*pat++ & 15) << 4;
  1474. ***************
  1475. *** 691,696 ****
  1476. --- 707,728 ----
  1477.           str_ncat(str,(char*)&along,sizeof(long));
  1478.           }
  1479.           break;
  1480. + #ifdef QUAD
  1481. +     case 'Q':
  1482. +         while (len-- > 0) {
  1483. +         fromstr = NEXTFROM;
  1484. +         auquad = (unsigned quad)str_gnum(fromstr);
  1485. +         str_ncat(str,(char*)&auquad,sizeof(unsigned quad));
  1486. +         }
  1487. +         break;
  1488. +     case 'q':
  1489. +         while (len-- > 0) {
  1490. +         fromstr = NEXTFROM;
  1491. +         aquad = (quad)str_gnum(fromstr);
  1492. +         str_ncat(str,(char*)&aquad,sizeof(quad));
  1493. +         }
  1494. +         break;
  1495. + #endif /* QUAD */
  1496.       case 'p':
  1497.           while (len-- > 0) {
  1498.           fromstr = NEXTFROM;
  1499. ***************
  1500. *** 761,784 ****
  1501.       register char *t;
  1502.       register char *f;
  1503.       bool dolong;
  1504.       char ch;
  1505.       static STR *sargnull = &str_no;
  1506.       register char *send;
  1507.       char *xs;
  1508.       int xlen;
  1509.       double value;
  1510. -     char *origs;
  1511.   
  1512.       str_set(str,"");
  1513.       len--;            /* don't count pattern string */
  1514. !     origs = t = s = str_get(*sarg);
  1515.       send = s + (*sarg)->str_cur;
  1516.       sarg++;
  1517.       for ( ; ; len--) {
  1518. !     if (len <= 0 || !*sarg) {
  1519. !         sarg = &sargnull;
  1520. !         len = 0;
  1521. !     }
  1522.       for ( ; t < send && *t != '%'; t++) ;
  1523.       if (t >= send)
  1524.           break;        /* end of format string, ignore extra args */
  1525. --- 793,823 ----
  1526.       register char *t;
  1527.       register char *f;
  1528.       bool dolong;
  1529. + #ifdef QUAD
  1530. +     bool doquad;
  1531. + #endif /* QUAD */
  1532.       char ch;
  1533.       static STR *sargnull = &str_no;
  1534.       register char *send;
  1535. +     register STR *arg;
  1536.       char *xs;
  1537.       int xlen;
  1538. +     int pre;
  1539. +     int post;
  1540.       double value;
  1541.   
  1542.       str_set(str,"");
  1543.       len--;            /* don't count pattern string */
  1544. !     t = s = str_get(*sarg);
  1545.       send = s + (*sarg)->str_cur;
  1546.       sarg++;
  1547.       for ( ; ; len--) {
  1548. !     /*SUPPRESS 560*/
  1549. !     if (len <= 0 || !(arg = *sarg++))
  1550. !         arg = sargnull;
  1551. !     /*SUPPRESS 530*/
  1552.       for ( ; t < send && *t != '%'; t++) ;
  1553.       if (t >= send)
  1554.           break;        /* end of format string, ignore extra args */
  1555. ***************
  1556. *** 785,791 ****
  1557. --- 824,834 ----
  1558.       f = t;
  1559.       *buf = '\0';
  1560.       xs = buf;
  1561. + #ifdef QUAD
  1562. +     doquad =
  1563. + #endif /* QUAD */
  1564.       dolong = FALSE;
  1565. +     pre = post = 0;
  1566.       for (t++; t < send; t++) {
  1567.           switch (*t) {
  1568.           default:
  1569. ***************
  1570. *** 792,798 ****
  1571.           ch = *(++t);
  1572.           *t = '\0';
  1573.           (void)sprintf(xs,f);
  1574. !         len++;
  1575.           xlen = strlen(xs);
  1576.           break;
  1577.           case '0': case '1': case '2': case '3': case '4':
  1578. --- 835,841 ----
  1579.           ch = *(++t);
  1580.           *t = '\0';
  1581.           (void)sprintf(xs,f);
  1582. !         len++, sarg--;
  1583.           xlen = strlen(xs);
  1584.           break;
  1585.           case '0': case '1': case '2': case '3': case '4':
  1586. ***************
  1587. *** 800,811 ****
  1588.           case '.': case '#': case '-': case '+': case ' ':
  1589.           continue;
  1590.           case 'l':
  1591.           dolong = TRUE;
  1592.           continue;
  1593.           case 'c':
  1594.           ch = *(++t);
  1595.           *t = '\0';
  1596. !         xlen = (int)str_gnum(*(sarg++));
  1597.           if (strEQ(f,"%c")) { /* some printfs fail on null chars */
  1598.               *xs = xlen;
  1599.               xs[1] = '\0';
  1600. --- 843,860 ----
  1601.           case '.': case '#': case '-': case '+': case ' ':
  1602.           continue;
  1603.           case 'l':
  1604. + #ifdef QUAD
  1605. +         if (dolong) {
  1606. +             dolong = FALSE;
  1607. +             doquad = TRUE;
  1608. +         } else
  1609. + #endif
  1610.           dolong = TRUE;
  1611.           continue;
  1612.           case 'c':
  1613.           ch = *(++t);
  1614.           *t = '\0';
  1615. !         xlen = (int)str_gnum(arg);
  1616.           if (strEQ(f,"%c")) { /* some printfs fail on null chars */
  1617.               *xs = xlen;
  1618.               xs[1] = '\0';
  1619. ***************
  1620. *** 822,831 ****
  1621.           case 'd':
  1622.           ch = *(++t);
  1623.           *t = '\0';
  1624.           if (dolong)
  1625. !             (void)sprintf(xs,f,(long)str_gnum(*(sarg++)));
  1626.           else
  1627. !             (void)sprintf(xs,f,(int)str_gnum(*(sarg++)));
  1628.           xlen = strlen(xs);
  1629.           break;
  1630.           case 'X': case 'O':
  1631. --- 871,885 ----
  1632.           case 'd':
  1633.           ch = *(++t);
  1634.           *t = '\0';
  1635. + #ifdef QUAD
  1636. +         if (doquad)
  1637. +             (void)sprintf(buf,s,(quad)str_gnum(arg));
  1638. +         else
  1639. + #endif
  1640.           if (dolong)
  1641. !             (void)sprintf(xs,f,(long)str_gnum(arg));
  1642.           else
  1643. !             (void)sprintf(xs,f,(int)str_gnum(arg));
  1644.           xlen = strlen(xs);
  1645.           break;
  1646.           case 'X': case 'O':
  1647. ***************
  1648. *** 834,840 ****
  1649.           case 'x': case 'o': case 'u':
  1650.           ch = *(++t);
  1651.           *t = '\0';
  1652. !         value = str_gnum(*(sarg++));
  1653.           if (dolong)
  1654.               (void)sprintf(xs,f,U_L(value));
  1655.           else
  1656. --- 888,899 ----
  1657.           case 'x': case 'o': case 'u':
  1658.           ch = *(++t);
  1659.           *t = '\0';
  1660. !         value = str_gnum(arg);
  1661. ! #ifdef QUAD
  1662. !         if (doquad)
  1663. !             (void)sprintf(buf,s,(unsigned quad)value);
  1664. !         else
  1665. ! #endif
  1666.           if (dolong)
  1667.               (void)sprintf(xs,f,U_L(value));
  1668.           else
  1669. ***************
  1670. *** 844,862 ****
  1671.           case 'E': case 'e': case 'f': case 'G': case 'g':
  1672.           ch = *(++t);
  1673.           *t = '\0';
  1674. !         (void)sprintf(xs,f,str_gnum(*(sarg++)));
  1675.           xlen = strlen(xs);
  1676.           break;
  1677.           case 's':
  1678.           ch = *(++t);
  1679.           *t = '\0';
  1680. !         xs = str_get(*sarg);
  1681. !         xlen = (*sarg)->str_cur;
  1682.           if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B' && xs[3] == '\0'
  1683.             && xlen == sizeof(STBP)) {
  1684.               STR *tmpstr = Str_new(24,0);
  1685.   
  1686. !             stab_fullname(tmpstr, ((STAB*)(*sarg))); /* a stab value! */
  1687.               sprintf(tokenbuf,"*%s",tmpstr->str_ptr);
  1688.                       /* reformat to non-binary */
  1689.               xs = tokenbuf;
  1690. --- 903,921 ----
  1691.           case 'E': case 'e': case 'f': case 'G': case 'g':
  1692.           ch = *(++t);
  1693.           *t = '\0';
  1694. !         (void)sprintf(xs,f,str_gnum(arg));
  1695.           xlen = strlen(xs);
  1696.           break;
  1697.           case 's':
  1698.           ch = *(++t);
  1699.           *t = '\0';
  1700. !         xs = str_get(arg);
  1701. !         xlen = arg->str_cur;
  1702.           if (*xs == 'S' && xs[1] == 't' && xs[2] == 'B' && xs[3] == '\0'
  1703.             && xlen == sizeof(STBP)) {
  1704.               STR *tmpstr = Str_new(24,0);
  1705.   
  1706. !             stab_fullname(tmpstr, ((STAB*)arg)); /* a stab value! */
  1707.               sprintf(tokenbuf,"*%s",tmpstr->str_ptr);
  1708.                       /* reformat to non-binary */
  1709.               xs = tokenbuf;
  1710. ***************
  1711. *** 863,872 ****
  1712.               xlen = strlen(tokenbuf);
  1713.               str_free(tmpstr);
  1714.           }
  1715. -         sarg++;
  1716.           if (strEQ(f,"%s")) {    /* some printfs fail on >128 chars */
  1717. !             break;        /* so handle simple case */
  1718.           }
  1719.           strcpy(tokenbuf+64,f);    /* sprintf($s,...$s...) */
  1720.           *t = ch;
  1721.           (void)sprintf(buf,tokenbuf+64,xs);
  1722. --- 922,958 ----
  1723.               xlen = strlen(tokenbuf);
  1724.               str_free(tmpstr);
  1725.           }
  1726.           if (strEQ(f,"%s")) {    /* some printfs fail on >128 chars */
  1727. !             break;        /* so handle simple cases */
  1728.           }
  1729. +         else if (f[1] == '-') {
  1730. +             char *mp = index(f, '.');
  1731. +             int min = atoi(f+2);
  1732. +             if (xlen < min)
  1733. +             post = min - xlen;
  1734. +             else if (mp) {
  1735. +             int max = atoi(mp+1);
  1736. +             if (xlen > max)
  1737. +                 xlen = max;
  1738. +             }
  1739. +             break;
  1740. +         }
  1741. +         else if (isDIGIT(f[1])) {
  1742. +             char *mp = index(f, '.');
  1743. +             int min = atoi(f+1);
  1744. +             if (xlen < min)
  1745. +             pre = min - xlen;
  1746. +             else if (mp) {
  1747. +             int max = atoi(mp+1);
  1748. +             if (xlen > max)
  1749. +                 xlen = max;
  1750. +             }
  1751. +             break;
  1752. +         }
  1753.           strcpy(tokenbuf+64,f);    /* sprintf($s,...$s...) */
  1754.           *t = ch;
  1755.           (void)sprintf(buf,tokenbuf+64,xs);
  1756. ***************
  1757. *** 876,884 ****
  1758.           }
  1759.           /* end of switch, copy results */
  1760.           *t = ch;
  1761. !         STR_GROW(str, str->str_cur + (f - s) + len + 1);
  1762.           str_ncat(str, s, f - s);
  1763.           str_ncat(str, xs, xlen);
  1764.           s = t;
  1765.           break;        /* break from for loop */
  1766.       }
  1767. --- 962,978 ----
  1768.           }
  1769.           /* end of switch, copy results */
  1770.           *t = ch;
  1771. !         STR_GROW(str, str->str_cur + (f - s) + xlen + 1 + pre + post);
  1772.           str_ncat(str, s, f - s);
  1773. +         if (pre) {
  1774. +         repeatcpy(str->str_ptr + str->str_cur, " ", 1, pre);
  1775. +         str->str_cur += pre;
  1776. +         }
  1777.           str_ncat(str, xs, xlen);
  1778. +         if (post) {
  1779. +         repeatcpy(str->str_ptr + str->str_cur, " ", 1, post);
  1780. +         str->str_cur += post;
  1781. +         }
  1782.           s = t;
  1783.           break;        /* break from for loop */
  1784.       }
  1785. ***************
  1786. *** 946,952 ****
  1787.       if ((arg[1].arg_type & A_MASK) == A_WORD)
  1788.       stab = arg[1].arg_ptr.arg_stab;
  1789.       else {
  1790. !     STR *tmpstr = stab_val(arg[1].arg_ptr.arg_stab);
  1791.   
  1792.       if (tmpstr)
  1793.           stab = stabent(str_get(tmpstr),TRUE);
  1794. --- 1040,1046 ----
  1795.       if ((arg[1].arg_type & A_MASK) == A_WORD)
  1796.       stab = arg[1].arg_ptr.arg_stab;
  1797.       else {
  1798. !     STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
  1799.   
  1800.       if (tmpstr)
  1801.           stab = stabent(str_get(tmpstr),TRUE);
  1802. ***************
  1803. *** 1034,1040 ****
  1804.       HASH *hash;
  1805.       int i;
  1806.   
  1807. !     makelocal = (arg->arg_flags & AF_LOCAL);
  1808.       localizing = makelocal;
  1809.       delaymagic = DM_DELAY;        /* catch simultaneous items */
  1810.   
  1811. --- 1128,1134 ----
  1812.       HASH *hash;
  1813.       int i;
  1814.   
  1815. !     makelocal = (arg->arg_flags & AF_LOCAL) != 0;
  1816.       localizing = makelocal;
  1817.       delaymagic = DM_DELAY;        /* catch simultaneous items */
  1818.   
  1819. ***************
  1820. *** 1044,1049 ****
  1821. --- 1138,1144 ----
  1822.        */
  1823.       if (arg->arg_flags & AF_COMMON) {
  1824.       for (relem = firstrelem; relem <= lastrelem; relem++) {
  1825. +         /*SUPPRESS 560*/
  1826.           if (str = *relem)
  1827.           *relem = str_mortal(str);
  1828.       }
  1829. ***************
  1830. *** 1179,1185 ****
  1831.       }
  1832.   }
  1833.   
  1834. ! int
  1835.   do_study(str,arg,gimme,arglast)
  1836.   STR *str;
  1837.   ARG *arg;
  1838. --- 1274,1280 ----
  1839.       }
  1840.   }
  1841.   
  1842. ! int                    /*SUPPRESS 590*/
  1843.   do_study(str,arg,gimme,arglast)
  1844.   STR *str;
  1845.   ARG *arg;
  1846. ***************
  1847. *** 1254,1260 ****
  1848.       return retarg;
  1849.   }
  1850.   
  1851. ! int
  1852.   do_defined(str,arg,gimme,arglast)
  1853.   STR *str;
  1854.   register ARG *arg;
  1855. --- 1349,1355 ----
  1856.       return retarg;
  1857.   }
  1858.   
  1859. ! int                    /*SUPPRESS 590*/
  1860.   do_defined(str,arg,gimme,arglast)
  1861.   STR *str;
  1862.   register ARG *arg;
  1863. ***************
  1864. *** 1272,1279 ****
  1865.       arg = arg[1].arg_ptr.arg_arg;
  1866.       type = arg->arg_type;
  1867.   
  1868. !     if (type == O_SUBR || type == O_DBSUBR)
  1869. !     retval = stab_sub(arg[1].arg_ptr.arg_stab) != 0;
  1870.       else if (type == O_ARRAY || type == O_LARRAY ||
  1871.            type == O_ASLICE || type == O_LASLICE )
  1872.       retval = ((ary = stab_xarray(arg[1].arg_ptr.arg_stab)) != 0
  1873. --- 1367,1381 ----
  1874.       arg = arg[1].arg_ptr.arg_arg;
  1875.       type = arg->arg_type;
  1876.   
  1877. !     if (type == O_SUBR || type == O_DBSUBR) {
  1878. !     if ((arg[1].arg_type & A_MASK) == A_WORD)
  1879. !         retval = stab_sub(arg[1].arg_ptr.arg_stab) != 0;
  1880. !     else {
  1881. !         STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
  1882. !         retval = tmpstr && stab_sub(stabent(str_get(tmpstr),TRUE)) != 0;
  1883. !     }
  1884. !     }
  1885.       else if (type == O_ARRAY || type == O_LARRAY ||
  1886.            type == O_ASLICE || type == O_LASLICE )
  1887.       retval = ((ary = stab_xarray(arg[1].arg_ptr.arg_stab)) != 0
  1888. ***************
  1889. *** 1289,1295 ****
  1890.       return retarg;
  1891.   }
  1892.   
  1893. ! int
  1894.   do_undef(str,arg,gimme,arglast)
  1895.   STR *str;
  1896.   register ARG *arg;
  1897. --- 1391,1397 ----
  1898.       return retarg;
  1899.   }
  1900.   
  1901. ! int                        /*SUPPRESS 590*/
  1902.   do_undef(str,arg,gimme,arglast)
  1903.   STR *str;
  1904.   register ARG *arg;
  1905. ***************
  1906. *** 1325,1331 ****
  1907.       }
  1908.       else if (type == O_SUBR || type == O_DBSUBR) {
  1909.       stab = arg[1].arg_ptr.arg_stab;
  1910. !     if (stab_sub(stab)) {
  1911.           cmd_free(stab_sub(stab)->cmd);
  1912.           stab_sub(stab)->cmd = Nullcmd;
  1913.           afree(stab_sub(stab)->tosave);
  1914. --- 1427,1441 ----
  1915.       }
  1916.       else if (type == O_SUBR || type == O_DBSUBR) {
  1917.       stab = arg[1].arg_ptr.arg_stab;
  1918. !     if ((arg[1].arg_type & A_MASK) != A_WORD) {
  1919. !         STR *tmpstr = STAB_STR(arg[1].arg_ptr.arg_stab);
  1920. !         if (tmpstr)
  1921. !         stab = stabent(str_get(tmpstr),TRUE);
  1922. !         else
  1923. !         stab = Nullstab;
  1924. !     }
  1925. !     if (stab && stab_sub(stab)) {
  1926.           cmd_free(stab_sub(stab)->cmd);
  1927.           stab_sub(stab)->cmd = Nullcmd;
  1928.           afree(stab_sub(stab)->tosave);
  1929. ***************
  1930. *** 1376,1384 ****
  1931.           if (size == 8)
  1932.           retnum = s[offset];
  1933.           else if (size == 16)
  1934. !         retnum = (s[offset] << 8) + s[offset+1];
  1935.           else if (size == 32)
  1936. !         retnum = (s[offset] << 24) + (s[offset + 1] << 16) +
  1937.               (s[offset + 2] << 8) + s[offset+3];
  1938.       }
  1939.   
  1940. --- 1486,1495 ----
  1941.           if (size == 8)
  1942.           retnum = s[offset];
  1943.           else if (size == 16)
  1944. !         retnum = ((unsigned long) s[offset] << 8) + s[offset+1];
  1945.           else if (size == 32)
  1946. !         retnum = ((unsigned long) s[offset] << 24) +
  1947. !             ((unsigned long) s[offset + 1] << 16) +
  1948.               (s[offset + 2] << 8) + s[offset+3];
  1949.       }
  1950.   
  1951. ***************
  1952. *** 1458,1463 ****
  1953. --- 1569,1575 ----
  1954.       if (str->str_state == SS_HASH) {
  1955.       hash = stab_hash(str->str_u.str_stab);
  1956.       (void)hiterinit(hash);
  1957. +     /*SUPPRESS 560*/
  1958.       while (entry = hiternext(hash))
  1959.           do_chop(astr,hiterval(hash,entry));
  1960.       return;
  1961.  
  1962. *** End of Patch 13 ***
  1963. exit 0 # Just in case...
  1964. -- 
  1965. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1966. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1967. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1968. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1969.