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

  1. Newsgroups: comp.sources.misc
  2. From: lwall@netlabs.com (Larry Wall)
  3. Subject:  v25i068:  perl - The perl programming language, Patch19
  4. Message-ID: <1991Nov13.214841.4272@sparky.imd.sterling.com>
  5. X-Md4-Signature: 7020affa705e9d173a8d35be360fc0b5
  6. Date: Wed, 13 Nov 1991 21:48:41 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: lwall@netlabs.com (Larry Wall)
  10. Posting-number: Volume 25, Issue 68
  11. Archive-name: perl/patch19
  12. Environment: UNIX, MS-DOS, OS2
  13. Patch-To: perl: Volume 18, Issue 19-54
  14.  
  15. System: perl version 4.0
  16. Patch #: 19
  17. Priority: HIGH
  18.  
  19. Ok, here's the cleanup patch I suggested you wait for.  Have at it...
  20.  
  21. Subject: added little-endian pack/unpack options
  22.     
  23.     This is the only enhancement in this patch, but it seemed unlikely
  24.     to bust anything else, and added functionality that it was very
  25.     difficult to do any other way.  Compliments of David W. Sanderson.
  26.  
  27. Subject: op/regexp.t failed from missing arg to bcmp()
  28. Subject: study was busted by 4.018
  29. Subject: sort $subname was busted by changes in 4.018
  30. Subject: default arg for shift was wrong after first subroutine definition
  31.  
  32.     Things that broke in 4.018.  Shame on me.
  33.  
  34. Subject: do {$foo ne "bar";} returned wrong value
  35.  
  36.     A bug of long standing.  How come nobody saw this one?  Or if you
  37.     did, why didn't you report it before now?  Or if you did, why did
  38.     I ignore you?  :-)
  39.  
  40. Subject: some machines need -lsocket before -lnsl
  41. Subject: some earlier patches weren't propagated to alternate 286 code
  42. Subject: compile in the x2p directory couldn't find cppstdin
  43. Subject: more hints for aix, isc, hp, sco, uts
  44. Subject: installperl no longer updates unchanged library files
  45. Subject: uts wrongly defines S_ISDIR() et al
  46. Subject: too many preprocessors can't expand a macro right in #if
  47.  
  48.     The usual pastiche of portability kludges.
  49.  
  50. Subject: deleted some unused functions from usersub.c
  51.  
  52.     And fixed the spelling of John Macdonald's name, and included his
  53.     suggested workaround for a certain vendor's stdio bug...
  54.  
  55. Subject: added readdir test
  56. Subject: made op/groups.t more reliable
  57. Subject: added test for sort $subname to op/sort.t
  58. Subject: added some hacks to op/stat.t for weird filesystem architectures
  59.  
  60.     Improvements (hopefully) to the regression tests.
  61.  
  62. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your perl source
  63.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  64.     If you don't have the patch program, apply the following by hand,
  65.     or get patch (version 2.0, latest patchlevel).
  66.  
  67.     After patching:
  68.         Configure -d
  69.         make depend
  70.         make
  71.         make test
  72.         make install
  73.  
  74.     If patch indicates that patchlevel is the wrong version, you may need
  75.     to apply one or more previous patches, or the patch may already
  76.     have been applied.  See the patchlevel.h file to find out what has or
  77.     has not been applied.  In any event, don't continue with the patch.
  78.  
  79.     If you are missing previous patches they can be obtained from me:
  80.  
  81.     Larry Wall
  82.     lwall@netlabs.com
  83.  
  84.     If you send a mail message of the following form it will greatly speed
  85.     processing:
  86.  
  87.     Subject: Command
  88.     @SH mailpatch PATH perl 4.0 LIST
  89.            ^ note the c
  90.  
  91.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  92.     or in bang notation from some well-known host, and LIST is the number
  93.     of one or more patches you need, separated by spaces, commas, and/or
  94.     hyphens.  Saying 35- says everything from 35 to the end.
  95.  
  96.  
  97. Index: patchlevel.h
  98. Prereq: 18
  99. 1c1
  100. < #define PATCHLEVEL 18
  101. ---
  102. > #define PATCHLEVEL 19
  103.  
  104. Index: Configure
  105. Prereq: 4.0.1.5
  106. *** Configure.old    Mon Nov 11 16:49:01 1991
  107. --- Configure    Mon Nov 11 16:49:03 1991
  108. ***************
  109. *** 8,14 ****
  110.   # and edit it to reflect your system.  Some packages may include samples
  111.   # of config.h for certain machines, so you might look for one of those.)
  112.   #
  113. ! # $RCSfile: Configure,v $$Revision: 4.0.1.5 $$Date: 91/11/05 23:11:32 $
  114.   #
  115.   # Yes, you may rip this off to use in other distribution packages.
  116.   # (Note: this Configure script was generated automatically.  Rather than
  117. --- 8,14 ----
  118.   # and edit it to reflect your system.  Some packages may include samples
  119.   # of config.h for certain machines, so you might look for one of those.)
  120.   #
  121. ! # $RCSfile: Configure,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:26:51 $
  122.   #
  123.   # Yes, you may rip this off to use in other distribution packages.
  124.   # (Note: this Configure script was generated automatically.  Rather than
  125. ***************
  126. *** 354,360 ****
  127.   d_ndir=ndir
  128.   voidwant=1
  129.   voidwant=7
  130. ! libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
  131.   inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
  132.   
  133.   : Now test for existence of everything in MANIFEST
  134. --- 354,360 ----
  135.   d_ndir=ndir
  136.   voidwant=1
  137.   voidwant=7
  138. ! libswanted="c_s net_s net socket nsl_s nsl nm ndir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
  139.   inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
  140.   
  141.   : Now test for existence of everything in MANIFEST
  142. ***************
  143. *** 596,602 ****
  144. --- 596,604 ----
  145.   cpp
  146.   csh
  147.   egrep
  148. + line
  149.   nroff
  150. + perl
  151.   test
  152.   uname
  153.   yacc
  154. ***************
  155. *** 2292,2298 ****
  156.   : index or strcpy
  157.   echo " "
  158.   case "$d_index" in
  159. ! n) dflt=n;;
  160.   *)  if $test -f /unix; then
  161.       dflt=n
  162.       else
  163. --- 2294,2300 ----
  164.   : index or strcpy
  165.   echo " "
  166.   case "$d_index" in
  167. ! undef) dflt=n;;
  168.   *)  if $test -f /unix; then
  169.       dflt=n
  170.       else
  171. ***************
  172. *** 2377,2382 ****
  173. --- 2379,2444 ----
  174.   set d_msg
  175.   eval $setvar
  176.   
  177. + : determine which malloc to compile in
  178. + echo " "
  179. + case "$d_mymalloc" in
  180. + '')
  181. +     case "$usemymalloc" in
  182. +     '')
  183. +     if bsd || v7; then
  184. +         dflt='y'
  185. +     else
  186. +         dflt='n'
  187. +     fi
  188. +     ;;
  189. +     n*) dflt=n;;
  190. +     *)  dflt=y;;
  191. +     esac
  192. +     ;;
  193. + define)  dflt="y"
  194. +     ;;
  195. + *)  dflt="n"
  196. +     ;;
  197. + esac
  198. + rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
  199. + $echo $n "$rp $c"
  200. + . myread
  201. + case "$ans" in
  202. + '') ans=$dflt;;
  203. + esac
  204. + case "$ans" in
  205. + y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
  206. +     libs=`echo $libs | sed 's/-lmalloc//'`
  207. +     val="$define"
  208. +     case "$mallocptrtype" in
  209. +     '')
  210. +     cat >usemymalloc.c <<'END'
  211. + #ifdef __STDC__
  212. + #include <stdlib.h>
  213. + #else
  214. + #include <malloc.h>
  215. + #endif
  216. + void *malloc();
  217. + END
  218. +     if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
  219. +         mallocptrtype=void
  220. +     else
  221. +         mallocptrtype=char
  222. +     fi
  223. +     ;;
  224. +     esac
  225. +     echo " "
  226. +     echo "Your system wants malloc to return $mallocptrtype*, it would seem."
  227. +     ;;
  228. + *)  mallocsrc='';
  229. +     mallocobj='';
  230. +     mallocptrtype=void
  231. +     val="$define"
  232. +     ;;
  233. + esac
  234. + set d_mymalloc
  235. + eval $setvar
  236.   : see if ndbm is available
  237.   echo " "
  238.   xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
  239. ***************
  240. *** 3052,3117 ****
  241.   $echo $n "$rp $c"
  242.   . myread
  243.   intsize="$ans"
  244. - : determine which malloc to compile in
  245. - echo " "
  246. - case "$d_mymalloc" in
  247. - '')
  248. -     case "$usemymalloc" in
  249. -     '')
  250. -     if bsd || v7; then
  251. -         dflt='y'
  252. -     else
  253. -         dflt='n'
  254. -     fi
  255. -     ;;
  256. -     n*) dflt=n;;
  257. -     *)  dflt=y;;
  258. -     esac
  259. -     ;;
  260. - define)  dflt="y"
  261. -     ;;
  262. - *)  dflt="n"
  263. -     ;;
  264. - esac
  265. - rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
  266. - $echo $n "$rp $c"
  267. - . myread
  268. - case "$ans" in
  269. - '') ans=$dflt;;
  270. - esac
  271. - case "$ans" in
  272. - y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
  273. -     libs=`echo $libs | sed 's/-lmalloc//'`
  274. -     val="$define"
  275. -     case "$mallocptrtype" in
  276. -     '')
  277. -     cat >usemymalloc.c <<'END'
  278. - #ifdef __STDC__
  279. - #include <stdlib.h>
  280. - #else
  281. - #include <malloc.h>
  282. - #endif
  283. - void *malloc();
  284. - END
  285. -     if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
  286. -         mallocptrtype=void
  287. -     else
  288. -         mallocptrtype=char
  289. -     fi
  290. -     ;;
  291. -     esac
  292. -     echo " "
  293. -     echo "Your system wants malloc to return $mallocptrtype*, it would seem."
  294. -     ;;
  295. - *)  mallocsrc='';
  296. -     mallocobj='';
  297. -     mallocptrtype=void
  298. -     val="$define"
  299. -     ;;
  300. - esac
  301. - set d_mymalloc
  302. - eval $setvar
  303.   
  304.   : determine where private executables go
  305.   case "$privlib" in
  306. --- 3114,3119 ----
  307.  
  308. Index: MANIFEST
  309. *** MANIFEST.old    Mon Nov 11 16:49:07 1991
  310. --- MANIFEST    Mon Nov 11 16:49:07 1991
  311. ***************
  312. *** 109,114 ****
  313. --- 109,115 ----
  314.   hints/hp9000_800.sh    
  315.   hints/hpux.sh
  316.   hints/i386.sh
  317. + hints/isc_3_2_2.sh
  318.   hints/mips.sh
  319.   hints/mpc.sh    
  320.   hints/ncr_tower.sh
  321. ***************
  322. *** 287,292 ****
  323. --- 288,294 ----
  324.   t/op/range.t        See if .. works
  325.   t/op/re_tests        Input file for op.regexp
  326.   t/op/read.t        See if read() works
  327. + t/op/readdir.t        See if readdir() works
  328.   t/op/regexp.t        See if regular expressions work
  329.   t/op/repeat.t        See if x operator works
  330.   t/op/s.t        See if substitutions work
  331.  
  332. Index: hints/aix_rs.sh
  333. *** hints/aix_rs.sh.old    Mon Nov 11 16:49:25 1991
  334. --- hints/aix_rs.sh    Mon Nov 11 16:49:25 1991
  335. ***************
  336. *** 1,5 ****
  337. ! eval_cflags='optimize="-g"'
  338. ! toke_cflags='optimize="-g"'
  339. ! teval_cflags='optimize="-g"'
  340. ! ttoke_cflags='optimize="-g"';
  341.   ccflags="$ccflags -D_NO_PROTO"
  342. --- 1,7 ----
  343. ! eval_cflags='optimize=""'
  344. ! toke_cflags='optimize=""'
  345. ! teval_cflags='optimize=""'
  346. ! ttoke_cflags='optimize=""'
  347.   ccflags="$ccflags -D_NO_PROTO"
  348. + cppstdin='/lib/cpp -D_AIX -D_IBMR2'
  349. + cppminus=''
  350.  
  351. Index: cmd.c
  352. *** cmd.c.old    Mon Nov 11 16:49:10 1991
  353. --- cmd.c    Mon Nov 11 16:49:10 1991
  354. ***************
  355. *** 1,4 ****
  356. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 16:07:43 $
  357.    *
  358.    *    Copyright (c) 1991, Larry Wall
  359.    *
  360. --- 1,4 ----
  361. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.4 $$Date: 91/11/11 16:29:33 $
  362.    *
  363.    *    Copyright (c) 1991, Larry Wall
  364.    *
  365. ***************
  366. *** 6,11 ****
  367. --- 6,15 ----
  368.    *    License or the Artistic License, as specified in the README file.
  369.    *
  370.    * $Log:    cmd.c,v $
  371. +  * Revision 4.0.1.4  91/11/11  16:29:33  lwall
  372. +  * patch19: do {$foo ne "bar";} returned wrong value
  373. +  * patch19: some earlier patches weren't propagated to alternate 286 code
  374. +  * 
  375.    * Revision 4.0.1.3  91/11/05  16:07:43  lwall
  376.    * patch11: random cleanup
  377.    * patch11: "foo\0" eq "foo" was sometimes optimized to true
  378. ***************
  379. *** 367,379 ****
  380.               if (cmd->c_spat)
  381.               lastspat = cmd->c_spat;
  382.               match = !(cmdflags & CF_FIRSTNEG);
  383. !             retstr = &str_yes;
  384.               goto flipmaybe;
  385.           }
  386.           }
  387.           else if (cmdflags & CF_NESURE) {
  388.           match = cmdflags & CF_FIRSTNEG;
  389. !         retstr = &str_no;
  390.           goto flipmaybe;
  391.           }
  392.   #else
  393. --- 371,383 ----
  394.               if (cmd->c_spat)
  395.               lastspat = cmd->c_spat;
  396.               match = !(cmdflags & CF_FIRSTNEG);
  397. !             retstr = match ? &str_yes : &str_no;
  398.               goto flipmaybe;
  399.           }
  400.           }
  401.           else if (cmdflags & CF_NESURE) {
  402.           match = cmdflags & CF_FIRSTNEG;
  403. !         retstr = match ? &str_yes : &str_no;
  404.           goto flipmaybe;
  405.           }
  406.   #else
  407. ***************
  408. *** 380,385 ****
  409. --- 384,390 ----
  410.           {
  411.           char *zap1, *zap2, zap1c, zap2c;
  412.           int  zaplen;
  413. +         int lenok;
  414.   
  415.           zap1 = cmd->c_short->str_ptr;
  416.           zap2 = str_get(retstr);
  417. ***************
  418. *** 386,392 ****
  419.           zap1c = *zap1;
  420.           zap2c = *zap2;
  421.           zaplen = cmd->c_slen;
  422. !         if ((zap1c == zap2c) && (bcmp(zap1, zap2, zaplen) == 0)) {
  423.               if (cmdflags & CF_EQSURE) {
  424.               if (sawampersand &&
  425.                 (cmdflags & CF_OPTIMIZE) != CFT_STROP) {
  426. --- 391,401 ----
  427.           zap1c = *zap1;
  428.           zap2c = *zap2;
  429.           zaplen = cmd->c_slen;
  430. !         if (match)
  431. !             lenok = (retstr->str_cur == cmd->c_slen - 1);
  432. !         else
  433. !             lenok = (retstr->str_cur >= cmd->c_slen);
  434. !         if ((zap1c == zap2c) && lenok && (bcmp(zap1, zap2, zaplen) == 0)) {
  435.               if (cmdflags & CF_EQSURE) {
  436.               if (sawampersand &&
  437.                 (cmdflags & CF_OPTIMIZE) != CFT_STROP) {
  438. ***************
  439. *** 403,415 ****
  440.               if (cmd->c_spat)
  441.                   lastspat = cmd->c_spat;
  442.                match = !(cmdflags & CF_FIRSTNEG);
  443. !              retstr = &str_yes;
  444.                goto flipmaybe;
  445.               }
  446.           }
  447.           else if (cmdflags & CF_NESURE) {
  448.               match = cmdflags & CF_FIRSTNEG;
  449. !             retstr = &str_no;
  450.               goto flipmaybe;
  451.           }
  452.           }
  453. --- 412,424 ----
  454.               if (cmd->c_spat)
  455.                   lastspat = cmd->c_spat;
  456.                match = !(cmdflags & CF_FIRSTNEG);
  457. !             retstr = match ? &str_yes : &str_no;
  458.                goto flipmaybe;
  459.               }
  460.           }
  461.           else if (cmdflags & CF_NESURE) {
  462.               match = cmdflags & CF_FIRSTNEG;
  463. !             retstr = match ? &str_yes : &str_no;
  464.               goto flipmaybe;
  465.           }
  466.           }
  467. ***************
  468. *** 451,457 ****
  469.               }
  470.               lastspat = cmd->c_spat;
  471.               match = !(cmdflags & CF_FIRSTNEG);
  472. !             retstr = &str_yes;
  473.               goto flipmaybe;
  474.           }
  475.           else
  476. --- 460,466 ----
  477.               }
  478.               lastspat = cmd->c_spat;
  479.               match = !(cmdflags & CF_FIRSTNEG);
  480. !             retstr = match ? &str_yes : &str_no;
  481.               goto flipmaybe;
  482.           }
  483.           else
  484. ***************
  485. *** 461,467 ****
  486.           if (cmdflags & CF_NESURE) {
  487.               ++cmd->c_short->str_u.str_useful;
  488.               match = cmdflags & CF_FIRSTNEG;
  489. !             retstr = &str_no;
  490.               goto flipmaybe;
  491.           }
  492.           }
  493. --- 470,476 ----
  494.           if (cmdflags & CF_NESURE) {
  495.               ++cmd->c_short->str_u.str_useful;
  496.               match = cmdflags & CF_FIRSTNEG;
  497. !             retstr = match ? &str_yes : &str_no;
  498.               goto flipmaybe;
  499.           }
  500.           }
  501.  
  502. Index: doSH
  503. *** doSH.old    Mon Nov 11 16:49:13 1991
  504. --- doSH    Mon Nov 11 16:49:13 1991
  505. ***************
  506. *** 4,9 ****
  507. --- 4,10 ----
  508.   . ./config.sh
  509.   
  510.   rm -f x2p/config.sh
  511. + cp cppstdin x2p
  512.   
  513.   echo " "
  514.   echo "Doing variable substitutions on .SH files..."
  515.  
  516. Index: doarg.c
  517. *** doarg.c.old    Mon Nov 11 16:49:16 1991
  518. --- doarg.c    Mon Nov 11 16:49:17 1991
  519. ***************
  520. *** 1,4 ****
  521. ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.4 $$Date: 91/11/05 16:35:06 $
  522.    *
  523.    *    Copyright (c) 1991, Larry Wall
  524.    *
  525. --- 1,4 ----
  526. ! /* $RCSfile: doarg.c,v $$Revision: 4.0.1.5 $$Date: 91/11/11 16:31:58 $
  527.    *
  528.    *    Copyright (c) 1991, Larry Wall
  529.    *
  530. ***************
  531. *** 6,11 ****
  532. --- 6,14 ----
  533.    *    License or the Artistic License, as specified in the README file.
  534.    *
  535.    * $Log:    doarg.c,v $
  536. +  * Revision 4.0.1.5  91/11/11  16:31:58  lwall
  537. +  * patch19: added little-endian pack/unpack options
  538. +  * 
  539.    * Revision 4.0.1.4  91/11/05  16:35:06  lwall
  540.    * patch11: /$foo/o optimizer could access deallocated data
  541.    * patch11: minimum match length calculation in regexp is now cumulative
  542. ***************
  543. *** 661,666 ****
  544. --- 664,679 ----
  545.           str_ncat(str,(char*)&ashort,sizeof(short));
  546.           }
  547.           break;
  548. +     case 'v':
  549. +         while (len-- > 0) {
  550. +         fromstr = NEXTFROM;
  551. +         ashort = (short)str_gnum(fromstr);
  552. + #ifdef HAS_HTOVS
  553. +         ashort = htovs(ashort);
  554. + #endif
  555. +         str_ncat(str,(char*)&ashort,sizeof(short));
  556. +         }
  557. +         break;
  558.       case 'S':
  559.       case 's':
  560.           while (len-- > 0) {
  561. ***************
  562. *** 689,694 ****
  563. --- 702,717 ----
  564.           aulong = U_L(str_gnum(fromstr));
  565.   #ifdef HAS_HTONL
  566.           aulong = htonl(aulong);
  567. + #endif
  568. +         str_ncat(str,(char*)&aulong,sizeof(unsigned long));
  569. +         }
  570. +         break;
  571. +     case 'V':
  572. +         while (len-- > 0) {
  573. +         fromstr = NEXTFROM;
  574. +         aulong = U_L(str_gnum(fromstr));
  575. + #ifdef HAS_HTOVL
  576. +         aulong = htovl(aulong);
  577.   #endif
  578.           str_ncat(str,(char*)&aulong,sizeof(unsigned long));
  579.           }
  580.  
  581. Index: dolist.c
  582. *** dolist.c.old    Mon Nov 11 16:49:20 1991
  583. --- dolist.c    Mon Nov 11 16:49:21 1991
  584. ***************
  585. *** 1,4 ****
  586. ! /* $RCSfile: dolist.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 17:07:02 $
  587.    *
  588.    *    Copyright (c) 1991, Larry Wall
  589.    *
  590. --- 1,4 ----
  591. ! /* $RCSfile: dolist.c,v $$Revision: 4.0.1.4 $$Date: 91/11/11 16:33:19 $
  592.    *
  593.    *    Copyright (c) 1991, Larry Wall
  594.    *
  595. ***************
  596. *** 6,11 ****
  597. --- 6,15 ----
  598.    *    License or the Artistic License, as specified in the README file.
  599.    *
  600.    * $Log:    dolist.c,v $
  601. +  * Revision 4.0.1.4  91/11/11  16:33:19  lwall
  602. +  * patch19: added little-endian pack/unpack options
  603. +  * patch19: sort $subname was busted by changes in 4.018
  604. +  * 
  605.    * Revision 4.0.1.3  91/11/05  17:07:02  lwall
  606.    * patch11: prepared for ctype implementations that don't define isascii()
  607.    * patch11: /$foo/o optimizer could access deallocated data
  608. ***************
  609. *** 786,791 ****
  610. --- 790,796 ----
  611.           }
  612.           }
  613.           break;
  614. +     case 'v':
  615.       case 'n':
  616.       case 'S':
  617.           along = (strend - s) / sizeof(unsigned short);
  618. ***************
  619. *** 799,804 ****
  620. --- 804,813 ----
  621.               if (datumtype == 'n')
  622.               aushort = ntohs(aushort);
  623.   #endif
  624. + #ifdef HAS_VTOHS
  625. +             if (datumtype == 'v')
  626. +             aushort = vtohs(aushort);
  627. + #endif
  628.               culong += aushort;
  629.           }
  630.           }
  631. ***************
  632. *** 811,816 ****
  633. --- 820,829 ----
  634.               if (datumtype == 'n')
  635.               aushort = ntohs(aushort);
  636.   #endif
  637. + #ifdef HAS_VTOHS
  638. +             if (datumtype == 'v')
  639. +             aushort = vtohs(aushort);
  640. + #endif
  641.               str_numset(str,(double)aushort);
  642.               (void)astore(stack, ++sp, str_2mortal(str));
  643.           }
  644. ***************
  645. *** 888,893 ****
  646. --- 901,907 ----
  647.           }
  648.           }
  649.           break;
  650. +     case 'V':
  651.       case 'N':
  652.       case 'L':
  653.           along = (strend - s) / sizeof(unsigned long);
  654. ***************
  655. *** 901,906 ****
  656. --- 915,924 ----
  657.               if (datumtype == 'N')
  658.               aulong = ntohl(aulong);
  659.   #endif
  660. + #ifdef HAS_VTOHL
  661. +             if (datumtype == 'V')
  662. +             aulong = vtohl(aulong);
  663. + #endif
  664.               if (checksum > 32)
  665.               cdouble += (double)aulong;
  666.               else
  667. ***************
  668. *** 916,921 ****
  669. --- 934,943 ----
  670.               if (datumtype == 'N')
  671.               aulong = ntohl(aulong);
  672.   #endif
  673. + #ifdef HAS_VTOHL
  674. +             if (datumtype == 'V')
  675. +             aulong = vtohl(aulong);
  676. + #endif
  677.               str_numset(str,(double)aulong);
  678.               (void)astore(stack, ++sp, str_2mortal(str));
  679.           }
  680. ***************
  681. *** 1480,1485 ****
  682. --- 1502,1508 ----
  683.       STR *oldsecond;
  684.       ARRAY *oldstack;
  685.       HASH *stash;
  686. +     STR *sortsubvar;
  687.       static ARRAY *sortstack = Null(ARRAY*);
  688.   
  689.       if (gimme != G_ARRAY) {
  690. ***************
  691. *** 1489,1494 ****
  692. --- 1512,1518 ----
  693.       return sp;
  694.       }
  695.       up = &st[sp];
  696. +     sortsubvar = *up;
  697.       st += sp;        /* temporarily make st point to args */
  698.       for (i = 1; i <= max; i++) {
  699.       /*SUPPRESS 560*/
  700. ***************
  701. *** 1514,1520 ****
  702.           if ((arg[1].arg_type & A_MASK) == A_WORD)
  703.           stab = arg[1].arg_ptr.arg_stab;
  704.           else
  705. !         stab = stabent(str_get(st[sp+1]),TRUE);
  706.   
  707.           if (stab) {
  708.           if (!stab_sub(stab) || !(sortcmd = stab_sub(stab)->cmd))
  709. --- 1538,1544 ----
  710.           if ((arg[1].arg_type & A_MASK) == A_WORD)
  711.           stab = arg[1].arg_ptr.arg_stab;
  712.           else
  713. !         stab = stabent(str_get(sortsubvar),TRUE);
  714.   
  715.           if (stab) {
  716.           if (!stab_sub(stab) || !(sortcmd = stab_sub(stab)->cmd))
  717.  
  718. Index: t/op/groups.t
  719. *** t/op/groups.t.old    Mon Nov 11 16:49:59 1991
  720. --- t/op/groups.t    Mon Nov 11 16:49:59 1991
  721. ***************
  722. *** 5,12 ****
  723.       exit 0;
  724.   }
  725.   
  726. ! print "1..1\n";
  727.   
  728.   for (split(' ', $()) {
  729.       next if $seen{$_}++;
  730.       ($group) = getgrgid($_);
  731. --- 5,18 ----
  732.       exit 0;
  733.   }
  734.   
  735. ! print "1..2\n";
  736.   
  737. + $pwgid = $( + 0;
  738. + ($pwgnam) = getgrgid($pwgid);
  739. + @basegroup{$pwgid,$pwgnam} = (1,1);
  740. + $seen{$pwgid}++;
  741.   for (split(' ', $()) {
  742.       next if $seen{$_}++;
  743.       ($group) = getgrgid($_);
  744. ***************
  745. *** 17,24 ****
  746.       push(@gr, $_);
  747.       }
  748.   } 
  749. ! $gr1 = join(' ',sort @gr);
  750. ! $gr2 = join(' ', sort split(' ',`/usr/ucb/groups`));
  751. ! #print "gr1 is <$gr1>\n";
  752. ! #print "gr2 is <$gr2>\n";
  753. ! print +($gr1 eq $gr2) ? "ok 1\n" : "not ok 1\n";
  754. --- 23,47 ----
  755.       push(@gr, $_);
  756.       }
  757.   } 
  758. ! $gr1 = join(' ', sort @gr);
  759. ! $gr2 = join(' ', grep(!$basegroup{$_}, sort split(' ',`/usr/ucb/groups`)));
  760. ! if ($gr1 eq $gr2) {
  761. !     print "ok 1\n";
  762. ! }
  763. ! else {
  764. !     print "#gr1 is <$gr1>\n";
  765. !     print "#gr2 is <$gr2>\n";
  766. !     print "not ok 1\n";
  767. ! }
  768. ! # multiple 0's indicate GROUPSTYPE is currently long but should be short
  769. ! if ($pwgid == 0 || $seen{0} < 2) {
  770. !     print "ok 2\n";
  771. ! }
  772. ! else {
  773. !     print "not ok 2 (groupstype should be type short, not long)\n";
  774. ! }
  775.  
  776. Index: hints/hp9000_800.sh
  777. *** hints/hp9000_800.sh.old    Mon Nov 11 16:49:27 1991
  778. --- hints/hp9000_800.sh    Mon Nov 11 16:49:27 1991
  779. ***************
  780. *** 1 ****
  781. ! libswanted=`echo $libswanted | sed 's/malloc //'`
  782. --- 1,2 ----
  783. ! libswanted=`echo $libswanted | sed -e 's/malloc //' -e 's/BSD //`
  784. ! optimize='+O1'
  785.  
  786. Index: installperl
  787. *** installperl.old    Mon Nov 11 16:49:34 1991
  788. --- installperl    Mon Nov 11 16:49:35 1991
  789. ***************
  790. *** 136,143 ****
  791.   
  792.       if ($pdev != $ldev || $pino != $lino) {
  793.       foreach $file (<*.pl>) {
  794. !         &unlink("$installprivlib/$file");
  795. !         &cmd("cp $file $installprivlib");
  796.       }
  797.       }
  798.       chdir ".." || die "Can't cd back to source directory: $!\n";
  799. --- 136,146 ----
  800.   
  801.       if ($pdev != $ldev || $pino != $lino) {
  802.       foreach $file (<*.pl>) {
  803. !         system "cmp", "-s", $file, "$privlib/$file";
  804. !         if ($?) {
  805. !         &unlink("$installprivlib/$file");
  806. !         &cmd("cp $file $installprivlib");
  807. !         }
  808.       }
  809.       }
  810.       chdir ".." || die "Can't cd back to source directory: $!\n";
  811.  
  812. Index: hints/isc_3_2_2.sh
  813. *** hints/isc_3_2_2.sh.old    Mon Nov 11 16:49:29 1991
  814. --- hints/isc_3_2_2.sh    Mon Nov 11 16:49:29 1991
  815. ***************
  816. *** 0 ****
  817. --- 1,7 ----
  818. + set `echo $libswanted | sed -e 's/ x / /' -e 's/ PW / /' -e s/ malloc / /`
  819. + libswanted="inet malloc $*"
  820. + doio_cflags='ccflags="$ccflags -DENOTSOCK=103"'
  821. + tdoio_cflags='ccflags="$ccflags -DENOTSOCK=103"'
  822. + echo "<net/errno.h> defines error numbers for network calls, but"
  823. + echo "the definitions for ENAMETOOLONG and ENOTEMPTY conflict with"
  824. + echo "those in <sys/errno.h>.  Instead just define ENOTSOCK here."
  825.  
  826. Index: perl.c
  827. *** perl.c.old    Mon Nov 11 16:49:38 1991
  828. --- perl.c    Mon Nov 11 16:49:39 1991
  829. ***************
  830. *** 1,4 ****
  831. ! char rcsid[] = "$RCSfile: perl.c,v $$Revision: 4.0.1.5 $$Date: 91/11/05 18:03:32 $\nPatch level: ###\n";
  832.   /*
  833.    *    Copyright (c) 1991, Larry Wall
  834.    *
  835. --- 1,4 ----
  836. ! char rcsid[] = "$RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $\nPatch level: ###\n";
  837.   /*
  838.    *    Copyright (c) 1991, Larry Wall
  839.    *
  840. ***************
  841. *** 6,11 ****
  842. --- 6,15 ----
  843.    *    License or the Artistic License, as specified in the README file.
  844.    *
  845.    * $Log:    perl.c,v $
  846. +  * Revision 4.0.1.6  91/11/11  16:38:45  lwall
  847. +  * patch19: default arg for shift was wrong after first subroutine definition
  848. +  * patch19: op/regexp.t failed from missing arg to bcmp()
  849. +  * 
  850.    * Revision 4.0.1.5  91/11/05  18:03:32  lwall
  851.    * patch11: random cleanup
  852.    * patch11: $0 was being truncated at times
  853. ***************
  854. *** 634,639 ****
  855. --- 638,644 ----
  856.   
  857.       defstab = stabent("_",TRUE);
  858.   
  859. +     subname = str_make("main",4);
  860.       if (perldb) {
  861.       debstash = hnew(0);
  862.       stab_xhash(stabent("_DB",TRUE)) = debstash;
  863. ***************
  864. *** 641,647 ****
  865.       dbargs = stab_xarray(aadd((tmpstab = stabent("args",TRUE))));
  866.       tmpstab->str_pok |= SP_MULTI;
  867.       dbargs->ary_flags = 0;
  868. -     subname = str_make("main",4);
  869.       DBstab = stabent("DB",TRUE);
  870.       DBstab->str_pok |= SP_MULTI;
  871.       DBline = stabent("dbline",TRUE);
  872. --- 646,651 ----
  873. ***************
  874. *** 1030,1036 ****
  875.           retval |= error_count;
  876.       }
  877.       else if (last_root && last_elen == bufend - bufptr
  878. !       && *bufptr == *last_eval && !bcmp(bufptr,last_eval)){
  879.           retval = 0;
  880.           eval_root = last_root;    /* no point in reparsing */
  881.       }
  882. --- 1034,1040 ----
  883.           retval |= error_count;
  884.       }
  885.       else if (last_root && last_elen == bufend - bufptr
  886. !       && *bufptr == *last_eval && !bcmp(bufptr,last_eval,last_elen)){
  887.           retval = 0;
  888.           eval_root = last_root;    /* no point in reparsing */
  889.       }
  890.  
  891. Index: perl.h
  892. *** perl.h.old    Mon Nov 11 16:49:42 1991
  893. --- perl.h    Mon Nov 11 16:49:42 1991
  894. ***************
  895. *** 1,4 ****
  896. ! /* $RCSfile: perl.h,v $$Revision: 4.0.1.4 $$Date: 91/11/05 18:06:10 $
  897.    *
  898.    *    Copyright (c) 1991, Larry Wall
  899.    *
  900. --- 1,4 ----
  901. ! /* $RCSfile: perl.h,v $$Revision: 4.0.1.5 $$Date: 91/11/11 16:41:07 $
  902.    *
  903.    *    Copyright (c) 1991, Larry Wall
  904.    *
  905. ***************
  906. *** 6,11 ****
  907. --- 6,16 ----
  908.    *    License or the Artistic License, as specified in the README file.
  909.    *
  910.    * $Log:    perl.h,v $
  911. +  * Revision 4.0.1.5  91/11/11  16:41:07  lwall
  912. +  * patch19: uts wrongly defines S_ISDIR() et al
  913. +  * patch19: too many preprocessors can't expand a macro right in #if
  914. +  * patch19: added little-endian pack/unpack options
  915. +  * 
  916.    * Revision 4.0.1.4  91/11/05  18:06:10  lwall
  917.    * patch11: various portability fixes
  918.    * patch11: added support for dbz
  919. ***************
  920. *** 165,170 ****
  921. --- 170,189 ----
  922.   #endif
  923.   
  924.   #include <sys/stat.h>
  925. + #ifdef uts
  926. + #undef S_ISDIR
  927. + #undef S_ISCHR
  928. + #undef S_ISBLK
  929. + #undef S_ISREG
  930. + #undef S_ISFIFO
  931. + #undef S_ISLNK
  932. + #define S_ISDIR(P) (((P)&S_IFMT)==S_IFDIR)
  933. + #define S_ISCHR(P) (((P)&S_IFMT)==S_IFCHR)
  934. + #define S_ISBLK(P) (((P)&S_IFMT)==S_IFBLK)
  935. + #define S_ISREG(P) (((P)&S_IFMT)==S_IFREG)
  936. + #define S_ISFIFO(P) (((P)&S_IFMT)==S_IFIFO)
  937. + #define S_ISLNK(P) (((P)&S_IFMT)==S_IFLNK)
  938. + #endif
  939.   
  940.   #ifdef I_TIME
  941.   #   include <time.h>
  942. ***************
  943. *** 344,353 ****
  944.   #   endif
  945.   #endif
  946.   
  947. - #if S_ISBLK(060000) == 060000
  948. -     XXX Your sys/stat.h appears to be buggy.  Please fix it.
  949. - #endif
  950.   #ifndef S_ISREG
  951.   #   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
  952.   #endif
  953. --- 363,368 ----
  954. ***************
  955. *** 426,432 ****
  956.   #   define SLOPPYDIVIDE
  957.   #endif
  958.   
  959. ! #if defined(cray) || defined(convex) || BYTEORDER > 0xffff
  960.   #   define QUAD
  961.   #endif
  962.   
  963. --- 441,447 ----
  964.   #   define SLOPPYDIVIDE
  965.   #endif
  966.   
  967. ! #if defined(cray) || defined(convex) || defined (uts) || BYTEORDER > 0xffff
  968.   #   define QUAD
  969.   #endif
  970.   
  971. ***************
  972. *** 434,440 ****
  973.   #   ifdef cray
  974.   #    define quad int
  975.   #   else
  976. ! #    ifdef convex
  977.   #        define quad long long
  978.   #    else
  979.   #        define quad long
  980. --- 449,455 ----
  981.   #   ifdef cray
  982.   #    define quad int
  983.   #   else
  984. ! #    if defined(convex) || defined (uts)
  985.   #        define quad long long
  986.   #    else
  987.   #        define quad long
  988. ***************
  989. *** 583,588 ****
  990. --- 598,624 ----
  991.   #undef HAS_NTOHS
  992.   #undef HAS_NTOHL
  993.   #endif
  994. + #endif
  995. + /*
  996. +  * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
  997. +  * -DWS
  998. +  */
  999. + #if BYTEORDER != 0x1234
  1000. + # define HAS_VTOHL
  1001. + # define HAS_VTOHS
  1002. + # define HAS_HTOVL
  1003. + # define HAS_HTOVS
  1004. + # if BYTEORDER == 0x4321
  1005. + #  define vtohl(x)    ((((x)&0xFF)<<24)    \
  1006. +             +(((x)>>24)&0xFF)    \
  1007. +             +(((x)&0x0000FF00)<<8)    \
  1008. +             +(((x)&0x00FF0000)>>8)    )
  1009. + #  define vtohs(x)    ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
  1010. + #  define htovl(x)    vtohl(x)
  1011. + #  define htovs(x)    vtohs(x)
  1012. + # endif
  1013. +     /* otherwise default to functions in util.c */
  1014.   #endif
  1015.   
  1016.   #ifdef CASTNEGFLOAT
  1017.  
  1018. Index: perl.man
  1019. *** perl.man.old    Mon Nov 11 16:49:50 1991
  1020. --- perl.man    Mon Nov 11 16:49:53 1991
  1021. ***************
  1022. *** 1,7 ****
  1023.   .rn '' }`
  1024. ! ''' $RCSfile: perl.man,v $$Revision: 4.0.1.4 $$Date: 91/11/05 18:11:05 $
  1025.   ''' 
  1026.   ''' $Log:    perl.man,v $
  1027.   ''' Revision 4.0.1.4  91/11/05  18:11:05  lwall
  1028.   ''' patch11: added sort {} LIST
  1029.   ''' patch11: added eval {}
  1030. --- 1,10 ----
  1031.   .rn '' }`
  1032. ! ''' $RCSfile: perl.man,v $$Revision: 4.0.1.5 $$Date: 91/11/11 16:42:00 $
  1033.   ''' 
  1034.   ''' $Log:    perl.man,v $
  1035. + ''' Revision 4.0.1.5  91/11/11  16:42:00  lwall
  1036. + ''' patch19: added little-endian pack/unpack options
  1037. + ''' 
  1038.   ''' Revision 4.0.1.4  91/11/05  18:11:05  lwall
  1039.   ''' patch11: added sort {} LIST
  1040.   ''' patch11: added eval {}
  1041. ***************
  1042. *** 2014,2020 ****
  1043.       if (defined &$var) { &$var($parm); undef &$var; }
  1044.   
  1045.   .fi
  1046. ! :Ip "do EXPR" 8 3
  1047.   Uses the value of EXPR as a filename and executes the contents of the file
  1048.   as a
  1049.   .I perl
  1050. --- 2017,2023 ----
  1051.       if (defined &$var) { &$var($parm); undef &$var; }
  1052.   
  1053.   .fi
  1054. ! .Ip "do EXPR" 8 3
  1055.   Uses the value of EXPR as a filename and executes the contents of the file
  1056.   as a
  1057.   .I perl
  1058. ***************
  1059. *** 3071,3076 ****
  1060. --- 3074,3081 ----
  1061.       f    A single-precision float in the native format.
  1062.       d    A double-precision float in the native format.
  1063.       p    A pointer to a string.
  1064. +     v    A short in \*(L"VAX\*(R" (little-endian) order.
  1065. +     V    A long in \*(L"VAX\*(R" (little-endian) order.
  1066.       x    A null byte.
  1067.       X    Back up a byte.
  1068.       @    Null fill to absolute position.
  1069. ***************
  1070. *** 5893,5899 ****
  1071.   The default top-of-form format for FILEHANDLE is now FILEHANDLE_TOP rather
  1072.   than top.
  1073.   .PP
  1074. ! The eval {} and sort {} constructs were added in version 4.011.
  1075.   .SH BUGS
  1076.   .PP
  1077.   .I Perl
  1078. --- 5898,5907 ----
  1079.   The default top-of-form format for FILEHANDLE is now FILEHANDLE_TOP rather
  1080.   than top.
  1081.   .PP
  1082. ! The eval {} and sort {} constructs were added in version 4.018.
  1083. ! .PP
  1084. ! The v and V (little-endian) template options for pack and unpack were
  1085. ! added in 4.019.
  1086.   .SH BUGS
  1087.   .PP
  1088.   .I Perl
  1089.  
  1090. Index: t/op/readdir.t
  1091. *** t/op/readdir.t.old    Mon Nov 11 16:50:00 1991
  1092. --- t/op/readdir.t    Mon Nov 11 16:50:01 1991
  1093. ***************
  1094. *** 0 ****
  1095. --- 1,20 ----
  1096. + #!./perl
  1097. + eval 'opendir(NOSUCH, "no/such/directory");';
  1098. + if ($@) { print "1..0\n"; exit; }
  1099. + print "1..3\n";
  1100. + if (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; }
  1101. + @D = grep(/^[^\.]/, readdir(OP));
  1102. + closedir(OP);
  1103. + if (@D > 20 && @D < 100) { print "ok 2\n"; } else { print "not ok 2\n"; }
  1104. + @R = sort @D;
  1105. + @G = <op/*>;
  1106. + while (@R && @G && "op/".$R[0] eq $G[0]) {
  1107. +     shift(@R);
  1108. +     shift(@G);
  1109. + }
  1110. + if (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; }
  1111.  
  1112. Index: hints/sco_3.sh
  1113. *** hints/sco_3.sh.old    Mon Nov 11 16:49:31 1991
  1114. --- hints/sco_3.sh    Mon Nov 11 16:49:31 1991
  1115. ***************
  1116. *** 1,4 ****
  1117.   yacc='/usr/bin/yacc -Sm11000'
  1118.   libswanted=`echo $libswanted | sed 's/ x / /'`
  1119. - i_varargs=undef
  1120.   ccflags="$ccflags -U M_XENIX"
  1121. --- 1,7 ----
  1122.   yacc='/usr/bin/yacc -Sm11000'
  1123.   libswanted=`echo $libswanted | sed 's/ x / /'`
  1124.   ccflags="$ccflags -U M_XENIX"
  1125. + cppstdin='/lib/cpp -Di386 -DM_I386 -Dunix -DM_UNIX -DM_INTERNAT -DLAI_TCP'
  1126. + cppminus=''
  1127. + i_varargs=undef
  1128. + d_rename='undef'
  1129.  
  1130. Index: t/op/sort.t
  1131. *** t/op/sort.t.old    Mon Nov 11 16:50:02 1991
  1132. --- t/op/sort.t    Mon Nov 11 16:50:03 1991
  1133. ***************
  1134. *** 1,8 ****
  1135.   #!./perl
  1136.   
  1137. ! # $RCSfile: sort.t,v $$Revision: 4.0.1.1 $$Date: 91/11/05 18:43:47 $
  1138.   
  1139. ! print "1..9\n";
  1140.   
  1141.   sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
  1142.   
  1143. --- 1,8 ----
  1144.   #!./perl
  1145.   
  1146. ! # $RCSfile: sort.t,v $$Revision: 4.0.1.2 $$Date: 91/11/11 16:43:47 $
  1147.   
  1148. ! print "1..10\n";
  1149.   
  1150.   sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
  1151.   
  1152. ***************
  1153. *** 41,43 ****
  1154. --- 41,48 ----
  1155.   @a = (10,2,3,4);
  1156.   @b = sort {$a <=> $b;} @a;
  1157.   print ("@b" eq "2 3 4 10" ? "ok 9\n" : "not ok 9 (@b)\n");
  1158. + $sub = 'reverse';
  1159. + $x = join('', sort $sub @harry);
  1160. + print ($x eq 'xdogcatCainAbel' ? "ok 10\n" : "not ok 10\n");
  1161.  
  1162. Index: t/op/stat.t
  1163. *** t/op/stat.t.old    Mon Nov 11 16:50:04 1991
  1164. --- t/op/stat.t    Mon Nov 11 16:50:05 1991
  1165. ***************
  1166. *** 1,6 ****
  1167.   #!./perl
  1168.   
  1169. ! # $RCSfile: stat.t,v $$Revision: 4.0.1.2 $$Date: 91/11/05 18:44:44 $
  1170.   
  1171.   print "1..56\n";
  1172.   
  1173. --- 1,6 ----
  1174.   #!./perl
  1175.   
  1176. ! # $RCSfile: stat.t,v $$Revision: 4.0.1.3 $$Date: 91/11/11 16:44:49 $
  1177.   
  1178.   print "1..56\n";
  1179.   
  1180. ***************
  1181. *** 11,16 ****
  1182. --- 11,18 ----
  1183.   unlink "Op.stat.tmp";
  1184.   open(FOO, ">Op.stat.tmp");
  1185.   
  1186. + $junk = `ls Op.stat.tmp`;    # hack to make Apollo update link count
  1187.   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  1188.       $blksize,$blocks) = stat(FOO);
  1189.   if ($nlink == 1) {print "ok 1\n";} else {print "not ok 1\n";}
  1190. ***************
  1191. *** 35,41 ****
  1192.   }
  1193.   print "#4    :$mtime: != :$ctime:\n";
  1194.   
  1195. ! `cp /dev/null Op.stat.tmp`;
  1196.   
  1197.   if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
  1198.   if (! -s 'Op.stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";}
  1199. --- 37,44 ----
  1200.   }
  1201.   print "#4    :$mtime: != :$ctime:\n";
  1202.   
  1203. ! `rm -f Op.stat.tmp`;
  1204. ! `touch Op.stat.tmp`;
  1205.   
  1206.   if (-z 'Op.stat.tmp') {print "ok 5\n";} else {print "not ok 5\n";}
  1207.   if (! -s 'Op.stat.tmp') {print "ok 6\n";} else {print "not ok 6\n";}
  1208.  
  1209. Index: toke.c
  1210. *** toke.c.old    Mon Nov 11 16:50:08 1991
  1211. --- toke.c    Mon Nov 11 16:50:10 1991
  1212. ***************
  1213. *** 1,4 ****
  1214. ! /* $RCSfile: toke.c,v $$Revision: 4.0.1.4 $$Date: 91/11/05 19:02:48 $
  1215.    *
  1216.    *    Copyright (c) 1991, Larry Wall
  1217.    *
  1218. --- 1,4 ----
  1219. ! /* $RCSfile: toke.c,v $$Revision: 4.0.1.5 $$Date: 91/11/11 16:45:51 $
  1220.    *
  1221.    *    Copyright (c) 1991, Larry Wall
  1222.    *
  1223. ***************
  1224. *** 6,11 ****
  1225. --- 6,14 ----
  1226.    *    License or the Artistic License, as specified in the README file.
  1227.    *
  1228.    * $Log:    toke.c,v $
  1229. +  * Revision 4.0.1.5  91/11/11  16:45:51  lwall
  1230. +  * patch19: default arg for shift was wrong after first subroutine definition
  1231. +  * 
  1232.    * Revision 4.0.1.4  91/11/05  19:02:48  lwall
  1233.    * patch11: \x and \c were subject to double interpretation in regexps
  1234.    * patch11: prepared for ctype implementations that don't define isascii()
  1235. ***************
  1236. *** 1198,1207 ****
  1237.           FUN2x(O_SUBSTR);
  1238.           if (strEQ(d,"sub")) {
  1239.           yylval.ival = savestack->ary_fill; /* restore stuff on reduce */
  1240. !         if (perldb) {
  1241. !             savelong(&subline);
  1242. !             saveitem(subname);
  1243. !         }
  1244.   
  1245.           subline = curcmd->c_line;
  1246.           d = bufend;
  1247. --- 1201,1208 ----
  1248.           FUN2x(O_SUBSTR);
  1249.           if (strEQ(d,"sub")) {
  1250.           yylval.ival = savestack->ary_fill; /* restore stuff on reduce */
  1251. !         savelong(&subline);
  1252. !         saveitem(subname);
  1253.   
  1254.           subline = curcmd->c_line;
  1255.           d = bufend;
  1256. ***************
  1257. *** 1208,1226 ****
  1258.           while (s < d && isSPACE(*s))
  1259.               s++;
  1260.           if (isALPHA(*s) || *s == '_' || *s == '\'') {
  1261. !             if (perldb) {
  1262. !             str_sset(subname,curstname);
  1263. !             str_ncat(subname,"'",1);
  1264. !             for (d = s+1; isALNUM(*d) || *d == '\''; d++)
  1265. !                 /*SUPPRESS 530*/
  1266. !                 ;
  1267. !             if (d[-1] == '\'')
  1268. !                 d--;
  1269. !             str_ncat(subname,s,d-s);
  1270. !             }
  1271.               *(--s) = '\\';    /* force next ident to WORD */
  1272.           }
  1273. !         else if (perldb)
  1274.               str_set(subname,"?");
  1275.           OPERATOR(SUB);
  1276.           }
  1277. --- 1209,1225 ----
  1278.           while (s < d && isSPACE(*s))
  1279.               s++;
  1280.           if (isALPHA(*s) || *s == '_' || *s == '\'') {
  1281. !             str_sset(subname,curstname);
  1282. !             str_ncat(subname,"'",1);
  1283. !             for (d = s+1; isALNUM(*d) || *d == '\''; d++)
  1284. !             /*SUPPRESS 530*/
  1285. !             ;
  1286. !             if (d[-1] == '\'')
  1287. !             d--;
  1288. !             str_ncat(subname,s,d-s);
  1289.               *(--s) = '\\';    /* force next ident to WORD */
  1290.           }
  1291. !         else
  1292.               str_set(subname,"?");
  1293.           OPERATOR(SUB);
  1294.           }
  1295.  
  1296. Index: usersub.c
  1297. Prereq: 4.0
  1298. *** usersub.c.old    Mon Nov 11 16:50:12 1991
  1299. --- usersub.c    Mon Nov 11 16:50:13 1991
  1300. ***************
  1301. *** 1,4 ****
  1302. ! /* $Header: usersub.c,v 4.0 91/03/20 01:55:56 lwall Locked $
  1303.    *
  1304.    *  This file contains stubs for routines that the user may define to
  1305.    *  set up glue routines for C libraries or to decrypt encrypted scripts
  1306. --- 1,4 ----
  1307. ! /* $RCSfile: usersub.c,v $$Revision: 4.0.1.1 $$Date: 91/11/11 16:47:17 $
  1308.    *
  1309.    *  This file contains stubs for routines that the user may define to
  1310.    *  set up glue routines for C libraries or to decrypt encrypted scripts
  1311. ***************
  1312. *** 5,10 ****
  1313. --- 5,13 ----
  1314.    *  for execution.
  1315.    *
  1316.    * $Log:    usersub.c,v $
  1317. +  * Revision 4.0.1.1  91/11/11  16:47:17  lwall
  1318. +  * patch19: deleted some unused functions from usersub.c
  1319. +  * 
  1320.    * Revision 4.0  91/03/20  01:55:56  lwall
  1321.    * 4.0 baseline.
  1322.    * 
  1323. ***************
  1324. *** 19,25 ****
  1325.   }
  1326.   
  1327.   /*
  1328. !  * The following is supplied by John MacDonald as a means of decrypting
  1329.    * and executing (presumably proprietary) scripts that have been encrypted
  1330.    * by a (presumably secret) method.  The idea is that you supply your own
  1331.    * routine in place of cryptfilter (which is purposefully a very weak
  1332. --- 22,28 ----
  1333.   }
  1334.   
  1335.   /*
  1336. !  * The following is supplied by John Macdonald as a means of decrypting
  1337.    * and executing (presumably proprietary) scripts that have been encrypted
  1338.    * by a (presumably secret) method.  The idea is that you supply your own
  1339.    * routine in place of cryptfilter (which is purposefully a very weak
  1340. ***************
  1341. *** 34,39 ****
  1342. --- 37,48 ----
  1343.   #include <vfork.h>
  1344.   #endif
  1345.   
  1346. + #ifdef CRYPTLOCAL
  1347. + #include "cryptlocal.h"
  1348. + #else    /* ndef CRYPTLOCAL */
  1349.   #define    CRYPT_MAGIC_1    0xfb
  1350.   #define    CRYPT_MAGIC_2    0xf1
  1351.   
  1352. ***************
  1353. *** 47,52 ****
  1354. --- 56,63 ----
  1355.       }
  1356.   }
  1357.   
  1358. + #endif    /* CRYPTLOCAL */
  1359.   #ifndef MSDOS
  1360.   static FILE    *lastpipefile;
  1361.   static int    pipepid;
  1362. ***************
  1363. *** 95,100 ****
  1364. --- 106,112 ----
  1365.       _exit(0);
  1366.       }
  1367.       close(p[1]);
  1368. +     close(fileno(fil));
  1369.       fclose(fil);
  1370.       str = afetch(fdpid,p[0],TRUE);
  1371.       str->str_u.str_useful = pipepid;
  1372. ***************
  1373. *** 112,117 ****
  1374. --- 124,130 ----
  1375.       ch = getc(rsfp);
  1376.       if (ch == CRYPT_MAGIC_1) {
  1377.       if (getc(rsfp) == CRYPT_MAGIC_2) {
  1378. +         if( perldb ) fatal("can't debug an encrypted script");
  1379.           rsfp = mypfiopen( rsfp, cryptfilter );
  1380.           preprocess = 1;    /* force call to pclose when done */
  1381.       }
  1382. ***************
  1383. *** 120,182 ****
  1384.       }
  1385.       else
  1386.       ungetc(ch,rsfp);
  1387. - }
  1388. - FILE *
  1389. - cryptopen(cmd)        /* open a (possibly encrypted) program for input */
  1390. - char    *cmd;
  1391. - {
  1392. -     FILE    *fil = fopen( cmd, "r" );
  1393. -     lastpipefile = Nullfp;
  1394. -     pipepid = 0;
  1395. -     if( fil ) {
  1396. -     int    ch = getc( fil );
  1397. -     int    lines = 0;
  1398. -     int    chars = 0;
  1399. -     /* Search for the magic cookie that starts the encrypted script,
  1400. -     ** while still allowing a few lines of unencrypted text to let
  1401. -     ** '#!' and the nih hack both continue to work.  (These lines
  1402. -     ** will end up being ignored.)
  1403. -     */
  1404. -     while( ch != CRYPT_MAGIC_1 && ch != EOF && lines < 5 && chars < 300 ) {
  1405. -         if( ch == '\n' )
  1406. -         ++lines;
  1407. -         ch = getc( fil );
  1408. -         ++chars;
  1409. -     }
  1410. -     if( ch == CRYPT_MAGIC_1 ) {
  1411. -         if( (ch = getc( fil ) ) == CRYPT_MAGIC_2 ) {
  1412. -         if( perldb ) fatal("can't debug an encrypted script");
  1413. -         /* we found it, decrypt the rest of the file */
  1414. -         fil = mypfiopen( fil, cryptfilter );
  1415. -         return( lastpipefile = fil );
  1416. -         } else
  1417. -         /* if its got MAGIC 1 without MAGIC 2, too bad */
  1418. -         fatal( "bad encryption format" );
  1419. -     }
  1420. -     /* this file is not encrypted - rewind and process it normally */
  1421. -     rewind( fil );
  1422. -     }
  1423. -     return( fil );
  1424. - }
  1425. - VOID
  1426. - cryptclose(fil)
  1427. - FILE    *fil;
  1428. - {
  1429. -     if( fil == Nullfp )
  1430. -     return;
  1431. -     if( fil == lastpipefile )
  1432. -     mypclose( fil );
  1433. -     else
  1434. -     fclose( fil );
  1435.   }
  1436.   #endif /* !MSDOS */
  1437.   
  1438. --- 133,138 ----
  1439.  
  1440. Index: util.c
  1441. *** util.c.old    Mon Nov 11 16:50:15 1991
  1442. --- util.c    Mon Nov 11 16:50:16 1991
  1443. ***************
  1444. *** 1,4 ****
  1445. ! /* $RCSfile: util.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 19:18:26 $
  1446.    *
  1447.    *    Copyright (c) 1991, Larry Wall
  1448.    *
  1449. --- 1,4 ----
  1450. ! /* $RCSfile: util.c,v $$Revision: 4.0.1.4 $$Date: 91/11/11 16:48:54 $
  1451.    *
  1452.    *    Copyright (c) 1991, Larry Wall
  1453.    *
  1454. ***************
  1455. *** 6,11 ****
  1456. --- 6,15 ----
  1457.    *    License or the Artistic License, as specified in the README file.
  1458.    *
  1459.    * $Log:    util.c,v $
  1460. +  * Revision 4.0.1.4  91/11/11  16:48:54  lwall
  1461. +  * patch19: study was busted by 4.018
  1462. +  * patch19: added little-endian pack/unpack options
  1463. +  * 
  1464.    * Revision 4.0.1.3  91/11/05  19:18:26  lwall
  1465.    * patch11: safe malloc code now integrated into Perl's malloc when possible
  1466.    * patch11: index("little", "longer string") could visit faraway places
  1467. ***************
  1468. *** 685,696 ****
  1469.   #ifdef POINTERRIGOR
  1470.       if (littlestr->str_pok & SP_CASEFOLD) {    /* case insignificant? */
  1471.       do {
  1472. ! #ifndef lint
  1473. !         while (big[pos-previous] != first && big[pos-previous] != fold[first]
  1474. !           && (pos += screamnext[pos]) )
  1475. !         /*SUPPRESS 530*/
  1476. !         ;
  1477. ! #endif
  1478.           for (x=big+pos+1-previous,s=little; s < littleend; /**/ ) {
  1479.           if (x >= bigend)
  1480.               return Nullch;
  1481. --- 689,696 ----
  1482.   #ifdef POINTERRIGOR
  1483.       if (littlestr->str_pok & SP_CASEFOLD) {    /* case insignificant? */
  1484.       do {
  1485. !         if (big[pos-previous] != first && big[pos-previous] != fold[first])
  1486. !         continue;
  1487.           for (x=big+pos+1-previous,s=little; s < littleend; /**/ ) {
  1488.           if (x >= bigend)
  1489.               return Nullch;
  1490. ***************
  1491. *** 715,725 ****
  1492.       }
  1493.       else {
  1494.       do {
  1495. ! #ifndef lint
  1496. !         while (big[pos-previous] != first && (pos += screamnext[pos]))
  1497. !         /*SUPPRESS 530*/
  1498. !         ;
  1499. ! #endif
  1500.           for (x=big+pos+1-previous,s=little; s < littleend; /**/ ) {
  1501.           if (x >= bigend)
  1502.               return Nullch;
  1503. --- 715,722 ----
  1504.       }
  1505.       else {
  1506.       do {
  1507. !         if (big[pos-previous] != first)
  1508. !         continue;
  1509.           for (x=big+pos+1-previous,s=little; s < littleend; /**/ ) {
  1510.           if (x >= bigend)
  1511.               return Nullch;
  1512. ***************
  1513. *** 746,757 ****
  1514.       big -= previous;
  1515.       if (littlestr->str_pok & SP_CASEFOLD) {    /* case insignificant? */
  1516.       do {
  1517. ! #ifndef lint
  1518. !         while (big[pos] != first && big[pos] != fold[first]
  1519. !           && (pos += screamnext[pos]) )
  1520. !         /*SUPPRESS 530*/
  1521. !         ;
  1522. ! #endif
  1523.           for (x=big+pos+1,s=little; s < littleend; /**/ ) {
  1524.           if (x >= bigend)
  1525.               return Nullch;
  1526. --- 743,750 ----
  1527.       big -= previous;
  1528.       if (littlestr->str_pok & SP_CASEFOLD) {    /* case insignificant? */
  1529.       do {
  1530. !         if (big[pos] != first && big[pos] != fold[first])
  1531. !         continue;
  1532.           for (x=big+pos+1,s=little; s < littleend; /**/ ) {
  1533.           if (x >= bigend)
  1534.               return Nullch;
  1535. ***************
  1536. *** 776,786 ****
  1537.       }
  1538.       else {
  1539.       do {
  1540. ! #ifndef lint
  1541. !         while (big[pos] != first && (pos += screamnext[pos]))
  1542. !         /*SUPPRESS 530*/
  1543. !         ;
  1544. ! #endif
  1545.           for (x=big+pos+1,s=little; s < littleend; /**/ ) {
  1546.           if (x >= bigend)
  1547.               return Nullch;
  1548. --- 769,776 ----
  1549.       }
  1550.       else {
  1551.       do {
  1552. !         if (big[pos] != first)
  1553. !         continue;
  1554.           for (x=big+pos+1,s=little; s < littleend; /**/ ) {
  1555.           if (x >= bigend)
  1556.               return Nullch;
  1557. ***************
  1558. *** 1236,1241 ****
  1559. --- 1226,1239 ----
  1560.   #endif /* HAS_VPRINTF */
  1561.   #endif /* I_VARARGS */
  1562.   
  1563. + /*
  1564. +  * I think my_swap(), htonl() and ntohl() have never been used.
  1565. +  * perl.h contains last-chance references to my_swap(), my_htonl()
  1566. +  * and my_ntohl().  I presume these are the intended functions;
  1567. +  * but htonl() and ntohl() have the wrong names.  There are no
  1568. +  * functions my_htonl() and my_ntohl() defined anywhere.
  1569. +  * -DWS
  1570. +  */
  1571.   #ifdef MYSWAP
  1572.   #if BYTEORDER != 0x4321
  1573.   short
  1574. ***************
  1575. *** 1315,1321 ****
  1576.   }
  1577.   
  1578.   #endif /* BYTEORDER != 0x4321 */
  1579. ! #endif /* HAS_HTONS */
  1580.   
  1581.   #ifndef MSDOS
  1582.   FILE *
  1583. --- 1313,1376 ----
  1584.   }
  1585.   
  1586.   #endif /* BYTEORDER != 0x4321 */
  1587. ! #endif /* MYSWAP */
  1588. ! /*
  1589. !  * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
  1590. !  * If these functions are defined,
  1591. !  * the BYTEORDER is neither 0x1234 nor 0x4321.
  1592. !  * However, this is not assumed.
  1593. !  * -DWS
  1594. !  */
  1595. ! #define HTOV(name,type)                        \
  1596. !     type                            \
  1597. !     name (n)                        \
  1598. !     register type n;                    \
  1599. !     {                            \
  1600. !         union {                        \
  1601. !         type value;                    \
  1602. !         char c[sizeof(type)];                \
  1603. !         } u;                        \
  1604. !         register int i;                    \
  1605. !         register int s;                    \
  1606. !         for (i = 0, s = 0; i < sizeof(u.c); i++, s += 8) {    \
  1607. !         u.c[i] = (n >> s) & 0xFF;            \
  1608. !         }                            \
  1609. !         return u.value;                    \
  1610. !     }
  1611. ! #define VTOH(name,type)                        \
  1612. !     type                            \
  1613. !     name (n)                        \
  1614. !     register type n;                    \
  1615. !     {                            \
  1616. !         union {                        \
  1617. !         type value;                    \
  1618. !         char c[sizeof(type)];                \
  1619. !         } u;                        \
  1620. !         register int i;                    \
  1621. !         register int s;                    \
  1622. !         u.value = n;                    \
  1623. !         n = 0;                        \
  1624. !         for (i = 0, s = 0; i < sizeof(u.c); i++, s += 8) {    \
  1625. !         n += (u.c[i] & 0xFF) << s;            \
  1626. !         }                            \
  1627. !         return n;                        \
  1628. !     }
  1629. ! #if defined(HAS_HTOVS) && !defined(htovs)
  1630. ! HTOV(htovs,short)
  1631. ! #endif
  1632. ! #if defined(HAS_HTOVL) && !defined(htovl)
  1633. ! HTOV(htovl,long)
  1634. ! #endif
  1635. ! #if defined(HAS_VTOHS) && !defined(vtohs)
  1636. ! VTOH(vtohs,short)
  1637. ! #endif
  1638. ! #if defined(HAS_VTOHL) && !defined(vtohl)
  1639. ! VTOH(vtohl,long)
  1640. ! #endif
  1641.   
  1642.   #ifndef MSDOS
  1643.   FILE *
  1644.  
  1645. Index: hints/uts.sh
  1646. *** hints/uts.sh.old    Mon Nov 11 16:49:33 1991
  1647. --- hints/uts.sh    Mon Nov 11 16:49:33 1991
  1648. ***************
  1649. *** 1,2 ****
  1650. ! ccflags="$ccflags -DCRIPPLED_CC -g"
  1651. ! d_lstat=$undef
  1652. --- 1,2 ----
  1653. ! ccflags="$ccflags -DCRIPPLED_CC"
  1654. ! d_lstat=$define
  1655. exit 0 # Just in case...
  1656. -- 
  1657. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1658. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1659. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1660. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1661.