home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume20 / perl / patch05 < prev    next >
Encoding:
Text File  |  1991-06-19  |  50.8 KB  |  2,001 lines

  1. Newsgroups: comp.sources.misc
  2. From: Larry Wall <lwall@netlabs.com>
  3. Subject:  v20i057:  perl - The perl programming language, Patch05
  4. Message-ID: <1991Jun20.030423.8601@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: bbf43d3f808ca91ba3e3a2f3a38761b7
  6. Date: Thu, 20 Jun 1991 03:04:23 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Larry Wall <lwall@netlabs.com>
  10. Posting-number: Volume 20, Issue 57
  11. Archive-name: perl/patch05
  12. Patch-To: perl: Volume 18, Issue 19-54
  13.  
  14. System: perl version 4.0
  15. Patch #: 5
  16. Priority: High
  17. Subject: patch #4, continued
  18.  
  19. Description:
  20.     See patch #4.
  21.  
  22. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your perl source
  23.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  24.     If you don't have the patch program, apply the following by hand,
  25.     or get patch (version 2.0, latest patchlevel).
  26.  
  27.     After patching:
  28.         *** DO NOTHING--INSTALL ALL PATCHES UP THROUGH #09 FIRST ***
  29.  
  30.     If patch indicates that patchlevel is the wrong version, you may need
  31.     to apply one or more previous patches, or the patch may already
  32.     have been applied.  See the patchlevel.h file to find out what has or
  33.     has not been applied.  In any event, don't continue with the patch.
  34.  
  35.     If you are missing previous patches they can be obtained from me:
  36.  
  37.     Larry Wall
  38.     lwall@netlabs.com
  39.  
  40.     If you send a mail message of the following form it will greatly speed
  41.     processing:
  42.  
  43.     Subject: Command
  44.     @SH mailpatch PATH perl 4.0 LIST
  45.            ^ note the c
  46.  
  47.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  48.     or in bang notation from some well-known host, and LIST is the number
  49.     of one or more patches you need, separated by spaces, commas, and/or
  50.     hyphens.  Saying 35- says everything from 35 to the end.
  51.  
  52.  
  53. Index: patchlevel.h
  54. Prereq: 4
  55. 1c1
  56. < #define PATCHLEVEL 4
  57. ---
  58. > #define PATCHLEVEL 5
  59.  
  60. Index: t/TEST
  61. Prereq: 4.0
  62. *** t/TEST.old    Fri Jun  7 12:27:03 1991
  63. --- t/TEST    Fri Jun  7 12:27:03 1991
  64. ***************
  65. *** 1,6 ****
  66.   #!./perl
  67.   
  68. ! # $Header: TEST,v 4.0 91/03/20 01:40:22 lwall Locked $
  69.   
  70.   # This is written in a peculiar style, since we're trying to avoid
  71.   # most of the constructs we'll be testing for.
  72. --- 1,6 ----
  73.   #!./perl
  74.   
  75. ! # $RCSfile: TEST,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:59:30 $
  76.   
  77.   # This is written in a peculiar style, since we're trying to avoid
  78.   # most of the constructs we'll be testing for.
  79. ***************
  80. *** 56,61 ****
  81. --- 56,63 ----
  82.       unless (/^#/) {
  83.           if (/^1\.\.([0-9]+)/) {
  84.           $max = $1;
  85. +         $totmax += $max;
  86. +         $files += 1;
  87.           $next = 1;
  88.           $ok = 1;
  89.           } else {
  90. ***************
  91. *** 96,99 ****
  92.       }
  93.   }
  94.   ($user,$sys,$cuser,$csys) = times;
  95. ! print sprintf("u=%g  s=%g  cu=%g  cs=%g\n",$user,$sys,$cuser,$csys);
  96. --- 98,102 ----
  97.       }
  98.   }
  99.   ($user,$sys,$cuser,$csys) = times;
  100. ! print sprintf("u=%g  s=%g  cu=%g  cs=%g  files=%d  tests=%d\n",
  101. !     $user,$sys,$cuser,$csys,$files,$totmax);
  102.  
  103. Index: x2p/a2p.h
  104. Prereq: 4.0
  105. *** x2p/a2p.h.old    Fri Jun  7 12:27:43 1991
  106. --- x2p/a2p.h    Fri Jun  7 12:27:44 1991
  107. ***************
  108. *** 1,11 ****
  109. ! /* $Header: a2p.h,v 4.0 91/03/20 01:57:07 lwall Locked $
  110.    *
  111. !  *    Copyright (c) 1989, Larry Wall
  112.    *
  113. !  *    You may distribute under the terms of the GNU General Public License
  114. !  *    as specified in the README file that comes with the perl 3.0 kit.
  115.    *
  116.    * $Log:    a2p.h,v $
  117.    * Revision 4.0  91/03/20  01:57:07  lwall
  118.    * 4.0 baseline.
  119.    * 
  120. --- 1,14 ----
  121. ! /* $RCSfile: a2p.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:12:27 $
  122.    *
  123. !  *    Copyright (c) 1991, Larry Wall
  124.    *
  125. !  *    You may distribute under the terms of either the GNU General Public
  126. !  *    License or the Artistic License, as specified in the README file.
  127.    *
  128.    * $Log:    a2p.h,v $
  129. +  * Revision 4.0.1.1  91/06/07  12:12:27  lwall
  130. +  * patch4: new copyright notice
  131. +  * 
  132.    * Revision 4.0  91/03/20  01:57:07  lwall
  133.    * 4.0 baseline.
  134.    * 
  135.  
  136. Index: x2p/a2p.y
  137. Prereq: 4.0
  138. *** x2p/a2p.y.old    Fri Jun  7 12:27:47 1991
  139. --- x2p/a2p.y    Fri Jun  7 12:27:47 1991
  140. ***************
  141. *** 1,12 ****
  142.   %{
  143. ! /* $Header: a2p.y,v 4.0 91/03/20 01:57:21 lwall Locked $
  144.    *
  145. !  *    Copyright (c) 1989, Larry Wall
  146.    *
  147. !  *    You may distribute under the terms of the GNU General Public License
  148. !  *    as specified in the README file that comes with the perl 3.0 kit.
  149.    *
  150.    * $Log:    a2p.y,v $
  151.    * Revision 4.0  91/03/20  01:57:21  lwall
  152.    * 4.0 baseline.
  153.    * 
  154. --- 1,15 ----
  155.   %{
  156. ! /* $RCSfile: a2p.y,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:12:41 $
  157.    *
  158. !  *    Copyright (c) 1991, Larry Wall
  159.    *
  160. !  *    You may distribute under the terms of either the GNU General Public
  161. !  *    License or the Artistic License, as specified in the README file.
  162.    *
  163.    * $Log:    a2p.y,v $
  164. +  * Revision 4.0.1.1  91/06/07  12:12:41  lwall
  165. +  * patch4: new copyright notice
  166. +  * 
  167.    * Revision 4.0  91/03/20  01:57:21  lwall
  168.    * 4.0 baseline.
  169.    * 
  170.  
  171. Index: x2p/a2py.c
  172. Prereq: 4.0
  173. *** x2p/a2py.c.old    Fri Jun  7 12:27:50 1991
  174. --- x2p/a2py.c    Fri Jun  7 12:27:51 1991
  175. ***************
  176. *** 1,11 ****
  177. ! /* $Header: a2py.c,v 4.0 91/03/20 01:57:26 lwall Locked $
  178.    *
  179. !  *    Copyright (c) 1989, Larry Wall
  180.    *
  181. !  *    You may distribute under the terms of the GNU General Public License
  182. !  *    as specified in the README file that comes with the perl 3.0 kit.
  183.    *
  184.    * $Log:    a2py.c,v $
  185.    * Revision 4.0  91/03/20  01:57:26  lwall
  186.    * 4.0 baseline.
  187.    * 
  188. --- 1,14 ----
  189. ! /* $RCSfile: a2py.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:12:59 $
  190.    *
  191. !  *    Copyright (c) 1991, Larry Wall
  192.    *
  193. !  *    You may distribute under the terms of either the GNU General Public
  194. !  *    License or the Artistic License, as specified in the README file.
  195.    *
  196.    * $Log:    a2py.c,v $
  197. +  * Revision 4.0.1.1  91/06/07  12:12:59  lwall
  198. +  * patch4: new copyright notice
  199. +  * 
  200.    * Revision 4.0  91/03/20  01:57:26  lwall
  201.    * 4.0 baseline.
  202.    * 
  203.  
  204. Index: hints/aix_rs.sh
  205. *** hints/aix_rs.sh.old    Fri Jun  7 12:24:20 1991
  206. --- hints/aix_rs.sh    Fri Jun  7 12:24:20 1991
  207. ***************
  208. *** 1 ****
  209. ! optimize='-g'
  210. --- 1,4 ----
  211. ! eval_cflags='optimize="-g"'
  212. ! toke_cflags='optimize="-g"'
  213. ! teval_cflags='optimize="-g"'
  214. ! ttoke_cflags='optimize="-g"'; cflags="$cflags -D_NO_PROTO"
  215.  
  216. Index: hints/apollo_C6_7.sh
  217. *** hints/apollo_C6_7.sh.old    Fri Jun  7 12:24:22 1991
  218. --- hints/apollo_C6_7.sh    Fri Jun  7 12:24:23 1991
  219. ***************
  220. *** 1 ****
  221. --- 1,4 ----
  222.   optimize='-opt 2'
  223. + cflags='-A nansi cpu,mathchip -O -U__STDC__'
  224. + echo "Some tests may fail unless you use 'chacl -B'.  Also, op/stat"
  225. + echo "test 2 may fail because Apollo doesn't support mtime or ctime."
  226.  
  227. Index: arg.h
  228. Prereq: 4.0
  229. *** arg.h.old    Fri Jun  7 12:22:41 1991
  230. --- arg.h    Fri Jun  7 12:22:42 1991
  231. ***************
  232. *** 1,11 ****
  233. ! /* $Header: arg.h,v 4.0 91/03/20 01:03:09 lwall Locked $
  234.    *
  235. !  *    Copyright (c) 1989, Larry Wall
  236.    *
  237. !  *    You may distribute under the terms of the GNU General Public License
  238. !  *    as specified in the README file that comes with the perl 3.0 kit.
  239.    *
  240.    * $Log:    arg.h,v $
  241.    * Revision 4.0  91/03/20  01:03:09  lwall
  242.    * 4.0 baseline.
  243.    * 
  244. --- 1,16 ----
  245. ! /* $RCSfile: arg.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:18:30 $
  246.    *
  247. !  *    Copyright (c) 1991, Larry Wall
  248.    *
  249. !  *    You may distribute under the terms of either the GNU General Public
  250. !  *    License or the Artistic License, as specified in the README file.
  251.    *
  252.    * $Log:    arg.h,v $
  253. +  * Revision 4.0.1.1  91/06/07  10:18:30  lwall
  254. +  * patch4: length($`), length($&), length($') now optimized to avoid string copy
  255. +  * patch4: new copyright notice
  256. +  * patch4: many, many itty-bitty portability fixes
  257. +  * 
  258.    * Revision 4.0  91/03/20  01:03:09  lwall
  259.    * 4.0 baseline.
  260.    * 
  261. ***************
  262. *** 270,276 ****
  263.   #define O_SGRENT 256
  264.   #define O_EGRENT 257
  265.   #define O_GETLOGIN 258
  266. ! #define O_OPENDIR 259
  267.   #define O_READDIR 260
  268.   #define O_TELLDIR 261
  269.   #define O_SEEKDIR 262
  270. --- 275,281 ----
  271.   #define O_SGRENT 256
  272.   #define O_EGRENT 257
  273.   #define O_GETLOGIN 258
  274. ! #define O_OPEN_DIR 259
  275.   #define O_READDIR 260
  276.   #define O_TELLDIR 261
  277.   #define O_SEEKDIR 262
  278. ***************
  279. *** 576,581 ****
  280. --- 581,587 ----
  281.   #define A_STAR 18
  282.   #define A_LSTAR 19
  283.   #define A_WANTARRAY 20
  284. + #define A_LENSTAB 21
  285.   
  286.   #define A_MASK 31
  287.   #define A_DONT 32        /* or this into type to suppress evaluation */
  288. ***************
  289. *** 605,611 ****
  290.       "STAR",
  291.       "LSTAR",
  292.       "WANTARRAY",
  293. !     "21"
  294.   };
  295.   #endif
  296.   
  297. --- 611,618 ----
  298.       "STAR",
  299.       "LSTAR",
  300.       "WANTARRAY",
  301. !     "LENSTAB",
  302. !     "22"
  303.   };
  304.   #endif
  305.   
  306. ***************
  307. *** 634,639 ****
  308. --- 641,647 ----
  309.      1,    /* STAR */
  310.      1,    /* LSTAR */
  311.      1,    /* WANTARRAY */
  312. +    0,    /* LENSTAB */
  313.      0,    /* 21 */
  314.   };
  315.   #endif
  316.  
  317. Index: array.c
  318. Prereq: 4.0
  319. *** array.c.old    Fri Jun  7 12:22:44 1991
  320. --- array.c    Fri Jun  7 12:22:45 1991
  321. ***************
  322. *** 1,11 ****
  323. ! /* $Header: array.c,v 4.0 91/03/20 01:03:32 lwall Locked $
  324.    *
  325. !  *    Copyright (c) 1989, Larry Wall
  326.    *
  327. !  *    You may distribute under the terms of the GNU General Public License
  328. !  *    as specified in the README file that comes with the perl 3.0 kit.
  329.    *
  330.    * $Log:    array.c,v $
  331.    * Revision 4.0  91/03/20  01:03:32  lwall
  332.    * 4.0 baseline.
  333.    * 
  334. --- 1,14 ----
  335. ! /* $RCSfile: array.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:19:08 $
  336.    *
  337. !  *    Copyright (c) 1991, Larry Wall
  338.    *
  339. !  *    You may distribute under the terms of either the GNU General Public
  340. !  *    License or the Artistic License, as specified in the README file.
  341.    *
  342.    * $Log:    array.c,v $
  343. +  * Revision 4.0.1.1  91/06/07  10:19:08  lwall
  344. +  * patch4: new copyright notice
  345. +  * 
  346.    * Revision 4.0  91/03/20  01:03:32  lwall
  347.    * 4.0 baseline.
  348.    * 
  349.  
  350. Index: array.h
  351. Prereq: 4.0
  352. *** array.h.old    Fri Jun  7 12:22:47 1991
  353. --- array.h    Fri Jun  7 12:22:48 1991
  354. ***************
  355. *** 1,11 ****
  356. ! /* $Header: array.h,v 4.0 91/03/20 01:03:44 lwall Locked $
  357.    *
  358. !  *    Copyright (c) 1989, Larry Wall
  359.    *
  360. !  *    You may distribute under the terms of the GNU General Public License
  361. !  *    as specified in the README file that comes with the perl 3.0 kit.
  362.    *
  363.    * $Log:    array.h,v $
  364.    * Revision 4.0  91/03/20  01:03:44  lwall
  365.    * 4.0 baseline.
  366.    * 
  367. --- 1,14 ----
  368. ! /* $RCSfile: array.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:19:20 $
  369.    *
  370. !  *    Copyright (c) 1991, Larry Wall
  371.    *
  372. !  *    You may distribute under the terms of either the GNU General Public
  373. !  *    License or the Artistic License, as specified in the README file.
  374.    *
  375.    * $Log:    array.h,v $
  376. +  * Revision 4.0.1.1  91/06/07  10:19:20  lwall
  377. +  * patch4: new copyright notice
  378. +  * 
  379.    * Revision 4.0  91/03/20  01:03:44  lwall
  380.    * 4.0 baseline.
  381.    * 
  382.  
  383. Index: hints/aux.sh
  384. *** hints/aux.sh.old    Fri Jun  7 12:24:25 1991
  385. --- hints/aux.sh    Fri Jun  7 12:24:26 1991
  386. ***************
  387. *** 1,2 ****
  388.   optimize='-O'
  389. ! ccflags="$ccflags -B/usr/lib/bin/'
  390. --- 1,2 ----
  391.   optimize='-O'
  392. ! ccflags="$ccflags -B/usr/lib/big/ -DPARAM_NEEDS_TYPES"
  393.  
  394. Index: cflags.SH
  395. *** cflags.SH.old    Fri Jun  7 12:22:50 1991
  396. --- cflags.SH    Fri Jun  7 12:22:50 1991
  397. ***************
  398. *** 5,80 ****
  399.       ln ../../config.sh . || \
  400.       ln ../../../config.sh . || \
  401.       (echo "Can't find config.sh."; exit 1)
  402. !     fi 2>/dev/null
  403. !     . ./config.sh
  404.       ;;
  405.   esac
  406.   case "$0" in
  407.   */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  408.   esac
  409.   
  410.   also=': '
  411.   case $# in
  412. ! 1) also='echo 1>&2 "      CFLAGS = "'
  413.   esac
  414.   
  415.   case $# in
  416.   0) set *.c; echo "The current C flags are:" ;;
  417. - *) set `echo "$* " | sed 's/\.o /.c /g'`
  418.   esac
  419.   for file do
  420.   
  421.       case "$#" in
  422.       1) ;;
  423. !     *) echo $n "    $file    $c" ;;
  424.       esac
  425.   
  426.       case "$file" in
  427. !     array.c) ;;
  428. !     cmd.c) ;;
  429. !     cons.c) ;;
  430. !     consarg.c) ;;
  431. !     doarg.c) ;;
  432. !     doio.c) ;;
  433. !     dolist.c) ;;
  434. !     dump.c) ;;
  435. !     eval.c) ;;
  436. !     form.c) ;;
  437. !     hash.c) ;;
  438. !     malloc.c) ;;
  439. !     perl.c) ;;
  440. !     perly.c) ;;
  441. !     regcomp.c) ;;
  442. !     regexec.c) ;;
  443. !     stab.c) ;;
  444. !     str.c) ;;
  445. !     toke.c) ;;
  446. !     usersub.c) ;;
  447. !     util.c) ;;
  448. !     tarray.c) ;;
  449. !     tcmd.c) ;;
  450. !     tcons.c) ;;
  451. !     tconsarg.c) ;;
  452. !     tdoarg.c) ;;
  453. !     tdoio.c) ;;
  454. !     tdolist.c) ;;
  455. !     tdump.c) ;;
  456. !     teval.c) ;;
  457. !     tform.c) ;;
  458. !     thash.c) ;;
  459. !     tmalloc.c) ;;
  460. !     tperl.c) ;;
  461. !     tperly.c) ;;
  462. !     tregcomp.c) ;;
  463. !     tregexec.c) ;;
  464. !     tstab.c) ;;
  465. !     tstr.c) ;;
  466. !     ttoke.c) ;;
  467. !     tusersub.c) ;;
  468. !     tutil.c) ;;
  469.       *) ;;
  470.       esac
  471.   
  472. !     echo "$ccflags $optimize $large $split"
  473. !     eval "$also $ccflags $optimize $large $split"
  474.   done
  475. --- 5,120 ----
  476.       ln ../../config.sh . || \
  477.       ln ../../../config.sh . || \
  478.       (echo "Can't find config.sh."; exit 1)
  479. !     fi
  480. !     . config.sh
  481.       ;;
  482.   esac
  483. + : This forces SH files to create target in same directory as SH file.
  484. + : This is so that make depend always knows where to find SH derivatives.
  485.   case "$0" in
  486.   */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  487.   esac
  488. + echo "Extracting cflags (with variable substitutions)"
  489. + : This section of the file will have variable substitutions done on it.
  490. + : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  491. + : Protect any dollar signs and backticks that you do not want interpreted
  492. + : by putting a backslash in front.  You may delete these comments.
  493. + $spitshell >cflags <<!GROK!THIS!
  494. + !GROK!THIS!
  495.   
  496. + : In the following dollars and backticks do not need the extra backslash.
  497. + $spitshell >>cflags <<'!NO!SUBS!'
  498. + case "$0" in
  499. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  500. + esac
  501. + case $CONFIG in
  502. + '')
  503. +     if test ! -f config.sh; then
  504. +     ln ../config.sh . || \
  505. +     ln ../../config.sh . || \
  506. +     ln ../../../config.sh . || \
  507. +     (echo "Can't find config.sh."; exit 1)
  508. +     fi 2>/dev/null
  509. +     . ./config.sh
  510. +     ;;
  511. + esac
  512.   also=': '
  513.   case $# in
  514. ! 1) also='echo 1>&2 "      CCCMD = "'
  515.   esac
  516.   
  517.   case $# in
  518.   0) set *.c; echo "The current C flags are:" ;;
  519.   esac
  520. + set `echo "$* " | sed 's/\.[oc] / /g'`
  521.   for file do
  522.   
  523.       case "$#" in
  524.       1) ;;
  525. !     *) echo $n "    $file.c    $c" ;;
  526.       esac
  527.   
  528. +     : allow variables like toke_cflags to be evaluated
  529. +     eval 'eval ${'"${file}_cflags"'-""}'
  530. +     : or customize here
  531.       case "$file" in
  532. !     array) ;;
  533. !     cmd) ;;
  534. !     cons) ;;
  535. !     consarg) ;;
  536. !     doarg) ;;
  537. !     doio) ;;
  538. !     dolist) ;;
  539. !     dump) ;;
  540. !     eval) ;;
  541. !     form) ;;
  542. !     hash) ;;
  543. !     malloc) ;;
  544. !     perl) ;;
  545. !     perly) ;;
  546. !     regcomp) ;;
  547. !     regexec) ;;
  548. !     stab) ;;
  549. !     str) ;;
  550. !     toke) ;;
  551. !     usersub) ;;
  552. !     util) ;;
  553. !     tarray) ;;
  554. !     tcmd) ;;
  555. !     tcons) ;;
  556. !     tconsarg) ;;
  557. !     tdoarg) ;;
  558. !     tdoio) ;;
  559. !     tdolist) ;;
  560. !     tdump) ;;
  561. !     teval) ;;
  562. !     tform) ;;
  563. !     thash) ;;
  564. !     tmalloc) ;;
  565. !     tperl) ;;
  566. !     tperly) ;;
  567. !     tregcomp) ;;
  568. !     tregexec) ;;
  569. !     tstab) ;;
  570. !     tstr) ;;
  571. !     ttoke) ;;
  572. !     tusersub) ;;
  573. !     tutil) ;;
  574.       *) ;;
  575.       esac
  576.   
  577. !     echo "$cc -c $ccflags $optimize $large $split"
  578. !     eval "$also "'"$cc -c $ccflags $optimize $large $split"'
  579. !     . ./config.sh
  580.   done
  581. + !NO!SUBS!
  582. + chmod +x cflags
  583. + $eunicefix cflags
  584.  
  585. Index: x2p/cflags.SH
  586. *** x2p/cflags.SH.old    Fri Jun  7 12:27:53 1991
  587. --- x2p/cflags.SH    Fri Jun  7 12:27:54 1991
  588. ***************
  589. *** 0 ****
  590. --- 1,84 ----
  591. + case $CONFIG in
  592. + '')
  593. +     if test ! -f config.sh; then
  594. +     ln ../config.sh . || \
  595. +     ln ../../config.sh . || \
  596. +     ln ../../../config.sh . || \
  597. +     (echo "Can't find config.sh."; exit 1)
  598. +     fi
  599. +     . config.sh
  600. +     ;;
  601. + esac
  602. + : This forces SH files to create target in same directory as SH file.
  603. + : This is so that make depend always knows where to find SH derivatives.
  604. + case "$0" in
  605. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  606. + esac
  607. + echo "Extracting cflags (with variable substitutions)"
  608. + : This section of the file will have variable substitutions done on it.
  609. + : Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!.
  610. + : Protect any dollar signs and backticks that you do not want interpreted
  611. + : by putting a backslash in front.  You may delete these comments.
  612. + $spitshell >cflags <<!GROK!THIS!
  613. + !GROK!THIS!
  614. + : In the following dollars and backticks do not need the extra backslash.
  615. + $spitshell >>cflags <<'!NO!SUBS!'
  616. + case "$0" in
  617. + */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  618. + esac
  619. + case $CONFIG in
  620. + '')
  621. +     if test ! -f config.sh; then
  622. +     ln ../config.sh . || \
  623. +     ln ../../config.sh . || \
  624. +     ln ../../../config.sh . || \
  625. +     (echo "Can't find config.sh."; exit 1)
  626. +     fi 2>/dev/null
  627. +     . ./config.sh
  628. +     ;;
  629. + esac
  630. + also=': '
  631. + case $# in
  632. + 1) also='echo 1>&2 "      CCCMD = "'
  633. + esac
  634. + case $# in
  635. + 0) set *.c; echo "The current C flags are:" ;;
  636. + esac
  637. + set `echo "$* " | sed 's/\.[oc] / /g'`
  638. + for file do
  639. +     case "$#" in
  640. +     1) ;;
  641. +     *) echo $n "    $file.c    $c" ;;
  642. +     esac
  643. +     : allow variables like str_cflags to be evaluated
  644. +     eval 'eval ${'"${file}_cflags"'-""}'
  645. +     : or customize here
  646. +     case "$file" in
  647. +     a2p) ;;
  648. +     a2py) ;;
  649. +     hash) ;;
  650. +     str) ;;
  651. +     util) ;;
  652. +     walk) ;;
  653. +     *) ;;
  654. +     esac
  655. +     echo "$cc -c $ccflags $optimize $large $split"
  656. +     eval "$also "'"$cc -c $ccflags $optimize $large $split"'
  657. +     . ./config.sh
  658. + done
  659. + !NO!SUBS!
  660. + chmod +x cflags
  661. + $eunicefix cflags
  662.  
  663. Index: msdos/chdir.c
  664. *** msdos/chdir.c.old    Fri Jun  7 12:25:32 1991
  665. --- msdos/chdir.c    Fri Jun  7 12:25:33 1991
  666. ***************
  667. *** 1,8 ****
  668.   /*
  669.    *    (C) Copyright 1990, 1991 Tom Dinger
  670.    *
  671. !  *    You may distribute under the terms of the GNU General Public License
  672. !  *    as specified in the README file that comes with the perl 4.0 kit.
  673.    *
  674.    */
  675.   
  676. --- 1,8 ----
  677.   /*
  678.    *    (C) Copyright 1990, 1991 Tom Dinger
  679.    *
  680. !  *    You may distribute under the terms of either the GNU General Public
  681. !  *    License or the Artistic License, as specified in the README file.
  682.    *
  683.    */
  684.   
  685.  
  686. Index: cmd.c
  687. *** cmd.c.old    Fri Jun  7 12:22:53 1991
  688. --- cmd.c    Fri Jun  7 12:22:55 1991
  689. ***************
  690. *** 1,11 ****
  691. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:36:16 $
  692.    *
  693. !  *    Copyright (c) 1989, Larry Wall
  694.    *
  695. !  *    You may distribute under the terms of the GNU General Public License
  696. !  *    as specified in the README file that comes with the perl 3.0 kit.
  697.    *
  698.    * $Log:    cmd.c,v $
  699.    * Revision 4.0.1.1  91/04/11  17:36:16  lwall
  700.    * patch1: you may now use "die" and "caller" in a signal handler
  701.    * 
  702. --- 1,15 ----
  703. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:26:45 $
  704.    *
  705. !  *    Copyright (c) 1991, Larry Wall
  706.    *
  707. !  *    You may distribute under the terms of either the GNU General Public
  708. !  *    License or the Artistic License, as specified in the README file.
  709.    *
  710.    * $Log:    cmd.c,v $
  711. +  * Revision 4.0.1.2  91/06/07  10:26:45  lwall
  712. +  * patch4: new copyright notice
  713. +  * patch4: made some allowances for "semi-standard" C
  714. +  * 
  715.    * Revision 4.0.1.1  91/04/11  17:36:16  lwall
  716.    * patch1: you may now use "die" and "caller" in a signal handler
  717.    * 
  718. ***************
  719. *** 27,33 ****
  720.   
  721.   /* do longjmps() clobber register variables? */
  722.   
  723. ! #if defined(cray) || defined(__STDC__)
  724.   #define JMPCLOBBER
  725.   #endif
  726.   
  727. --- 31,37 ----
  728.   
  729.   /* do longjmps() clobber register variables? */
  730.   
  731. ! #if defined(cray) || defined(STANDARD_C)
  732.   #define JMPCLOBBER
  733.   #endif
  734.   
  735.  
  736. Index: cmd.h
  737. Prereq: 4.0
  738. *** cmd.h.old    Fri Jun  7 12:22:58 1991
  739. --- cmd.h    Fri Jun  7 12:22:59 1991
  740. ***************
  741. *** 1,11 ****
  742. ! /* $Header: cmd.h,v 4.0 91/03/20 01:04:34 lwall Locked $
  743.    *
  744. !  *    Copyright (c) 1989, Larry Wall
  745.    *
  746. !  *    You may distribute under the terms of the GNU General Public License
  747. !  *    as specified in the README file that comes with the perl 3.0 kit.
  748.    *
  749.    * $Log:    cmd.h,v $
  750.    * Revision 4.0  91/03/20  01:04:34  lwall
  751.    * 4.0 baseline.
  752.    * 
  753. --- 1,15 ----
  754. ! /* $RCSfile: cmd.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:28:50 $
  755.    *
  756. !  *    Copyright (c) 1991, Larry Wall
  757.    *
  758. !  *    You may distribute under the terms of either the GNU General Public
  759. !  *    License or the Artistic License, as specified in the README file.
  760.    *
  761.    * $Log:    cmd.h,v $
  762. +  * Revision 4.0.1.1  91/06/07  10:28:50  lwall
  763. +  * patch4: new copyright notice
  764. +  * patch4: length($`), length($&), length($') now optimized to avoid string copy
  765. +  * 
  766.    * Revision 4.0  91/03/20  01:04:34  lwall
  767.    * 4.0 baseline.
  768.    * 
  769. ***************
  770. *** 161,165 ****
  771.   };
  772.   
  773.   void opt_arg();
  774. ! void evalstatic();
  775.   int cmd_exec();
  776. --- 165,169 ----
  777.   };
  778.   
  779.   void opt_arg();
  780. ! ARG* evalstatic();
  781.   int cmd_exec();
  782.  
  783. Index: config.H
  784. *** config.H.old    Fri Jun  7 12:23:01 1991
  785. --- config.H    Fri Jun  7 12:23:02 1991
  786. ***************
  787. *** 29,35 ****
  788.    *    This symbol contains the number of bytes required to align a double.
  789.    *    Usual values are 2, 4, and 8.
  790.    */
  791. ! #define ALIGNBYTES 4        /**/
  792.   
  793.   /* BIN
  794.    *    This symbol holds the name of the directory in which the user wants
  795. --- 29,35 ----
  796.    *    This symbol contains the number of bytes required to align a double.
  797.    *    Usual values are 2, 4, and 8.
  798.    */
  799. ! #define ALIGNBYTES 2        /**/
  800.   
  801.   /* BIN
  802.    *    This symbol holds the name of the directory in which the user wants
  803. ***************
  804. *** 42,48 ****
  805.    *    This symbol contains an encoding of the order of bytes in a long.
  806.    *    Usual values (in octal) are 01234, 04321, 02143, 03412...
  807.    */
  808. ! #define BYTEORDER 0x1234        /**/
  809.   
  810.   /* CPPSTDIN
  811.    *    This symbol contains the first part of the string which will invoke
  812. --- 42,48 ----
  813.    *    This symbol contains an encoding of the order of bytes in a long.
  814.    *    Usual values (in octal) are 01234, 04321, 02143, 03412...
  815.    */
  816. ! #define BYTEORDER 0x4321        /**/
  817.   
  818.   /* CPPSTDIN
  819.    *    This symbol contains the first part of the string which will invoke
  820. ***************
  821. *** 55,62 ****
  822.    *    output.  This symbol will have the value "-" if CPPSTDIN needs a minus
  823.    *    to specify standard input, otherwise the value is "".
  824.    */
  825. ! #define CPPSTDIN "cc -E"
  826. ! #define CPPMINUS "-"
  827.   
  828.   /* HAS_BCMP
  829.    *    This symbol, if defined, indicates that the bcmp routine is available
  830. --- 55,62 ----
  831.    *    output.  This symbol will have the value "-" if CPPSTDIN needs a minus
  832.    *    to specify standard input, otherwise the value is "".
  833.    */
  834. ! #define CPPSTDIN "/usr/lib/cpp"
  835. ! #define CPPMINUS ""
  836.   
  837.   /* HAS_BCMP
  838.    *    This symbol, if defined, indicates that the bcmp routine is available
  839. ***************
  840. *** 89,96 ****
  841.    *        1 = couldn't cast < 0
  842.    *        2 = couldn't cast >= 0x80000000
  843.    */
  844. ! #define    CASTNEGFLOAT    /**/
  845. ! #define    CASTFLAGS 0    /**/
  846.   
  847.   /* CHARSPRINTF
  848.    *    This symbol is defined if this system declares "char *sprintf()" in
  849. --- 89,96 ----
  850.    *        1 = couldn't cast < 0
  851.    *        2 = couldn't cast >= 0x80000000
  852.    */
  853. ! /*#undef    CASTNEGFLOAT    /**/
  854. ! #define    CASTFLAGS 1    /**/
  855.   
  856.   /* CHARSPRINTF
  857.    *    This symbol is defined if this system declares "char *sprintf()" in
  858. ***************
  859. *** 180,186 ****
  860.    *    This symbol, if defined, indicates that the gethostent() routine is
  861.    *    available to lookup host names in some data base or other.
  862.    */
  863. ! #define    HAS_GETHOSTENT        /**/
  864.   
  865.   /* HAS_GETPGRP
  866.    *    This symbol, if defined, indicates that the getpgrp() routine is
  867. --- 180,186 ----
  868.    *    This symbol, if defined, indicates that the gethostent() routine is
  869.    *    available to lookup host names in some data base or other.
  870.    */
  871. ! /*#undef    HAS_GETHOSTENT        /**/
  872.   
  873.   /* HAS_GETPGRP
  874.    *    This symbol, if defined, indicates that the getpgrp() routine is
  875. ***************
  876. *** 439,446 ****
  877. --- 439,452 ----
  878.    *    This symbol, if defined, indicates that the shmat() routine is
  879.    *    available to stat symbolic links.
  880.    */
  881. + /* VOID_SHMAT
  882. +  *    This symbol, if defined, indicates that the shmat() routine
  883. +  *    returns a pointer of type void*.
  884. +  */
  885.   #define    HAS_SHMAT        /**/
  886.   
  887. + /*#undef    VOIDSHMAT        /**/
  888.   /* HAS_SHMCTL
  889.    *    This symbol, if defined, indicates that the shmctl() routine is
  890.    *    available to stat symbolic links.
  891. ***************
  892. *** 537,544 ****
  893.    *    a signal handler using "TO_SIGNAL (*handler())()", and define the
  894.    *    handler using "TO_SIGNAL handler(sig)".
  895.    */
  896. ! /*#undef    VOIDSIG     /**/
  897. ! #define    TO_SIGNAL         /**/
  898.   
  899.   /* HASVOLATILE
  900.    *    This symbol, if defined, indicates that this C compiler knows about
  901. --- 543,550 ----
  902.    *    a signal handler using "TO_SIGNAL (*handler())()", and define the
  903.    *    handler using "TO_SIGNAL handler(sig)".
  904.    */
  905. ! #define    VOIDSIG     /**/
  906. ! #define    TO_SIGNAL    int     /**/
  907.   
  908.   /* HASVOLATILE
  909.    *    This symbol, if defined, indicates that this C compiler knows about
  910. ***************
  911. *** 557,564 ****
  912.    *    is up to the package author to declare vsprintf correctly based on the
  913.    *    symbol.
  914.    */
  915. ! /*#undef    HAS_VPRINTF    /**/
  916. ! /*#undef    CHARVSPRINTF     /**/
  917.   
  918.   /* HAS_WAIT4
  919.    *    This symbol, if defined, indicates that wait4() exists.
  920. --- 563,570 ----
  921.    *    is up to the package author to declare vsprintf correctly based on the
  922.    *    symbol.
  923.    */
  924. ! #define    HAS_VPRINTF    /**/
  925. ! #define    CHARVSPRINTF     /**/
  926.   
  927.   /* HAS_WAIT4
  928.    *    This symbol, if defined, indicates that wait4() exists.
  929. ***************
  930. *** 568,581 ****
  931.   /* HAS_WAITPID
  932.    *    This symbol, if defined, indicates that waitpid() exists.
  933.    */
  934. ! /*#undef    HAS_WAITPID    /**/
  935.   
  936.   /* GIDTYPE
  937.    *    This symbol has a value like gid_t, int, ushort, or whatever type is
  938.    *    used to declare group ids in the kernel.
  939.    */
  940. ! #define GIDTYPE int        /**/
  941.   
  942.   /* I_FCNTL
  943.    *    This manifest constant tells the C program to include <fcntl.h>.
  944.    */
  945. --- 574,593 ----
  946.   /* HAS_WAITPID
  947.    *    This symbol, if defined, indicates that waitpid() exists.
  948.    */
  949. ! #define    HAS_WAITPID    /**/
  950.   
  951.   /* GIDTYPE
  952.    *    This symbol has a value like gid_t, int, ushort, or whatever type is
  953.    *    used to declare group ids in the kernel.
  954.    */
  955. ! #define GIDTYPE gid_t        /**/
  956.   
  957. + /* GROUPSTYPE
  958. +  *    This symbol has a value like gid_t, int, ushort, or whatever type is
  959. +  *    used in the return value of getgroups().
  960. +  */
  961. + #define GROUPSTYPE int        /**/
  962.   /* I_FCNTL
  963.    *    This manifest constant tells the C program to include <fcntl.h>.
  964.    */
  965. ***************
  966. *** 634,644 ****
  967.    */
  968.   #define    I_PWD        /**/
  969.   /*#undef    PWQUOTA        /**/
  970. ! /*#undef    PWAGE        /**/
  971.   /*#undef    PWCHANGE    /**/
  972.   /*#undef    PWCLASS        /**/
  973.   /*#undef    PWEXPIRE    /**/
  974. ! /*#undef    PWCOMMENT    /**/
  975.   
  976.   /* I_SYS_FILE
  977.    *    This manifest constant tells the C program to include <sys/file.h>.
  978. --- 646,656 ----
  979.    */
  980.   #define    I_PWD        /**/
  981.   /*#undef    PWQUOTA        /**/
  982. ! #define    PWAGE        /**/
  983.   /*#undef    PWCHANGE    /**/
  984.   /*#undef    PWCLASS        /**/
  985.   /*#undef    PWEXPIRE    /**/
  986. ! #define    PWCOMMENT    /**/
  987.   
  988.   /* I_SYS_FILE
  989.    *    This manifest constant tells the C program to include <sys/file.h>.
  990. ***************
  991. *** 673,679 ****
  992.    *    This symbol, if defined, indicates to the C program that it should
  993.    *    include utime.h.
  994.    */
  995. ! /*#undef    I_UTIME        /**/
  996.   
  997.   /* I_VARARGS
  998.    *    This symbol, if defined, indicates to the C program that it should
  999. --- 685,691 ----
  1000.    *    This symbol, if defined, indicates to the C program that it should
  1001.    *    include utime.h.
  1002.    */
  1003. ! #define    I_UTIME        /**/
  1004.   
  1005.   /* I_VARARGS
  1006.    *    This symbol, if defined, indicates to the C program that it should
  1007. ***************
  1008. *** 685,691 ****
  1009.    *    This symbol, if defined, indicates to the C program that it should
  1010.    *    include vfork.h.
  1011.    */
  1012. ! /*#undef    I_VFORK        /**/
  1013.   
  1014.   /* INTSIZE
  1015.    *    This symbol contains the size of an int, so that the C preprocessor
  1016. --- 697,703 ----
  1017.    *    This symbol, if defined, indicates to the C program that it should
  1018.    *    include vfork.h.
  1019.    */
  1020. ! #define    I_VFORK        /**/
  1021.   
  1022.   /* INTSIZE
  1023.    *    This symbol contains the size of an int, so that the C preprocessor
  1024. ***************
  1025. *** 725,731 ****
  1026. --- 737,748 ----
  1027.   /*#undef    I_MY_DIR    /**/
  1028.   /*#undef    DIRNAMLEN    /**/
  1029.   
  1030. + /* MALLOCPTRTYPE
  1031. +  *    This symbol defines the kind of ptr returned by malloc and realloc.
  1032. +  */
  1033. + #define MALLOCPTRTYPE char         /**/
  1034.   
  1035.   /* RANDBITS
  1036.    *    This symbol contains the number of bits of random number the rand()
  1037.    *    function produces.  Usual values are 15, 16, and 31.
  1038. ***************
  1039. *** 734,740 ****
  1040.   
  1041.   /* SCRIPTDIR
  1042.    *    This symbol holds the name of the directory in which the user wants
  1043. !  *    to put publicly executable scripts for the package in question.  It
  1044.    *    is often a directory that is mounted across diverse architectures.
  1045.    */
  1046.   #define SCRIPTDIR "/usr/local/bin"             /**/
  1047. --- 751,757 ----
  1048.   
  1049.   /* SCRIPTDIR
  1050.    *    This symbol holds the name of the directory in which the user wants
  1051. !  *    to keep publicly executable scripts for the package in question.  It
  1052.    *    is often a directory that is mounted across diverse architectures.
  1053.    */
  1054.   #define SCRIPTDIR "/usr/local/bin"             /**/
  1055. ***************
  1056. *** 742,754 ****
  1057.   /* SIG_NAME
  1058.    *    This symbol contains an list of signal names in order.
  1059.    */
  1060. ! #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","URG","STOP","TSTP","CONT","CHLD","TTIN","TTOU","IO","XCPU","XFSZ","VTALRM","PROF","WINCH","LOST","USR1","USR2"        /**/
  1061.   
  1062.   /* STDCHAR
  1063.    *    This symbol is defined to be the type of char used in stdio.h.
  1064.    *    It has the values "unsigned char" or "char".
  1065.    */
  1066. ! #define STDCHAR char    /**/
  1067.   
  1068.   /* UIDTYPE
  1069.    *    This symbol has a value like uid_t, int, ushort, or whatever type is
  1070. --- 759,771 ----
  1071.   /* SIG_NAME
  1072.    *    This symbol contains an list of signal names in order.
  1073.    */
  1074. ! #define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","ABRT","EMT","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","URG","STOP","TSTP","CONT","CLD","TTIN","TTOU","IO","XCPU","XFSZ","VTALRM","PROF","WINCH","LOST","USR1","USR2"        /**/
  1075.   
  1076.   /* STDCHAR
  1077.    *    This symbol is defined to be the type of char used in stdio.h.
  1078.    *    It has the values "unsigned char" or "char".
  1079.    */
  1080. ! #define STDCHAR unsigned char    /**/
  1081.   
  1082.   /* UIDTYPE
  1083.    *    This symbol has a value like uid_t, int, ushort, or whatever type is
  1084. ***************
  1085. *** 788,796 ****
  1086.    *    its value is "char *".
  1087.    */
  1088.   #ifndef VOIDWANT
  1089. ! #define VOIDWANT 1
  1090.   #endif
  1091. ! #define VOIDHAVE 1
  1092.   #if (VOIDHAVE & VOIDWANT) != VOIDWANT
  1093.   #define void int        /* is void to be avoided? */
  1094.   #define VOID
  1095. --- 805,813 ----
  1096.    *    its value is "char *".
  1097.    */
  1098.   #ifndef VOIDWANT
  1099. ! #define VOIDWANT 7
  1100.   #endif
  1101. ! #define VOIDHAVE 7
  1102.   #if (VOIDHAVE & VOIDWANT) != VOIDWANT
  1103.   #define void int        /* is void to be avoided? */
  1104.   #define VOID
  1105.  
  1106. Index: msdos/config.h
  1107. *** msdos/config.h.old    Fri Jun  7 12:25:35 1991
  1108. --- msdos/config.h    Fri Jun  7 12:25:36 1991
  1109. ***************
  1110. *** 43,49 ****
  1111.   
  1112.   /* BIN
  1113.    *    This symbol holds the name of the directory in which the user wants
  1114. !  *    to put publicly executable images for the package in question.  It
  1115.    *    is most often a local directory such as /usr/local/bin.
  1116.    */
  1117.   #define BIN "/usr/local/bin"             /**/
  1118. --- 43,49 ----
  1119.   
  1120.   /* BIN
  1121.    *    This symbol holds the name of the directory in which the user wants
  1122. !  *    to keep publicly executable images for the package in question.  It
  1123.    *    is most often a local directory such as /usr/local/bin.
  1124.    */
  1125.   #define BIN "/usr/local/bin"             /**/
  1126. ***************
  1127. *** 590,600 ****
  1128. --- 590,612 ----
  1129.    */
  1130.   #define GIDTYPE int        /**/
  1131.   
  1132. + /* GROUPSTYPE
  1133. +  *    This symbol has a value like gid_t, int, ushort, or whatever type is
  1134. +  *    used in the return value of getgroups().
  1135. +  */
  1136. + #define GROUPSTYPE int        /**/
  1137.   /* I_FCNTL
  1138.    *    This manifest constant tells the C program to include <fcntl.h>.
  1139.    */
  1140.   #define    I_FCNTL    /**/
  1141.   
  1142. + /* I_GDBM
  1143. +  *    This symbol, if defined, indicates that gdbm.h exists and should
  1144. +  *    be included.
  1145. +  */
  1146. + /*#undef    I_GDBM        /**/
  1147.   /* I_GRP
  1148.    *    This symbol, if defined, indicates to the C program that it should
  1149.    *    include grp.h.
  1150. ***************
  1151. *** 733,738 ****
  1152. --- 745,754 ----
  1153.   /*#undef    I_MY_DIR    /**/
  1154.   /*#undef    DIRNAMLEN    /**/
  1155.   
  1156. + /* MALLOCPTRTYPE
  1157. +  *    This symbol defines the kind of ptr returned by malloc and realloc.
  1158. +  */
  1159. + #define MALLOCPTRTYPE void         /**/
  1160.   
  1161.   /* RANDBITS
  1162.    *    This symbol contains the number of bits of random number the rand()
  1163.  
  1164. Index: config_h.SH
  1165. *** config_h.SH.old    Fri Jun  7 12:23:06 1991
  1166. --- config_h.SH    Fri Jun  7 12:23:07 1991
  1167. ***************
  1168. *** 454,461 ****
  1169. --- 454,467 ----
  1170.    *    This symbol, if defined, indicates that the shmat() routine is
  1171.    *    available to stat symbolic links.
  1172.    */
  1173. + /* VOID_SHMAT
  1174. +  *    This symbol, if defined, indicates that the shmat() routine
  1175. +  *    returns a pointer of type void*.
  1176. +  */
  1177.   #$d_shmat    HAS_SHMAT        /**/
  1178.   
  1179. + #$d_voidshmat    VOIDSHMAT        /**/
  1180.   /* HAS_SHMCTL
  1181.    *    This symbol, if defined, indicates that the shmctl() routine is
  1182.    *    available to stat symbolic links.
  1183. ***************
  1184. *** 760,766 ****
  1185.   
  1186.   /* SCRIPTDIR
  1187.    *    This symbol holds the name of the directory in which the user wants
  1188. !  *    to put publicly executable scripts for the package in question.  It
  1189.    *    is often a directory that is mounted across diverse architectures.
  1190.    */
  1191.   #define SCRIPTDIR "$scriptdir"             /**/
  1192. --- 766,772 ----
  1193.   
  1194.   /* SCRIPTDIR
  1195.    *    This symbol holds the name of the directory in which the user wants
  1196. !  *    to keep publicly executable scripts for the package in question.  It
  1197.    *    is often a directory that is mounted across diverse architectures.
  1198.    */
  1199.   #define SCRIPTDIR "$scriptdir"             /**/
  1200.  
  1201. Index: cons.c
  1202. Prereq: 4.0
  1203. *** cons.c.old    Fri Jun  7 12:23:11 1991
  1204. --- cons.c    Fri Jun  7 12:23:12 1991
  1205. ***************
  1206. *** 1,11 ****
  1207. ! /* $Header: cons.c,v 4.0 91/03/20 01:05:51 lwall Locked $
  1208.    *
  1209. !  *    Copyright (c) 1989, Larry Wall
  1210.    *
  1211. !  *    You may distribute under the terms of the GNU General Public License
  1212. !  *    as specified in the README file that comes with the perl 3.0 kit.
  1213.    *
  1214.    * $Log:    cons.c,v $
  1215.    * Revision 4.0  91/03/20  01:05:51  lwall
  1216.    * 4.0 baseline.
  1217.    * 
  1218. --- 1,15 ----
  1219. ! /* $RCSfile: cons.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:31:15 $
  1220.    *
  1221. !  *    Copyright (c) 1991, Larry Wall
  1222.    *
  1223. !  *    You may distribute under the terms of either the GNU General Public
  1224. !  *    License or the Artistic License, as specified in the README file.
  1225.    *
  1226.    * $Log:    cons.c,v $
  1227. +  * Revision 4.0.1.1  91/06/07  10:31:15  lwall
  1228. +  * patch4: new copyright notice
  1229. +  * patch4: added global modifier for pattern matches
  1230. +  * 
  1231.    * Revision 4.0  91/03/20  01:05:51  lwall
  1232.    * 4.0 baseline.
  1233.    * 
  1234. ***************
  1235. *** 676,682 ****
  1236.            arg->arg_type == O_NMATCH || arg->arg_type == O_NSUBST) {
  1237.       if ((arg[1].arg_type == A_STAB || arg[1].arg_type == A_LVAL) &&
  1238.           (arg[2].arg_type & A_MASK) == A_SPAT &&
  1239. !         arg[2].arg_ptr.arg_spat->spat_short ) {
  1240.           cmd->c_stab  = arg[1].arg_ptr.arg_stab;
  1241.           cmd->c_short = str_smake(arg[2].arg_ptr.arg_spat->spat_short);
  1242.           cmd->c_slen  = arg[2].arg_ptr.arg_spat->spat_slen;
  1243. --- 680,688 ----
  1244.            arg->arg_type == O_NMATCH || arg->arg_type == O_NSUBST) {
  1245.       if ((arg[1].arg_type == A_STAB || arg[1].arg_type == A_LVAL) &&
  1246.           (arg[2].arg_type & A_MASK) == A_SPAT &&
  1247. !         arg[2].arg_ptr.arg_spat->spat_short &&
  1248. !         (arg->arg_type == O_SUBST || arg->arg_type == O_NSUBST ||
  1249. !          (arg[2].arg_ptr.arg_spat->spat_flags & SPAT_GLOBAL) == 0 )) {
  1250.           cmd->c_stab  = arg[1].arg_ptr.arg_stab;
  1251.           cmd->c_short = str_smake(arg[2].arg_ptr.arg_spat->spat_short);
  1252.           cmd->c_slen  = arg[2].arg_ptr.arg_spat->spat_slen;
  1253.  
  1254. Index: consarg.c
  1255. *** consarg.c.old    Fri Jun  7 12:23:16 1991
  1256. --- consarg.c    Fri Jun  7 12:23:17 1991
  1257. ***************
  1258. *** 1,11 ****
  1259. ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:38:34 $
  1260.    *
  1261. !  *    Copyright (c) 1989, Larry Wall
  1262.    *
  1263. !  *    You may distribute under the terms of the GNU General Public License
  1264. !  *    as specified in the README file that comes with the perl 3.0 kit.
  1265.    *
  1266.    * $Log:    consarg.c,v $
  1267.    * Revision 4.0.1.1  91/04/11  17:38:34  lwall
  1268.    * patch1: fixed "Bad free" error
  1269.    * 
  1270. --- 1,15 ----
  1271. ! /* $RCSfile: consarg.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:33:12 $
  1272.    *
  1273. !  *    Copyright (c) 1991, Larry Wall
  1274.    *
  1275. !  *    You may distribute under the terms of either the GNU General Public
  1276. !  *    License or the Artistic License, as specified in the README file.
  1277.    *
  1278.    * $Log:    consarg.c,v $
  1279. +  * Revision 4.0.1.2  91/06/07  10:33:12  lwall
  1280. +  * patch4: new copyright notice
  1281. +  * patch4: length($`), length($&), length($') now optimized to avoid string copy
  1282. +  * 
  1283.    * Revision 4.0.1.1  91/04/11  17:38:34  lwall
  1284.    * patch1: fixed "Bad free" error
  1285.    * 
  1286. ***************
  1287. *** 254,268 ****
  1288.       fprintf(stderr,")\n");
  1289.       }
  1290.   #endif
  1291. !     evalstatic(arg);        /* see if we can consolidate anything */
  1292.       return arg;
  1293.   }
  1294.   
  1295. ! void
  1296.   evalstatic(arg)
  1297.   register ARG *arg;
  1298.   {
  1299. !     register STR *str;
  1300.       register STR *s1;
  1301.       register STR *s2;
  1302.       double value;        /* must not be register */
  1303. --- 258,272 ----
  1304.       fprintf(stderr,")\n");
  1305.       }
  1306.   #endif
  1307. !     arg = evalstatic(arg);    /* see if we can consolidate anything */
  1308.       return arg;
  1309.   }
  1310.   
  1311. ! ARG *
  1312.   evalstatic(arg)
  1313.   register ARG *arg;
  1314.   {
  1315. !     static STR *str = Nullstr;
  1316.       register STR *s1;
  1317.       register STR *s2;
  1318.       double value;        /* must not be register */
  1319. ***************
  1320. *** 275,571 ****
  1321.       double sin(), cos(), atan2(), pow();
  1322.   
  1323.       if (!arg || !arg->arg_len)
  1324. !     return;
  1325.   
  1326. !     if ((arg[1].arg_type == A_SINGLE || arg->arg_type == O_AELEM) &&
  1327. !     (arg->arg_len == 1 || arg[2].arg_type == A_SINGLE) ) {
  1328.       str = Str_new(20,0);
  1329.       s1 = arg[1].arg_ptr.arg_str;
  1330. !     if (arg->arg_len > 1)
  1331. !         s2 = arg[2].arg_ptr.arg_str;
  1332.       else
  1333. -         s2 = Nullstr;
  1334. -     switch (arg->arg_type) {
  1335. -     case O_AELEM:
  1336. -         i = (int)str_gnum(s2);
  1337. -         if (i < 32767 && i >= 0) {
  1338. -         arg->arg_type = O_ITEM;
  1339. -         arg->arg_len = 1;
  1340. -         arg[1].arg_type = A_ARYSTAB;    /* $abc[123] is hoistable now */
  1341. -         arg[1].arg_len = i;
  1342. -         str_free(s2);
  1343. -         arg[2].arg_type = A_NULL;
  1344. -         arg[2].arg_ptr.arg_str = Nullstr;
  1345. -         }
  1346. -         /* FALL THROUGH */
  1347. -     default:
  1348. -         str_free(str);
  1349. -         str = Nullstr;        /* can't be evaluated yet */
  1350. -         break;
  1351. -     case O_CONCAT:
  1352. -         str_sset(str,s1);
  1353. -         str_scat(str,s2);
  1354. -         break;
  1355. -     case O_REPEAT:
  1356. -         i = (int)str_gnum(s2);
  1357. -         tmps = str_get(s1);
  1358. -         str_nset(str,"",0);
  1359. -         STR_GROW(str, i * s1->str_cur + 1);
  1360. -         repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
  1361. -         str->str_cur = i * s1->str_cur;
  1362. -         str->str_ptr[str->str_cur] = '\0';
  1363. -         break;
  1364. -     case O_MULTIPLY:
  1365. -         value = str_gnum(s1);
  1366. -         str_numset(str,value * str_gnum(s2));
  1367. -         break;
  1368. -     case O_DIVIDE:
  1369. -         value = str_gnum(s2);
  1370. -         if (value == 0.0)
  1371. -         yyerror("Illegal division by constant zero");
  1372. -         else
  1373.   #ifdef cray
  1374. !         /* insure that 20./5. == 4. */
  1375. !         {
  1376. !         double x;
  1377. !         int    k;
  1378. !         x =  str_gnum(s1);
  1379. !         if ((double)(int)x     == x &&
  1380. !             (double)(int)value == value &&
  1381. !             (k = (int)x/(int)value)*(int)value == (int)x) {
  1382. !             value = k;
  1383. !         } else {
  1384. !             value = x/value;
  1385. !         }
  1386. !         str_numset(str,value);
  1387.           }
  1388.   #else
  1389. !         str_numset(str,str_gnum(s1) / value);
  1390.   #endif
  1391. !         break;
  1392. !     case O_MODULO:
  1393. !         tmplong = (unsigned long)str_gnum(s2);
  1394. !         if (tmplong == 0L) {
  1395. !         yyerror("Illegal modulus of constant zero");
  1396. !         break;
  1397. !         }
  1398. !         tmp2 = (long)str_gnum(s1);
  1399.   #ifndef lint
  1400. !         if (tmp2 >= 0)
  1401. !         str_numset(str,(double)(tmp2 % tmplong));
  1402. !         else
  1403. !         str_numset(str,(double)((tmplong-((-tmp2 - 1) % tmplong)) - 1));
  1404.   #else
  1405. !         tmp2 = tmp2;
  1406.   #endif
  1407. !         break;
  1408. !     case O_ADD:
  1409. !         value = str_gnum(s1);
  1410. !         str_numset(str,value + str_gnum(s2));
  1411. !         break;
  1412. !     case O_SUBTRACT:
  1413. !         value = str_gnum(s1);
  1414. !         str_numset(str,value - str_gnum(s2));
  1415. !         break;
  1416. !     case O_LEFT_SHIFT:
  1417. !         value = str_gnum(s1);
  1418. !         i = (int)str_gnum(s2);
  1419.   #ifndef lint
  1420. !         str_numset(str,(double)(((long)value) << i));
  1421.   #endif
  1422. !         break;
  1423. !     case O_RIGHT_SHIFT:
  1424. !         value = str_gnum(s1);
  1425. !         i = (int)str_gnum(s2);
  1426.   #ifndef lint
  1427. !         str_numset(str,(double)(((long)value) >> i));
  1428.   #endif
  1429. !         break;
  1430. !     case O_LT:
  1431. !         value = str_gnum(s1);
  1432. !         str_numset(str,(value < str_gnum(s2)) ? 1.0 : 0.0);
  1433. !         break;
  1434. !     case O_GT:
  1435. !         value = str_gnum(s1);
  1436. !         str_numset(str,(value > str_gnum(s2)) ? 1.0 : 0.0);
  1437. !         break;
  1438. !     case O_LE:
  1439. !         value = str_gnum(s1);
  1440. !         str_numset(str,(value <= str_gnum(s2)) ? 1.0 : 0.0);
  1441. !         break;
  1442. !     case O_GE:
  1443. !         value = str_gnum(s1);
  1444. !         str_numset(str,(value >= str_gnum(s2)) ? 1.0 : 0.0);
  1445. !         break;
  1446. !     case O_EQ:
  1447. !         if (dowarn) {
  1448. !         if ((!s1->str_nok && !looks_like_number(s1)) ||
  1449. !             (!s2->str_nok && !looks_like_number(s2)) )
  1450. !             warn("Possible use of == on string value");
  1451. !         }
  1452. !         value = str_gnum(s1);
  1453. !         str_numset(str,(value == str_gnum(s2)) ? 1.0 : 0.0);
  1454. !         break;
  1455. !     case O_NE:
  1456. !         value = str_gnum(s1);
  1457. !         str_numset(str,(value != str_gnum(s2)) ? 1.0 : 0.0);
  1458. !         break;
  1459. !     case O_NCMP:
  1460. !         value = str_gnum(s1);
  1461. !         value -= str_gnum(s2);
  1462. !         if (value > 0.0)
  1463. !         value = 1.0;
  1464. !         else if (value < 0.0)
  1465. !         value = -1.0;
  1466. !         str_numset(str,value);
  1467. !         break;
  1468. !     case O_BIT_AND:
  1469. !         value = str_gnum(s1);
  1470.   #ifndef lint
  1471. !         str_numset(str,(double)(U_L(value) & U_L(str_gnum(s2))));
  1472.   #endif
  1473. !         break;
  1474. !     case O_XOR:
  1475. !         value = str_gnum(s1);
  1476.   #ifndef lint
  1477. !         str_numset(str,(double)(U_L(value) ^ U_L(str_gnum(s2))));
  1478.   #endif
  1479. !         break;
  1480. !     case O_BIT_OR:
  1481. !         value = str_gnum(s1);
  1482.   #ifndef lint
  1483. !         str_numset(str,(double)(U_L(value) | U_L(str_gnum(s2))));
  1484.   #endif
  1485. !         break;
  1486. !     case O_AND:
  1487. !         if (str_true(s1))
  1488. !         str_sset(str,s2);
  1489. !         else
  1490. !         str_sset(str,s1);
  1491. !         break;
  1492. !     case O_OR:
  1493. !         if (str_true(s1))
  1494. !         str_sset(str,s1);
  1495. !         else
  1496. !         str_sset(str,s2);
  1497. !         break;
  1498. !     case O_COND_EXPR:
  1499. !         if ((arg[3].arg_type & A_MASK) != A_SINGLE) {
  1500. !         str_free(str);
  1501. !         str = Nullstr;
  1502. !         }
  1503. !         else {
  1504. !         if (str_true(s1))
  1505. !             str_sset(str,s2);
  1506. !         else
  1507. !             str_sset(str,arg[3].arg_ptr.arg_str);
  1508. !         str_free(arg[3].arg_ptr.arg_str);
  1509. !         arg[3].arg_ptr.arg_str = Nullstr;
  1510. !         }
  1511. !         break;
  1512. !     case O_NEGATE:
  1513. !         str_numset(str,(double)(-str_gnum(s1)));
  1514. !         break;
  1515. !     case O_NOT:
  1516. !         str_numset(str,(double)(!str_true(s1)));
  1517. !         break;
  1518. !     case O_COMPLEMENT:
  1519.   #ifndef lint
  1520. !         str_numset(str,(double)(~U_L(str_gnum(s1))));
  1521.   #endif
  1522. !         break;
  1523. !     case O_SIN:
  1524. !         str_numset(str,sin(str_gnum(s1)));
  1525. !         break;
  1526. !     case O_COS:
  1527. !         str_numset(str,cos(str_gnum(s1)));
  1528. !         break;
  1529. !     case O_ATAN2:
  1530. !         value = str_gnum(s1);
  1531. !         str_numset(str,atan2(value, str_gnum(s2)));
  1532. !         break;
  1533. !     case O_POW:
  1534. !         value = str_gnum(s1);
  1535. !         str_numset(str,pow(value, str_gnum(s2)));
  1536. !         break;
  1537. !     case O_LENGTH:
  1538. !         str_numset(str, (double)str_len(s1));
  1539. !         break;
  1540. !     case O_SLT:
  1541. !         str_numset(str,(double)(str_cmp(s1,s2) < 0));
  1542. !         break;
  1543. !     case O_SGT:
  1544. !         str_numset(str,(double)(str_cmp(s1,s2) > 0));
  1545. !         break;
  1546. !     case O_SLE:
  1547. !         str_numset(str,(double)(str_cmp(s1,s2) <= 0));
  1548. !         break;
  1549. !     case O_SGE:
  1550. !         str_numset(str,(double)(str_cmp(s1,s2) >= 0));
  1551. !         break;
  1552. !     case O_SEQ:
  1553. !         str_numset(str,(double)(str_eq(s1,s2)));
  1554. !         break;
  1555. !     case O_SNE:
  1556. !         str_numset(str,(double)(!str_eq(s1,s2)));
  1557. !         break;
  1558. !     case O_SCMP:
  1559. !         str_numset(str,(double)(str_cmp(s1,s2)));
  1560. !         break;
  1561. !     case O_CRYPT:
  1562.   #ifdef HAS_CRYPT
  1563. !         tmps = str_get(s1);
  1564. !         str_set(str,crypt(tmps,str_get(s2)));
  1565.   #else
  1566. !         yyerror(
  1567. !         "The crypt() function is unimplemented due to excessive paranoia.");
  1568.   #endif
  1569. !         break;
  1570. !     case O_EXP:
  1571. !         str_numset(str,exp(str_gnum(s1)));
  1572. !         break;
  1573. !     case O_LOG:
  1574. !         str_numset(str,log(str_gnum(s1)));
  1575. !         break;
  1576. !     case O_SQRT:
  1577. !         str_numset(str,sqrt(str_gnum(s1)));
  1578. !         break;
  1579. !     case O_INT:
  1580. !         value = str_gnum(s1);
  1581. !         if (value >= 0.0)
  1582. !         (void)modf(value,&value);
  1583. !         else {
  1584. !         (void)modf(-value,&value);
  1585. !         value = -value;
  1586. !         }
  1587. !         str_numset(str,value);
  1588. !         break;
  1589. !     case O_ORD:
  1590.   #ifndef I286
  1591. !         str_numset(str,(double)(*str_get(s1)));
  1592.   #else
  1593. !         {
  1594. !         int  zapc;
  1595. !         char *zaps;
  1596.   
  1597. !         zaps = str_get(s1);
  1598. !         zapc = (int) *zaps;
  1599. !         str_numset(str,(double)(zapc));
  1600. !         }
  1601. ! #endif
  1602. !         break;
  1603.       }
  1604. !     if (str) {
  1605. !         arg->arg_type = O_ITEM;    /* note arg1 type is already SINGLE */
  1606. !         str_free(s1);
  1607. !         arg[1].arg_ptr.arg_str = str;
  1608. !         if (s2) {
  1609. !         str_free(s2);
  1610. !         arg[2].arg_ptr.arg_str = Nullstr;
  1611. !         arg[2].arg_type = A_NULL;
  1612. !         }
  1613. !     }
  1614.       }
  1615.   }
  1616.   
  1617.   ARG *
  1618. --- 279,625 ----
  1619.       double sin(), cos(), atan2(), pow();
  1620.   
  1621.       if (!arg || !arg->arg_len)
  1622. !     return arg;
  1623.   
  1624. !     if (!str)
  1625.       str = Str_new(20,0);
  1626. +     if (arg[1].arg_type == A_SINGLE)
  1627.       s1 = arg[1].arg_ptr.arg_str;
  1628. !     else
  1629. !     s1 = Nullstr;
  1630. !     if (arg->arg_len >= 2 && arg[2].arg_type == A_SINGLE)
  1631. !     s2 = arg[2].arg_ptr.arg_str;
  1632. !     else
  1633. !     s2 = Nullstr;
  1634. ! #define CHECK1 if (!s1) return arg
  1635. ! #define CHECK2 if (!s2) return arg
  1636. ! #define CHECK12 if (!s1 || !s2) return arg
  1637. !     switch (arg->arg_type) {
  1638. !     default:
  1639. !     return arg;
  1640. !     case O_AELEM:
  1641. !     CHECK2;
  1642. !     i = (int)str_gnum(s2);
  1643. !     if (i < 32767 && i >= 0) {
  1644. !         arg->arg_type = O_ITEM;
  1645. !         arg->arg_len = 1;
  1646. !         arg[1].arg_type = A_ARYSTAB;    /* $abc[123] is hoistable now */
  1647. !         arg[1].arg_len = i;
  1648. !         str_free(s2);
  1649. !         Renew(arg, 2, ARG);
  1650. !     }
  1651. !     return arg;
  1652. !     case O_CONCAT:
  1653. !     CHECK12;
  1654. !     str_sset(str,s1);
  1655. !     str_scat(str,s2);
  1656. !     break;
  1657. !     case O_REPEAT:
  1658. !     CHECK12;
  1659. !     i = (int)str_gnum(s2);
  1660. !     tmps = str_get(s1);
  1661. !     str_nset(str,"",0);
  1662. !     STR_GROW(str, i * s1->str_cur + 1);
  1663. !     repeatcpy(str->str_ptr, tmps, s1->str_cur, i);
  1664. !     str->str_cur = i * s1->str_cur;
  1665. !     str->str_ptr[str->str_cur] = '\0';
  1666. !     break;
  1667. !     case O_MULTIPLY:
  1668. !     CHECK12;
  1669. !     value = str_gnum(s1);
  1670. !     str_numset(str,value * str_gnum(s2));
  1671. !     break;
  1672. !     case O_DIVIDE:
  1673. !     CHECK12;
  1674. !     value = str_gnum(s2);
  1675. !     if (value == 0.0)
  1676. !         yyerror("Illegal division by constant zero");
  1677.       else
  1678.   #ifdef cray
  1679. !     /* insure that 20./5. == 4. */
  1680. !     {
  1681. !         double x;
  1682. !         int    k;
  1683. !         x =  str_gnum(s1);
  1684. !         if ((double)(int)x     == x &&
  1685. !         (double)(int)value == value &&
  1686. !         (k = (int)x/(int)value)*(int)value == (int)x) {
  1687. !         value = k;
  1688. !         } else {
  1689. !         value = x/value;
  1690.           }
  1691. +         str_numset(str,value);
  1692. +     }
  1693.   #else
  1694. !     str_numset(str,str_gnum(s1) / value);
  1695.   #endif
  1696. !     break;
  1697. !     case O_MODULO:
  1698. !     CHECK12;
  1699. !     tmplong = (unsigned long)str_gnum(s2);
  1700. !     if (tmplong == 0L) {
  1701. !         yyerror("Illegal modulus of constant zero");
  1702. !         return arg;
  1703. !     }
  1704. !     tmp2 = (long)str_gnum(s1);
  1705.   #ifndef lint
  1706. !     if (tmp2 >= 0)
  1707. !         str_numset(str,(double)(tmp2 % tmplong));
  1708. !     else
  1709. !         str_numset(str,(double)((tmplong-((-tmp2 - 1) % tmplong)) - 1));
  1710.   #else
  1711. !     tmp2 = tmp2;
  1712.   #endif
  1713. !     break;
  1714. !     case O_ADD:
  1715. !     CHECK12;
  1716. !     value = str_gnum(s1);
  1717. !     str_numset(str,value + str_gnum(s2));
  1718. !     break;
  1719. !     case O_SUBTRACT:
  1720. !     CHECK12;
  1721. !     value = str_gnum(s1);
  1722. !     str_numset(str,value - str_gnum(s2));
  1723. !     break;
  1724. !     case O_LEFT_SHIFT:
  1725. !     CHECK12;
  1726. !     value = str_gnum(s1);
  1727. !     i = (int)str_gnum(s2);
  1728.   #ifndef lint
  1729. !     str_numset(str,(double)(((long)value) << i));
  1730.   #endif
  1731. !     break;
  1732. !     case O_RIGHT_SHIFT:
  1733. !     CHECK12;
  1734. !     value = str_gnum(s1);
  1735. !     i = (int)str_gnum(s2);
  1736.   #ifndef lint
  1737. !     str_numset(str,(double)(((long)value) >> i));
  1738.   #endif
  1739. !     break;
  1740. !     case O_LT:
  1741. !     CHECK12;
  1742. !     value = str_gnum(s1);
  1743. !     str_numset(str,(value < str_gnum(s2)) ? 1.0 : 0.0);
  1744. !     break;
  1745. !     case O_GT:
  1746. !     CHECK12;
  1747. !     value = str_gnum(s1);
  1748. !     str_numset(str,(value > str_gnum(s2)) ? 1.0 : 0.0);
  1749. !     break;
  1750. !     case O_LE:
  1751. !     CHECK12;
  1752. !     value = str_gnum(s1);
  1753. !     str_numset(str,(value <= str_gnum(s2)) ? 1.0 : 0.0);
  1754. !     break;
  1755. !     case O_GE:
  1756. !     CHECK12;
  1757. !     value = str_gnum(s1);
  1758. !     str_numset(str,(value >= str_gnum(s2)) ? 1.0 : 0.0);
  1759. !     break;
  1760. !     case O_EQ:
  1761. !     CHECK12;
  1762. !     if (dowarn) {
  1763. !         if ((!s1->str_nok && !looks_like_number(s1)) ||
  1764. !         (!s2->str_nok && !looks_like_number(s2)) )
  1765. !         warn("Possible use of == on string value");
  1766. !     }
  1767. !     value = str_gnum(s1);
  1768. !     str_numset(str,(value == str_gnum(s2)) ? 1.0 : 0.0);
  1769. !     break;
  1770. !     case O_NE:
  1771. !     CHECK12;
  1772. !     value = str_gnum(s1);
  1773. !     str_numset(str,(value != str_gnum(s2)) ? 1.0 : 0.0);
  1774. !     break;
  1775. !     case O_NCMP:
  1776. !     CHECK12;
  1777. !     value = str_gnum(s1);
  1778. !     value -= str_gnum(s2);
  1779. !     if (value > 0.0)
  1780. !         value = 1.0;
  1781. !     else if (value < 0.0)
  1782. !         value = -1.0;
  1783. !     str_numset(str,value);
  1784. !     break;
  1785. !     case O_BIT_AND:
  1786. !     CHECK12;
  1787. !     value = str_gnum(s1);
  1788.   #ifndef lint
  1789. !     str_numset(str,(double)(U_L(value) & U_L(str_gnum(s2))));
  1790.   #endif
  1791. !     break;
  1792. !     case O_XOR:
  1793. !     CHECK12;
  1794. !     value = str_gnum(s1);
  1795.   #ifndef lint
  1796. !     str_numset(str,(double)(U_L(value) ^ U_L(str_gnum(s2))));
  1797.   #endif
  1798. !     break;
  1799. !     case O_BIT_OR:
  1800. !     CHECK12;
  1801. !     value = str_gnum(s1);
  1802.   #ifndef lint
  1803. !     str_numset(str,(double)(U_L(value) | U_L(str_gnum(s2))));
  1804.   #endif
  1805. !     break;
  1806. !     case O_AND:
  1807. !     CHECK12;
  1808. !     if (str_true(s1))
  1809. !         str_sset(str,s2);
  1810. !     else
  1811. !         str_sset(str,s1);
  1812. !     break;
  1813. !     case O_OR:
  1814. !     CHECK12;
  1815. !     if (str_true(s1))
  1816. !         str_sset(str,s1);
  1817. !     else
  1818. !         str_sset(str,s2);
  1819. !     break;
  1820. !     case O_COND_EXPR:
  1821. !     CHECK12;
  1822. !     if ((arg[3].arg_type & A_MASK) != A_SINGLE)
  1823. !         return arg;
  1824. !     if (str_true(s1))
  1825. !         str_sset(str,s2);
  1826. !     else
  1827. !         str_sset(str,arg[3].arg_ptr.arg_str);
  1828. !     str_free(arg[3].arg_ptr.arg_str);
  1829. !     Renew(arg, 3, ARG);
  1830. !     break;
  1831. !     case O_NEGATE:
  1832. !     CHECK1;
  1833. !     str_numset(str,(double)(-str_gnum(s1)));
  1834. !     break;
  1835. !     case O_NOT:
  1836. !     CHECK1;
  1837. !     str_numset(str,(double)(!str_true(s1)));
  1838. !     break;
  1839. !     case O_COMPLEMENT:
  1840. !     CHECK1;
  1841.   #ifndef lint
  1842. !     str_numset(str,(double)(~U_L(str_gnum(s1))));
  1843.   #endif
  1844. !     break;
  1845. !     case O_SIN:
  1846. !     CHECK1;
  1847. !     str_numset(str,sin(str_gnum(s1)));
  1848. !     break;
  1849. !     case O_COS:
  1850. !     CHECK1;
  1851. !     str_numset(str,cos(str_gnum(s1)));
  1852. !     break;
  1853. !     case O_ATAN2:
  1854. !     CHECK12;
  1855. !     value = str_gnum(s1);
  1856. !     str_numset(str,atan2(value, str_gnum(s2)));
  1857. !     break;
  1858. !     case O_POW:
  1859. !     CHECK12;
  1860. !     value = str_gnum(s1);
  1861. !     str_numset(str,pow(value, str_gnum(s2)));
  1862. !     break;
  1863. !     case O_LENGTH:
  1864. !     if (arg[1].arg_type == A_STAB) {
  1865. !         arg->arg_type = O_ITEM;
  1866. !         arg[1].arg_type = A_LENSTAB;
  1867. !         return arg;
  1868. !     }
  1869. !     CHECK1;
  1870. !     str_numset(str, (double)str_len(s1));
  1871. !     break;
  1872. !     case O_SLT:
  1873. !     CHECK12;
  1874. !     str_numset(str,(double)(str_cmp(s1,s2) < 0));
  1875. !     break;
  1876. !     case O_SGT:
  1877. !     CHECK12;
  1878. !     str_numset(str,(double)(str_cmp(s1,s2) > 0));
  1879. !     break;
  1880. !     case O_SLE:
  1881. !     CHECK12;
  1882. !     str_numset(str,(double)(str_cmp(s1,s2) <= 0));
  1883. !     break;
  1884. !     case O_SGE:
  1885. !     CHECK12;
  1886. !     str_numset(str,(double)(str_cmp(s1,s2) >= 0));
  1887. !     break;
  1888. !     case O_SEQ:
  1889. !     CHECK12;
  1890. !     str_numset(str,(double)(str_eq(s1,s2)));
  1891. !     break;
  1892. !     case O_SNE:
  1893. !     CHECK12;
  1894. !     str_numset(str,(double)(!str_eq(s1,s2)));
  1895. !     break;
  1896. !     case O_SCMP:
  1897. !     CHECK12;
  1898. !     str_numset(str,(double)(str_cmp(s1,s2)));
  1899. !     break;
  1900. !     case O_CRYPT:
  1901. !     CHECK12;
  1902.   #ifdef HAS_CRYPT
  1903. !     tmps = str_get(s1);
  1904. !     str_set(str,crypt(tmps,str_get(s2)));
  1905.   #else
  1906. !     yyerror(
  1907. !     "The crypt() function is unimplemented due to excessive paranoia.");
  1908.   #endif
  1909. !     break;
  1910. !     case O_EXP:
  1911. !     CHECK1;
  1912. !     str_numset(str,exp(str_gnum(s1)));
  1913. !     break;
  1914. !     case O_LOG:
  1915. !     CHECK1;
  1916. !     str_numset(str,log(str_gnum(s1)));
  1917. !     break;
  1918. !     case O_SQRT:
  1919. !     CHECK1;
  1920. !     str_numset(str,sqrt(str_gnum(s1)));
  1921. !     break;
  1922. !     case O_INT:
  1923. !     CHECK1;
  1924. !     value = str_gnum(s1);
  1925. !     if (value >= 0.0)
  1926. !         (void)modf(value,&value);
  1927. !     else {
  1928. !         (void)modf(-value,&value);
  1929. !         value = -value;
  1930. !     }
  1931. !     str_numset(str,value);
  1932. !     break;
  1933. !     case O_ORD:
  1934. !     CHECK1;
  1935.   #ifndef I286
  1936. !     str_numset(str,(double)(*str_get(s1)));
  1937.   #else
  1938. !     {
  1939. !         int  zapc;
  1940. !         char *zaps;
  1941.   
  1942. !         zaps = str_get(s1);
  1943. !         zapc = (int) *zaps;
  1944. !         str_numset(str,(double)(zapc));
  1945.       }
  1946. ! #endif
  1947. !     break;
  1948.       }
  1949. +     arg->arg_type = O_ITEM;    /* note arg1 type is already SINGLE */
  1950. +     str_free(s1);
  1951. +     arg[1].arg_ptr.arg_str = str;
  1952. +     if (s2) {
  1953. +     str_free(s2);
  1954. +     arg[2].arg_ptr.arg_str = Nullstr;
  1955. +     arg[2].arg_type = A_NULL;
  1956. +     }
  1957. +     str = Nullstr;
  1958. +     return arg;
  1959.   }
  1960.   
  1961.   ARG *
  1962.  
  1963. *** End of Patch 5 ***
  1964. exit 0 # Just in case...
  1965. -- 
  1966. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1967. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1968. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1969. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1970.