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

  1. Newsgroups: comp.sources.misc
  2. From: lwall@netlabs.com (Larry Wall)
  3. Subject:  v25i067:  perl - The perl programming language, Patch18
  4. Message-ID: <1991Nov13.214743.4194@sparky.imd.sterling.com>
  5. X-Md4-Signature: 92b3f4b5b176a41c5507726daf138a90
  6. Date: Wed, 13 Nov 1991 21:47:43 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: lwall@netlabs.com (Larry Wall)
  10. Posting-number: Volume 25, Issue 67
  11. Archive-name: perl/patch18
  12. Environment: UNIX, MS-DOS, OS2
  13. Patch-To: perl: Volume 18, Issue 19-54
  14.  
  15. System: perl version 4.0
  16. Patch #: 18
  17. Priority: MED-HIGH
  18. Subject: patch #11, continued
  19.  
  20. Description:
  21.     See patch #11.
  22.  
  23. Fix:    From rn, say "| patch -p -N -d DIR", where DIR is your perl source
  24.     directory.  Outside of rn, say "cd DIR; patch -p -N <thisarticle".
  25.     If you don't have the patch program, apply the following by hand,
  26.     or get patch (version 2.0, latest patchlevel).
  27.  
  28.     After patching:
  29.         Configure -d
  30.         make depend
  31.         make
  32.         make test
  33.         make install
  34.  
  35.     If patch indicates that patchlevel is the wrong version, you may need
  36.     to apply one or more previous patches, or the patch may already
  37.     have been applied.  See the patchlevel.h file to find out what has or
  38.     has not been applied.  In any event, don't continue with the patch.
  39.  
  40.     If you are missing previous patches they can be obtained from me:
  41.  
  42.     Larry Wall
  43.     lwall@netlabs.com
  44.  
  45.     If you send a mail message of the following form it will greatly speed
  46.     processing:
  47.  
  48.     Subject: Command
  49.     @SH mailpatch PATH perl 4.0 LIST
  50.            ^ note the c
  51.  
  52.     where PATH is a return path FROM ME TO YOU either in Internet notation,
  53.     or in bang notation from some well-known host, and LIST is the number
  54.     of one or more patches you need, separated by spaces, commas, and/or
  55.     hyphens.  Saying 35- says everything from 35 to the end.
  56.  
  57.  
  58. Index: patchlevel.h
  59. Prereq: 17
  60. 1c1
  61. < #define PATCHLEVEL 17
  62. ---
  63. > #define PATCHLEVEL 18
  64.  
  65. Index: x2p/util.h
  66. *** x2p/util.h.old    Tue Nov  5 19:28:37 1991
  67. --- x2p/util.h    Tue Nov  5 19:28:38 1991
  68. ***************
  69. *** 1,4 ****
  70. ! /* $RCSfile: util.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:20:43 $
  71.    *
  72.    *    Copyright (c) 1991, Larry Wall
  73.    *
  74. --- 1,4 ----
  75. ! /* $RCSfile: util.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 19:21:20 $
  76.    *
  77.    *    Copyright (c) 1991, Larry Wall
  78.    *
  79. ***************
  80. *** 6,11 ****
  81. --- 6,14 ----
  82.    *    License or the Artistic License, as specified in the README file.
  83.    *
  84.    * $Log:    util.h,v $
  85. +  * Revision 4.0.1.2  91/11/05  19:21:20  lwall
  86. +  * patch11: various portability fixes
  87. +  * 
  88.    * Revision 4.0.1.1  91/06/07  12:20:43  lwall
  89.    * patch4: new copyright notice
  90.    * 
  91. ***************
  92. *** 15,20 ****
  93. --- 18,25 ----
  94.    */
  95.   
  96.   /* is the string for makedir a directory name or a filename? */
  97. + #define fatal Myfatal
  98.   
  99.   #define MD_DIR 0
  100.   #define MD_FILE 1
  101.  
  102. Index: x2p/walk.c
  103. *** x2p/walk.c.old    Tue Nov  5 19:28:40 1991
  104. --- x2p/walk.c    Tue Nov  5 19:28:41 1991
  105. ***************
  106. *** 1,4 ****
  107. ! /* $RCSfile: walk.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:22:04 $
  108.    *
  109.    *    Copyright (c) 1991, Larry Wall
  110.    *
  111. --- 1,4 ----
  112. ! /* $RCSfile: walk.c,v $$Revision: 4.0.1.2 $$Date: 91/11/05 19:25:09 $
  113.    *
  114.    *    Copyright (c) 1991, Larry Wall
  115.    *
  116. ***************
  117. *** 6,11 ****
  118. --- 6,14 ----
  119.    *    License or the Artistic License, as specified in the README file.
  120.    *
  121.    * $Log:    walk.c,v $
  122. +  * Revision 4.0.1.2  91/11/05  19:25:09  lwall
  123. +  * patch11: in a2p, split on whitespace produced extra null field
  124. +  * 
  125.    * Revision 4.0.1.1  91/06/07  12:22:04  lwall
  126.    * patch4: new copyright notice
  127.    * patch4: a2p didn't correctly implement -n switch
  128. ***************
  129. *** 30,35 ****
  130. --- 33,39 ----
  131.   int maxtmp = 0;
  132.   char *lparen;
  133.   char *rparen;
  134. + char *limit;
  135.   STR *subs;
  136.   STR *curargs = Nullstr;
  137.   
  138. ***************
  139. *** 670,675 ****
  140. --- 674,680 ----
  141.       break;
  142.       case OSPLIT:
  143.       str = str_new(0);
  144. +     limit = ", 9999)";
  145.       numeric = 1;
  146.       tmpstr = walk(1,level,ops[node+2].ival,&numarg,P_MIN);
  147.       if (useval)
  148. ***************
  149. *** 700,711 ****
  150.       }
  151.       else if (saw_FS)
  152.           str_cat(str,"$FS");
  153. !     else
  154.           str_cat(str,"' '");
  155.       str_cat(str,", ");
  156.       str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1));
  157.       str_free(fstr);
  158. !     str_cat(str,", 9999)");
  159.       if (useval) {
  160.           str_cat(str,")");
  161.       }
  162. --- 705,718 ----
  163.       }
  164.       else if (saw_FS)
  165.           str_cat(str,"$FS");
  166. !     else {
  167.           str_cat(str,"' '");
  168. +         limit = ")";
  169. +     }
  170.       str_cat(str,", ");
  171.       str_scat(str,fstr=walk(1,level,ops[node+1].ival,&numarg,P_COMMA+1));
  172.       str_free(fstr);
  173. !     str_cat(str,limit);
  174.       if (useval) {
  175.           str_cat(str,")");
  176.       }
  177.  
  178. Index: MANIFEST
  179. *** MANIFEST.old    Tue Nov  5 21:09:16 1991
  180. --- MANIFEST    Tue Nov  5 21:09:18 1991
  181. ***************
  182. *** 13,18 ****
  183. --- 13,20 ----
  184.   arg.h            Public declarations for the above
  185.   array.c            Numerically subscripted arrays
  186.   array.h            Public declarations for the above
  187. + c2ph.SH            program to translate dbx stabs to perl
  188. + c2ph.doc        documentation for c2ph
  189.   cflags.SH        A script that emits C compilation flags per file
  190.   client            A client to test sockets
  191.   cmd.c            Command interpreter
  192. ***************
  193. *** 65,73 ****
  194.   eg/van/vanexp        A program to expire vanished files
  195.   eg/van/vanish        A program to put files in a trashcan
  196.   eg/who            A sample who program
  197. - emacs/perldb.pl        Emacs debugging
  198. - emacs/perldb.el        Emacs debugging
  199.   emacs/perl-mode.el    Emacs major mode for perl
  200.   emacs/tedstuff        Some optional patches
  201.   eval.c            The expression evaluator
  202.   form.c            Format processing
  203. --- 67,75 ----
  204.   eg/van/vanexp        A program to expire vanished files
  205.   eg/van/vanish        A program to put files in a trashcan
  206.   eg/who            A sample who program
  207.   emacs/perl-mode.el    Emacs major mode for perl
  208. + emacs/perldb.el        Emacs debugging
  209. + emacs/perldb.pl        Emacs debugging
  210.   emacs/tedstuff        Some optional patches
  211.   eval.c            The expression evaluator
  212.   form.c            Format processing
  213. ***************
  214. *** 93,111 ****
  215. --- 95,119 ----
  216.   hints/3b2.sh
  217.   hints/aix_rs.sh
  218.   hints/aix_rt.sh
  219. + hints/altos486.sh    
  220.   hints/apollo_C6_7.sh
  221. + hints/apollo_C6_8.sh    
  222.   hints/aux.sh
  223.   hints/dnix.sh
  224.   hints/dynix.sh
  225.   hints/fps.sh
  226.   hints/genix.sh
  227. + hints/greenhills.sh    
  228.   hints/hp9000_300.sh
  229.   hints/hp9000_400.sh
  230. + hints/hp9000_800.sh    
  231.   hints/hpux.sh
  232.   hints/i386.sh
  233.   hints/mips.sh
  234. + hints/mpc.sh    
  235.   hints/ncr_tower.sh
  236.   hints/next.sh
  237. + hints/opus.sh    
  238.   hints/osf_1.sh
  239.   hints/sco_2_3_0.sh
  240.   hints/sco_2_3_1.sh
  241. ***************
  242. *** 113,123 ****
  243. --- 121,133 ----
  244.   hints/sco_2_3_3.sh
  245.   hints/sco_3.sh
  246.   hints/sgi.sh
  247. + hints/stellar.sh    
  248.   hints/sunos_3_4.sh
  249.   hints/sunos_3_5.sh
  250.   hints/sunos_4_0_1.sh
  251.   hints/sunos_4_0_2.sh
  252.   hints/svr4.sh
  253. + hints/ti1500.sh    
  254.   hints/ultrix_3.sh
  255.   hints/ultrix_4.sh
  256.   hints/uts.sh
  257. ***************
  258. *** 125,140 ****
  259. --- 135,155 ----
  260.   installperl        Perl script to do "make install" dirty work
  261.   ioctl.pl        Sample ioctl.pl
  262.   lib/abbrev.pl        An abbreviation table builder
  263. + lib/assert.pl        assertion and panic with stack trace
  264.   lib/bigfloat.pl        An arbitrary precision floating point package
  265.   lib/bigint.pl        An arbitrary precision integer arithmetic package
  266.   lib/bigrat.pl        An arbitrary precision rational arithmetic package
  267.   lib/cacheout.pl        Manages output filehandles when you need too many
  268. + lib/chat2.pl        Randal's famous expect-ish routines
  269.   lib/complete.pl        A command completion subroutine
  270.   lib/ctime.pl        A ctime workalike
  271.   lib/dumpvar.pl        A variable dumper
  272. + lib/exceptions.pl    catch and throw routines
  273. + lib/fastcwd.pl        a faster but more dangerous getcwd
  274.   lib/find.pl        A find emulator--used by find2perl
  275.   lib/finddepth.pl    A depth-first find emulator--used by find2perl
  276.   lib/flush.pl        Routines to do single flush
  277. + lib/getcwd.pl        a getcwd() emulator
  278.   lib/getopt.pl        Perl library supporting option parsing
  279.   lib/getopts.pl        Perl library supporting option parsing
  280.   lib/importenv.pl    Perl routine to get environment into variables
  281. ***************
  282. *** 155,162 ****
  283.   msdos/Makefile        MS-DOS makefile
  284.   msdos/README.msdos    Compiling and usage information
  285.   msdos/Wishlist.dds    My wishlist
  286. - msdos/config.h        Definitions for msdos
  287.   msdos/chdir.c        A chdir that can change drives
  288.   msdos/dir.h        MS-DOS header for directory access functions
  289.   msdos/directory.c    MS-DOS directory access functions.
  290.   msdos/eg/crlf.bat    Convert files from unix to MS-DOS line termination
  291. --- 170,177 ----
  292.   msdos/Makefile        MS-DOS makefile
  293.   msdos/README.msdos    Compiling and usage information
  294.   msdos/Wishlist.dds    My wishlist
  295.   msdos/chdir.c        A chdir that can change drives
  296. + msdos/config.h        Definitions for msdos
  297.   msdos/dir.h        MS-DOS header for directory access functions
  298.   msdos/directory.c    MS-DOS directory access functions.
  299.   msdos/eg/crlf.bat    Convert files from unix to MS-DOS line termination
  300. ***************
  301. *** 200,207 ****
  302.   perl.h            Global declarations
  303.   perl.man        The manual page(s)
  304.   perlsh            A poor man's perl shell
  305. - perly.y            Yacc grammar for perl
  306.   perly.fixer        A program to remove yacc stack limitations
  307.   regcomp.c        Regular expression compiler
  308.   regcomp.h        Private declarations for above
  309.   regexec.c        Regular expression evaluator
  310. --- 215,222 ----
  311.   perl.h            Global declarations
  312.   perl.man        The manual page(s)
  313.   perlsh            A poor man's perl shell
  314.   perly.fixer        A program to remove yacc stack limitations
  315. + perly.y            Yacc grammar for perl
  316.   regcomp.c        Regular expression compiler
  317.   regcomp.h        Private declarations for above
  318.   regexec.c        Regular expression evaluator
  319. ***************
  320. *** 270,275 ****
  321. --- 285,291 ----
  322.   t/op/pat.t        See if esoteric patterns work
  323.   t/op/push.t        See if push and pop work
  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/regexp.t        See if regular expressions work
  328.   t/op/repeat.t        See if x operator works
  329. ***************
  330. *** 286,296 ****
  331.   t/op/unshift.t        See if unshift works
  332.   t/op/vec.t        See if vectors work
  333.   t/op/write.t        See if write works
  334. - t/op/re_tests        Input file for op.regexp
  335.   toke.c            The tokener
  336.   usersub.c        User supplied (possibly proprietary) subroutines
  337. - usub/README        Instructions for user supplied subroutines
  338.   usub/Makefile        Makefile for curseperl
  339.   usub/curses.mus        Glue routines for BSD curses
  340.   usub/man2mus        A manual page to .mus translator
  341.   usub/mus        A .mus to .c translator
  342. --- 302,312 ----
  343.   t/op/unshift.t        See if unshift works
  344.   t/op/vec.t        See if vectors work
  345.   t/op/write.t        See if write works
  346.   toke.c            The tokener
  347.   usersub.c        User supplied (possibly proprietary) subroutines
  348.   usub/Makefile        Makefile for curseperl
  349. + usub/README        Instructions for user supplied subroutines
  350. + usub/bsdcurses.mus    what used to be curses.mus
  351.   usub/curses.mus        Glue routines for BSD curses
  352.   usub/man2mus        A manual page to .mus translator
  353.   usub/mus        A .mus to .c translator
  354.  
  355. Index: usub/README
  356. *** usub/README.old    Tue Nov  5 19:28:13 1991
  357. --- usub/README    Tue Nov  5 19:28:14 1991
  358. ***************
  359. *** 6,14 ****
  360.   
  361.   The sole purpose of the userinit() routine is to call the initialization
  362.   routines for any modules that you want to link in.  In this example, we just
  363. ! call init_curses(), which sets up to link in the BSD curses routines.
  364.   You'll find this in the file curses.c, which is the processed output of
  365. ! curses.mus.
  366.   
  367.   The magicname() routine adds variable names into the symbol table.  Along
  368.   with the name of the variable as Perl knows it, we pass a structure containing
  369. --- 6,14 ----
  370.   
  371.   The sole purpose of the userinit() routine is to call the initialization
  372.   routines for any modules that you want to link in.  In this example, we just
  373. ! call init_curses(), which sets up to link in the System V curses routines.
  374.   You'll find this in the file curses.c, which is the processed output of
  375. ! curses.mus.  (To get BSD curses, replace curses.mus with bsdcurses.mus.)
  376.   
  377.   The magicname() routine adds variable names into the symbol table.  Along
  378.   with the name of the variable as Perl knows it, we pass a structure containing
  379. ***************
  380. *** 96,110 ****
  381.   But it can save you a lot of time if the man pages for a library are
  382.   reasonably well formed.
  383.   
  384. ! If you happen to have BSD curses on your machine, you might try compiling
  385.   a copy of curseperl.  The "pager" program in this directory is a rudimentary
  386.   start on writing a pager--don't believe the help message, which is stolen
  387.   from the less program.
  388.   
  389. - There is currently no official way to call a Perl routine back from C,
  390. - but we're working on it.  It might be easiest to fake up a call to do_eval()
  391. - or do_subr().  This is not for the faint of heart.  If you come up with
  392. - such a glue routine, I'll be glad to add it into the distribution.
  393.   User-defined subroutines may not currently be called as a signal handler,
  394.   though a signal handler may itself call a user-defined subroutine.
  395. --- 96,114 ----
  396.   But it can save you a lot of time if the man pages for a library are
  397.   reasonably well formed.
  398.   
  399. ! If you happen to have curses on your machine, you might try compiling
  400.   a copy of curseperl.  The "pager" program in this directory is a rudimentary
  401.   start on writing a pager--don't believe the help message, which is stolen
  402.   from the less program.
  403.   
  404.   User-defined subroutines may not currently be called as a signal handler,
  405.   though a signal handler may itself call a user-defined subroutine.
  406. + There are now glue routines to call back from C into Perl.  In usersub.c
  407. + in this directory, you'll find callback() and callv().  The callback()
  408. + routine presumes that any arguments to pass to the Perl subroutine
  409. + have already been pushed onto the Perl stack.  The callv() routine
  410. + is a wrapper that pushes an argv-style array of strings onto the
  411. + stack for you, and then calls callback().  Be sure to recheck your
  412. + stack pointer after returning from these routine, since the Perl code
  413. + may have reallocated it.
  414.  
  415. Index: arg.h
  416. *** arg.h.old    Tue Nov  5 19:25:28 1991
  417. --- arg.h    Tue Nov  5 19:25:29 1991
  418. ***************
  419. *** 1,4 ****
  420. ! /* $RCSfile: arg.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:18:30 $
  421.    *
  422.    *    Copyright (c) 1991, Larry Wall
  423.    *
  424. --- 1,4 ----
  425. ! /* $RCSfile: arg.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 15:51:05 $
  426.    *
  427.    *    Copyright (c) 1991, Larry Wall
  428.    *
  429. ***************
  430. *** 6,11 ****
  431. --- 6,15 ----
  432.    *    License or the Artistic License, as specified in the README file.
  433.    *
  434.    * $Log:    arg.h,v $
  435. +  * Revision 4.0.1.2  91/11/05  15:51:05  lwall
  436. +  * patch11: added eval {}
  437. +  * patch11: added sort {} LIST
  438. +  * 
  439.    * Revision 4.0.1.1  91/06/07  10:18:30  lwall
  440.    * patch4: length($`), length($&), length($') now optimized to avoid string copy
  441.    * patch4: new copyright notice
  442. ***************
  443. *** 283,289 ****
  444.   #define O_CLOSEDIR 264
  445.   #define O_SYSCALL 265
  446.   #define O_PIPE 266
  447. ! #define MAXO 267
  448.   
  449.   #ifndef DOINIT
  450.   extern char *opname[];
  451. --- 287,295 ----
  452.   #define O_CLOSEDIR 264
  453.   #define O_SYSCALL 265
  454.   #define O_PIPE 266
  455. ! #define O_TRY 267
  456. ! #define O_EVALONCE 268
  457. ! #define MAXO 269
  458.   
  459.   #ifndef DOINIT
  460.   extern char *opname[];
  461. ***************
  462. *** 556,562 ****
  463.       "CLOSEDIR",
  464.       "SYSCALL",
  465.       "PIPE",
  466. !     "267"
  467.   };
  468.   #endif
  469.   
  470. --- 562,570 ----
  471.       "CLOSEDIR",
  472.       "SYSCALL",
  473.       "PIPE",
  474. !     "TRY",
  475. !     "EVALONCE",
  476. !     "269"
  477.   };
  478.   #endif
  479.   
  480. ***************
  481. *** 957,962 ****
  482. --- 965,972 ----
  483.       A(1,0,0),    /* CLOSEDIR */
  484.       A(1,3,0),    /* SYSCALL */
  485.       A(1,1,0),    /* PIPE */
  486. +     A(0,0,0),    /* TRY */
  487. +     A(1,0,0),    /* EVALONCE */
  488.       0
  489.   };
  490.   #undef A
  491.  
  492. Index: array.c
  493. *** array.c.old    Tue Nov  5 19:25:32 1991
  494. --- array.c    Tue Nov  5 19:25:32 1991
  495. ***************
  496. *** 1,4 ****
  497. ! /* $RCSfile: array.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:19:08 $
  498.    *
  499.    *    Copyright (c) 1991, Larry Wall
  500.    *
  501. --- 1,4 ----
  502. ! /* $RCSfile: array.c,v $$Revision: 4.0.1.2 $$Date: 91/11/05 16:00:14 $
  503.    *
  504.    *    Copyright (c) 1991, Larry Wall
  505.    *
  506. ***************
  507. *** 6,11 ****
  508. --- 6,15 ----
  509.    *    License or the Artistic License, as specified in the README file.
  510.    *
  511.    * $Log:    array.c,v $
  512. +  * Revision 4.0.1.2  91/11/05  16:00:14  lwall
  513. +  * patch11: random cleanup
  514. +  * patch11: passing non-existend array elements to subrouting caused core dump
  515. +  * 
  516.    * Revision 4.0.1.1  91/06/07  10:19:08  lwall
  517.    * patch4: new copyright notice
  518.    * 
  519. ***************
  520. *** 87,103 ****
  521.           ar->ary_max = newmax;
  522.       }
  523.       }
  524. !     if ((ar->ary_flags & ARF_REAL) && ar->ary_fill < key) {
  525. !     while (++ar->ary_fill < key) {
  526. !         if (ar->ary_array[ar->ary_fill] != Nullstr) {
  527. !         str_free(ar->ary_array[ar->ary_fill]);
  528. !         ar->ary_array[ar->ary_fill] = Nullstr;
  529.           }
  530.       }
  531.       }
  532. !     retval = (ar->ary_array[key] != Nullstr);
  533. !     if (retval && (ar->ary_flags & ARF_REAL))
  534. !     str_free(ar->ary_array[key]);
  535.       ar->ary_array[key] = val;
  536.       return retval;
  537.   }
  538. --- 91,111 ----
  539.           ar->ary_max = newmax;
  540.       }
  541.       }
  542. !     if (ar->ary_flags & ARF_REAL) {
  543. !     if (ar->ary_fill < key) {
  544. !         while (++ar->ary_fill < key) {
  545. !         if (ar->ary_array[ar->ary_fill] != Nullstr) {
  546. !             str_free(ar->ary_array[ar->ary_fill]);
  547. !             ar->ary_array[ar->ary_fill] = Nullstr;
  548. !         }
  549.           }
  550.       }
  551. +     retval = (ar->ary_array[key] != Nullstr);
  552. +     if (retval)
  553. +         str_free(ar->ary_array[key]);
  554.       }
  555. !     else
  556. !     retval = 0;
  557.       ar->ary_array[key] = val;
  558.       return retval;
  559.   }
  560. ***************
  561. *** 135,141 ****
  562.       ar->ary_max = size - 1;
  563.       ar->ary_flags = 0;
  564.       while (size--) {
  565. !     (*strp++)->str_pok &= ~SP_TEMP;
  566.       }
  567.       return ar;
  568.   }
  569. --- 143,151 ----
  570.       ar->ary_max = size - 1;
  571.       ar->ary_flags = 0;
  572.       while (size--) {
  573. !     if (*strp)
  574. !         (*strp)->str_pok &= ~SP_TEMP;
  575. !     strp++;
  576.       }
  577.       return ar;
  578.   }
  579. ***************
  580. *** 148,153 ****
  581. --- 158,164 ----
  582.   
  583.       if (!ar || !(ar->ary_flags & ARF_REAL) || ar->ary_max < 0)
  584.       return;
  585. +     /*SUPPRESS 560*/
  586.       if (key = ar->ary_array - ar->ary_alloc) {
  587.       ar->ary_max += key;
  588.       ar->ary_array -= key;
  589. ***************
  590. *** 166,171 ****
  591. --- 177,183 ----
  592.   
  593.       if (!ar)
  594.       return;
  595. +     /*SUPPRESS 560*/
  596.       if (key = ar->ary_array - ar->ary_alloc) {
  597.       ar->ary_max += key;
  598.       ar->ary_array -= key;
  599. ***************
  600. *** 222,228 ****
  601.   #ifdef BUGGY_MSC5
  602.    # pragma loop_opt(off)    /* don't loop-optimize the following code */
  603.   #endif /* BUGGY_MSC5 */
  604. !     for (i = ar->ary_fill; i >= 0; i--) {
  605.           *dstr-- = *sstr--;
  606.   #ifdef BUGGY_MSC5
  607.    # pragma loop_opt()    /* loop-optimization back to command-line setting */
  608. --- 234,240 ----
  609.   #ifdef BUGGY_MSC5
  610.    # pragma loop_opt(off)    /* don't loop-optimize the following code */
  611.   #endif /* BUGGY_MSC5 */
  612. !     for (i = ar->ary_fill - num; i >= 0; i--) {
  613.           *dstr-- = *sstr--;
  614.   #ifdef BUGGY_MSC5
  615.    # pragma loop_opt()    /* loop-optimization back to command-line setting */
  616.  
  617. Index: cmd.c
  618. *** cmd.c.old    Tue Nov  5 19:25:41 1991
  619. --- cmd.c    Tue Nov  5 19:25:41 1991
  620. ***************
  621. *** 1,4 ****
  622. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 10:26:45 $
  623.    *
  624.    *    Copyright (c) 1991, Larry Wall
  625.    *
  626. --- 1,4 ----
  627. ! /* $RCSfile: cmd.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 16:07:43 $
  628.    *
  629.    *    Copyright (c) 1991, Larry Wall
  630.    *
  631. ***************
  632. *** 6,11 ****
  633. --- 6,16 ----
  634.    *    License or the Artistic License, as specified in the README file.
  635.    *
  636.    * $Log:    cmd.c,v $
  637. +  * Revision 4.0.1.3  91/11/05  16:07:43  lwall
  638. +  * patch11: random cleanup
  639. +  * patch11: "foo\0" eq "foo" was sometimes optimized to true
  640. +  * patch11: foreach on null list could spring memory leak
  641. +  * 
  642.    * Revision 4.0.1.2  91/06/07  10:26:45  lwall
  643.    * patch4: new copyright notice
  644.    * patch4: made some allowances for "semi-standard" C
  645. ***************
  646. *** 230,236 ****
  647.   #endif
  648.               newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp);
  649.               st = stack->ary_array;    /* possibly reallocated */
  650. !             retstr = st[newsp];
  651.           }
  652.           if (!goto_targ) {
  653.               go_to = Nullch;
  654. --- 235,242 ----
  655.   #endif
  656.               newsp = cmd_exec(cmd->ucmd.ccmd.cc_true,gimme && (cmdflags & CF_TERM),sp);
  657.               st = stack->ary_array;    /* possibly reallocated */
  658. !             if (newsp >= 0)
  659. !             retstr = st[newsp];
  660.           }
  661.           if (!goto_targ) {
  662.               go_to = Nullch;
  663. ***************
  664. *** 250,256 ****
  665.   #endif
  666.               newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme && (cmdflags & CF_TERM),sp);
  667.               st = stack->ary_array;    /* possibly reallocated */
  668. !             retstr = st[newsp];
  669.           }
  670.           if (goto_targ)
  671.               break;
  672. --- 256,263 ----
  673.   #endif
  674.               newsp = cmd_exec(cmd->ucmd.ccmd.cc_alt,gimme && (cmdflags & CF_TERM),sp);
  675.               st = stack->ary_array;    /* possibly reallocated */
  676. !             if (newsp >= 0)
  677. !             retstr = st[newsp];
  678.           }
  679.           if (goto_targ)
  680.               break;
  681. ***************
  682. *** 331,342 ****
  683.           else
  684.               break;        /* must evaluate */
  685.           }
  686. !         /* FALL THROUGH */
  687.       case CFT_STROP:        /* string op optimization */
  688.           retstr = STAB_STR(cmd->c_stab);
  689.           newsp = -2;
  690.   #ifndef I286
  691.           if (*cmd->c_short->str_ptr == *str_get(retstr) &&
  692.               bcmp(cmd->c_short->str_ptr, str_get(retstr),
  693.                 cmd->c_slen) == 0 ) {
  694.           if (cmdflags & CF_EQSURE) {
  695. --- 338,355 ----
  696.           else
  697.               break;        /* must evaluate */
  698.           }
  699. !         match = 0;
  700. !         goto strop;
  701.       case CFT_STROP:        /* string op optimization */
  702. +         match = 1;
  703. +       strop:
  704.           retstr = STAB_STR(cmd->c_stab);
  705.           newsp = -2;
  706.   #ifndef I286
  707.           if (*cmd->c_short->str_ptr == *str_get(retstr) &&
  708. +             (match ? retstr->str_cur == cmd->c_slen - 1 :
  709. +                      retstr->str_cur >= cmd->c_slen) &&
  710.               bcmp(cmd->c_short->str_ptr, str_get(retstr),
  711.                 cmd->c_slen) == 0 ) {
  712.           if (cmdflags & CF_EQSURE) {
  713. ***************
  714. *** 576,581 ****
  715. --- 589,597 ----
  716.           }
  717.   
  718.           if (match >= ar->ary_fill) {    /* we're in LAST, probably */
  719. +         if (match < 0 &&        /* er, probably not... */
  720. +           savestack->ary_fill > aryoptsave)
  721. +             restorelist(aryoptsave);
  722.           retstr = &str_undef;
  723.           cmd->c_short->str_u.str_useful = -1;    /* actually redundant */
  724.           match = FALSE;
  725.  
  726. Index: lib/complete.pl
  727. *** lib/complete.pl.old    Tue Nov  5 19:26:54 1991
  728. --- lib/complete.pl    Tue Nov  5 19:26:54 1991
  729. ***************
  730. *** 1,5 ****
  731.   ;#
  732. ! ;#    @(#)complete.pl    1.0 (sun!waynet) 11/11/88
  733.   ;#
  734.   ;# Author: Wayne Thompson
  735.   ;#
  736. --- 1,5 ----
  737.   ;#
  738. ! ;#      @(#)complete.pl,v1.1            (me@anywhere.EBay.Sun.COM) 09/23/91
  739.   ;#
  740.   ;# Author: Wayne Thompson
  741.   ;#
  742. ***************
  743. *** 7,13 ****
  744.   ;#     This routine provides word completion.
  745.   ;#     (TAB) attempts word completion.
  746.   ;#     (^D)  prints completion list.
  747. ! ;#    (These may be changed by setting $Complete'complete, etc.)
  748.   ;#
  749.   ;# Diagnostics:
  750.   ;#     Bell when word completion fails.
  751. --- 7,13 ----
  752.   ;#     This routine provides word completion.
  753.   ;#     (TAB) attempts word completion.
  754.   ;#     (^D)  prints completion list.
  755. ! ;#      (These may be changed by setting $Complete'complete, etc.)
  756.   ;#
  757.   ;# Diagnostics:
  758.   ;#     Bell when word completion fails.
  759. ***************
  760. *** 18,95 ****
  761.   ;# Bugs:
  762.   ;#
  763.   ;# Usage:
  764. ! ;#     $input = do Complete('prompt_string', @completion_list);
  765.   ;#
  766.   
  767.   CONFIG: {
  768.       package Complete;
  769.   
  770. !     $complete =    "\004";
  771. !     $kill =    "\025";
  772. !     $erase1 =    "\177";
  773. !     $erase2 =    "\010";
  774.   }
  775.   
  776.   sub Complete {
  777.       package Complete;
  778.   
  779. -     local ($prompt) = shift (@_);
  780. -     local ($c, $cmp, $l, $r, $ret, $return, $test);
  781. -     @_cmp_lst = sort @_;
  782.       local($[) = 0;
  783. !     system 'stty raw -echo';
  784. !     loop: {
  785. !     print $prompt, $return;
  786. !     while (($c = getc(stdin)) ne "\r") {
  787. !         if ($c eq "\t") {            # (TAB) attempt completion
  788. !         @_match = ();
  789. !         foreach $cmp (@_cmp_lst) {
  790. !             push (@_match, $cmp) if $cmp =~ /^$return/;
  791. !         }
  792. !                 $test = $_match[0];
  793. !                 $l = length ($test);
  794. !         unless ($#_match == 0) {
  795. !                     shift (@_match);
  796. !                     foreach $cmp (@_match) {
  797. !                         until (substr ($cmp, 0, $l) eq substr ($test, 0, $l)) {
  798. !                             $l--;
  799. !                         }
  800. !                     }
  801. !                     print "\007";
  802. !                 }
  803. !                 print $test = substr ($test, $r, $l - $r);
  804. !                 $r = length ($return .= $test);
  805. !         }
  806. !         elsif ($c eq $complete) {        # (^D) completion list
  807. !         print "\r\n";
  808. !         foreach $cmp (@_cmp_lst) {
  809. !             print "$cmp\r\n" if $cmp =~ /^$return/;
  810. !         }
  811. !         redo loop;
  812. !         }
  813. !             elsif ($c eq $kill && $r) {    # (^U) kill
  814. !                 $return = '';
  815. !                 $r = 0;
  816. !                 print "\r\n";
  817. !                 redo loop;
  818. !             }
  819. !                                             # (DEL) || (BS) erase
  820. !         elsif ($c eq $erase1 || $c eq $erase2) {
  821. !         if($r) {
  822. !             print "\b \b";
  823. !             chop ($return);
  824. !             $r--;
  825. !         }
  826. !         }
  827. !         elsif ($c =~ /\S/) {                # printable char
  828. !         $return .= $c;
  829. !         $r++;
  830. !         print $c;
  831. !         }
  832. !     }
  833.       }
  834. !     system 'stty -raw echo';
  835. !     print "\n";
  836.       $return;
  837.   }
  838.   
  839. --- 18,109 ----
  840.   ;# Bugs:
  841.   ;#
  842.   ;# Usage:
  843. ! ;#     $input = &Complete('prompt_string', *completion_list);
  844. ! ;#         or
  845. ! ;#     $input = &Complete('prompt_string', @completion_list);
  846.   ;#
  847.   
  848.   CONFIG: {
  849.       package Complete;
  850.   
  851. !     $complete = "\004";
  852. !     $kill     = "\025";
  853. !     $erase1 =   "\177";
  854. !     $erase2 =   "\010";
  855.   }
  856.   
  857.   sub Complete {
  858.       package Complete;
  859.   
  860.       local($[) = 0;
  861. !     if ($_[1] =~ /^StB\0/) {
  862. !         ($prompt, *_) = @_;
  863.       }
  864. !     else {
  865. !         $prompt = shift(@_);
  866. !     }
  867. !     @cmp_lst = sort(@_);
  868. !     system('stty raw -echo');
  869. !     LOOP: {
  870. !         print($prompt, $return);
  871. !         while (($_ = getc(STDIN)) ne "\r") {
  872. !             CASE: {
  873. !                 # (TAB) attempt completion
  874. !                 $_ eq "\t" && do {
  875. !                     @match = grep(/^$return/, @cmp_lst);
  876. !                     $l = length($test = shift(@match));
  877. !                     unless ($#match < 0) {
  878. !                         foreach $cmp (@match) {
  879. !                             until (substr($cmp, 0, $l) eq substr($test, 0, $l)) {
  880. !                                 $l--;
  881. !                             }
  882. !                         }
  883. !                         print("\a");
  884. !                     }
  885. !                     print($test = substr($test, $r, $l - $r));
  886. !                     $r = length($return .= $test);
  887. !                     last CASE;
  888. !                 };
  889. !                 # (^D) completion list
  890. !                 $_ eq $complete && do {
  891. !                     print(join("\r\n", '', grep(/^$return/, @cmp_lst)), "\r\n");
  892. !                     redo LOOP;
  893. !                 };
  894. !                 # (^U) kill
  895. !                 $_ eq $kill && do {
  896. !                     if ($r) {
  897. !                         undef($r, $return);
  898. !                         print("\r\n");
  899. !                         redo LOOP;
  900. !                     }
  901. !                     last CASE;
  902. !                 };
  903. !                 # (DEL) || (BS) erase
  904. !                 ($_ eq $erase1 || $_ eq $erase2) && do {
  905. !                     if($r) {
  906. !                         print("\b \b");
  907. !                         chop($return);
  908. !                         $r--;
  909. !                     }
  910. !                     last CASE;
  911. !                 };
  912. !                 # printable char
  913. !                 ord >= 32 && do {
  914. !                     $return .= $_;
  915. !                     $r++;
  916. !                     print;
  917. !                     last CASE;
  918. !                 };
  919. !             }
  920. !         }
  921. !     }
  922. !     system('stty -raw echo');
  923. !     print("\n");
  924.       $return;
  925.   }
  926.   
  927.  
  928. Index: form.c
  929. *** form.c.old    Tue Nov  5 19:26:16 1991
  930. --- form.c    Tue Nov  5 19:26:16 1991
  931. ***************
  932. *** 1,4 ****
  933. ! /* $RCSfile: form.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:07:59 $
  934.    *
  935.    *    Copyright (c) 1991, Larry Wall
  936.    *
  937. --- 1,4 ----
  938. ! /* $RCSfile: form.c,v $$Revision: 4.0.1.2 $$Date: 91/11/05 17:18:43 $
  939.    *
  940.    *    Copyright (c) 1991, Larry Wall
  941.    *
  942. ***************
  943. *** 6,11 ****
  944. --- 6,16 ----
  945.    *    License or the Artistic License, as specified in the README file.
  946.    *
  947.    * $Log:    form.c,v $
  948. +  * Revision 4.0.1.2  91/11/05  17:18:43  lwall
  949. +  * patch11: formats didn't fill their fields as well as they could
  950. +  * patch11: ^ fields chopped hyphens on line break
  951. +  * patch11: # fields could write outside allocated memory
  952. +  * 
  953.    * Revision 4.0.1.1  91/06/07  11:07:59  lwall
  954.    * patch4: new copyright notice
  955.    * patch4: default top-of-form format is now FILEHANDLE_TOP
  956. ***************
  957. *** 97,102 ****
  958. --- 102,108 ----
  959.       for (; fcmd; fcmd = nextfcmd) {
  960.       nextfcmd = fcmd->f_next;
  961.       CHKLEN(fcmd->f_presize);
  962. +     /*SUPPRESS 560*/
  963.       if (s = fcmd->f_pre) {
  964.           while (*s) {
  965.           if (*s == '\n') {
  966. ***************
  967. *** 141,147 ****
  968.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  969.               *s = ' ';
  970.           }
  971. !         if (size)
  972.           chophere = s;
  973.           else if (chophere && chophere < s && *s && index(chopset,*s))
  974.           chophere = s;
  975. --- 147,153 ----
  976.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  977.               *s = ' ';
  978.           }
  979. !         if (size || !*s)
  980.           chophere = s;
  981.           else if (chophere && chophere < s && *s && index(chopset,*s))
  982.           chophere = s;
  983. ***************
  984. *** 165,171 ****
  985.               *d++ = '.';
  986.               size -= 3;
  987.           }
  988. !         while (*chophere && index(chopset,*chophere))
  989.               chophere++;
  990.           str_chop(str,chophere);
  991.           }
  992. --- 171,178 ----
  993.               *d++ = '.';
  994.               size -= 3;
  995.           }
  996. !         while (*chophere && index(chopset,*chophere)
  997. !           && isSPACE(*chophere))
  998.               chophere++;
  999.           str_chop(str,chophere);
  1000.           }
  1001. ***************
  1002. *** 192,198 ****
  1003.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  1004.               *s = ' ';
  1005.           }
  1006. !         if (size)
  1007.           chophere = s;
  1008.           else if (chophere && chophere < s && *s && index(chopset,*s))
  1009.           chophere = s;
  1010. --- 199,205 ----
  1011.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  1012.               *s = ' ';
  1013.           }
  1014. !         if (size || !*s)
  1015.           chophere = s;
  1016.           else if (chophere && chophere < s && *s && index(chopset,*s))
  1017.           chophere = s;
  1018. ***************
  1019. *** 201,207 ****
  1020.               chophere = s;
  1021.           size += (s - chophere);
  1022.           s = chophere;
  1023. !         while (*chophere && index(chopset,*chophere))
  1024.               chophere++;
  1025.           }
  1026.           tmpchar = *s;
  1027. --- 208,215 ----
  1028.               chophere = s;
  1029.           size += (s - chophere);
  1030.           s = chophere;
  1031. !         while (*chophere && index(chopset,*chophere)
  1032. !           && isSPACE(*chophere))
  1033.               chophere++;
  1034.           }
  1035.           tmpchar = *s;
  1036. ***************
  1037. *** 235,241 ****
  1038.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  1039.               *s = ' ';
  1040.           }
  1041. !         if (size)
  1042.           chophere = s;
  1043.           else if (chophere && chophere < s && *s && index(chopset,*s))
  1044.           chophere = s;
  1045. --- 243,249 ----
  1046.           if (*s == '\n' && (fcmd->f_flags & FC_CHOP))
  1047.               *s = ' ';
  1048.           }
  1049. !         if (size || !*s)
  1050.           chophere = s;
  1051.           else if (chophere && chophere < s && *s && index(chopset,*s))
  1052.           chophere = s;
  1053. ***************
  1054. *** 244,250 ****
  1055.               chophere = s;
  1056.           size += (s - chophere);
  1057.           s = chophere;
  1058. !         while (*chophere && index(chopset,*chophere))
  1059.               chophere++;
  1060.           }
  1061.           tmpchar = *s;
  1062. --- 252,259 ----
  1063.               chophere = s;
  1064.           size += (s - chophere);
  1065.           s = chophere;
  1066. !         while (*chophere && index(chopset,*chophere)
  1067. !           && isSPACE(*chophere))
  1068.               chophere++;
  1069.           }
  1070.           tmpchar = *s;
  1071. ***************
  1072. *** 291,297 ****
  1073.           (void)eval(fcmd->f_expr,G_SCALAR,sp);
  1074.           str = stack->ary_array[sp+1];
  1075.           size = fcmd->f_size;
  1076. !         CHKLEN(size);
  1077.           /* If the field is marked with ^ and the value is undefined,
  1078.              blank it out. */
  1079.           if ((fcmd->f_flags & FC_CHOP) && !str->str_pok && !str->str_nok) {
  1080. --- 300,306 ----
  1081.           (void)eval(fcmd->f_expr,G_SCALAR,sp);
  1082.           str = stack->ary_array[sp+1];
  1083.           size = fcmd->f_size;
  1084. !         CHKLEN(size+1);
  1085.           /* If the field is marked with ^ and the value is undefined,
  1086.              blank it out. */
  1087.           if ((fcmd->f_flags & FC_CHOP) && !str->str_pok && !str->str_nok) {
  1088.  
  1089. Index: lib/getcwd.pl
  1090. *** lib/getcwd.pl.old    Tue Nov  5 19:26:59 1991
  1091. --- lib/getcwd.pl    Tue Nov  5 19:27:00 1991
  1092. ***************
  1093. *** 0 ****
  1094. --- 1,62 ----
  1095. + # By Brandon S. Allbery
  1096. + #
  1097. + # Usage: $cwd = &getcwd;
  1098. + sub getcwd
  1099. + {
  1100. +     local($dotdots, $cwd, @pst, @cst, $dir, @tst);
  1101. +     unless (@cst = stat('.'))
  1102. +     {
  1103. +     warn "stat(.): $!";
  1104. +     return '';
  1105. +     }
  1106. +     $cwd = '';
  1107. +     do
  1108. +     {
  1109. +     $dotdots .= '/' if $dotdots;
  1110. +     $dotdots .= '..';
  1111. +     @pst = @cst;
  1112. +     unless (opendir(getcwd'PARENT, $dotdots))            #'))
  1113. +     {
  1114. +         warn "opendir($dotdots): $!";
  1115. +         return '';
  1116. +     }
  1117. +     unless (@cst = stat($dotdots))
  1118. +     {
  1119. +         warn "stat($dotdots): $!";
  1120. +         closedir(getcwd'PARENT);                    #');
  1121. +         return '';
  1122. +     }
  1123. +     if ($pst[$[] == $cst[$[] && $pst[$[ + 1] == $cst[$[ + 1])
  1124. +     {
  1125. +         $dir = '';
  1126. +     }
  1127. +     else
  1128. +     {
  1129. +         do
  1130. +         {
  1131. +         unless ($dir = readdir(getcwd'PARENT))            #'))
  1132. +         {
  1133. +             warn "readdir($dotdots): $!";
  1134. +             closedir(getcwd'PARENT);                #');
  1135. +             return '';
  1136. +         }
  1137. +         unless (@tst = stat("$dotdots/$dir"))
  1138. +         {
  1139. +             warn "stat($dotdots/$dir): $!";
  1140. +             closedir(getcwd'PARENT);                #');
  1141. +             return '';
  1142. +         }
  1143. +         }
  1144. +         while ($dir eq '.' || $dir eq '..' || $tst[$[] != $pst[$[] ||
  1145. +            $tst[$[ + 1] != $pst[$[ + 1]);
  1146. +     }
  1147. +     $cwd = "$dir/$cwd";
  1148. +     closedir(getcwd'PARENT);                    #');
  1149. +     } while ($dir);
  1150. +     chop($cwd);
  1151. +     $cwd;
  1152. + }
  1153. + 1;
  1154.  
  1155. Index: lib/getopt.pl
  1156. Prereq: 4.0
  1157. *** lib/getopt.pl.old    Tue Nov  5 19:27:01 1991
  1158. --- lib/getopt.pl    Tue Nov  5 19:27:02 1991
  1159. ***************
  1160. *** 1,4 ****
  1161. ! ;# $Header: getopt.pl,v 4.0 91/03/20 01:25:11 lwall Locked $
  1162.   
  1163.   ;# Process single-character switches with switch clustering.  Pass one argument
  1164.   ;# which is a string containing all switches that take an argument.  For each
  1165. --- 1,4 ----
  1166. ! ;# $RCSfile: getopt.pl,v $$Revision: 4.0.1.1 $$Date: 91/11/05 17:53:01 $
  1167.   
  1168.   ;# Process single-character switches with switch clustering.  Pass one argument
  1169.   ;# which is a string containing all switches that take an argument.  For each
  1170. ***************
  1171. *** 14,20 ****
  1172.       local($_,$first,$rest);
  1173.       local($[) = 0;
  1174.   
  1175. !     while (($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
  1176.       ($first,$rest) = ($1,$2);
  1177.       if (index($argumentative,$first) >= $[) {
  1178.           if ($rest ne '') {
  1179. --- 14,20 ----
  1180.       local($_,$first,$rest);
  1181.       local($[) = 0;
  1182.   
  1183. !     while (@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
  1184.       ($first,$rest) = ($1,$2);
  1185.       if (index($argumentative,$first) >= $[) {
  1186.           if ($rest ne '') {
  1187.  
  1188. Index: lib/getopts.pl
  1189. *** lib/getopts.pl.old    Tue Nov  5 19:27:03 1991
  1190. --- lib/getopts.pl    Tue Nov  5 19:27:04 1991
  1191. ***************
  1192. *** 6,16 ****
  1193.   
  1194.   sub Getopts {
  1195.       local($argumentative) = @_;
  1196. !     local(@args,$_,$first,$rest,$errs);
  1197.       local($[) = 0;
  1198.   
  1199.       @args = split( / */, $argumentative );
  1200. !     while(($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
  1201.       ($first,$rest) = ($1,$2);
  1202.       $pos = index($argumentative,$first);
  1203.       if($pos >= $[) {
  1204. --- 6,17 ----
  1205.   
  1206.   sub Getopts {
  1207.       local($argumentative) = @_;
  1208. !     local(@args,$_,$first,$rest);
  1209. !     local($errs) = 0;
  1210.       local($[) = 0;
  1211.   
  1212.       @args = split( / */, $argumentative );
  1213. !     while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) {
  1214.       ($first,$rest) = ($1,$2);
  1215.       $pos = index($argumentative,$first);
  1216.       if($pos >= $[) {
  1217.  
  1218. Index: hints/greenhills.sh
  1219. *** hints/greenhills.sh.old    Tue Nov  5 19:26:30 1991
  1220. --- hints/greenhills.sh    Tue Nov  5 19:26:31 1991
  1221. ***************
  1222. *** 0 ****
  1223. --- 1 ----
  1224. + ccflags="$ccflags -X18"
  1225.  
  1226. Index: h2ph.SH
  1227. *** h2ph.SH.old    Tue Nov  5 19:26:18 1991
  1228. --- h2ph.SH    Tue Nov  5 19:26:18 1991
  1229. ***************
  1230. *** 24,30 ****
  1231.   'di';
  1232.   'ig00';
  1233.   
  1234. ! \$perlincl = '$privlib';
  1235.   !GROK!THIS!
  1236.   
  1237.   : In the following dollars and backticks do not need the extra backslash.
  1238. --- 24,30 ----
  1239.   'di';
  1240.   'ig00';
  1241.   
  1242. ! \$perlincl = '$installprivlib';
  1243.   !GROK!THIS!
  1244.   
  1245.   : In the following dollars and backticks do not need the extra backslash.
  1246. ***************
  1247. *** 40,46 ****
  1248.       FILE
  1249.   END
  1250.   
  1251. ! $isatype{@isatype} = (1) x @isatype;
  1252.   
  1253.   @ARGV = ('-') unless @ARGV;
  1254.   
  1255. --- 40,46 ----
  1256.       FILE
  1257.   END
  1258.   
  1259. ! @isatype{@isatype} = (1) x @isatype;
  1260.   
  1261.   @ARGV = ('-') unless @ARGV;
  1262.   
  1263. ***************
  1264. *** 86,91 ****
  1265. --- 86,92 ----
  1266.               $args = $1;
  1267.               if ($args ne '') {
  1268.               foreach $arg (split(/,\s*/,$args)) {
  1269. +                 $arg =~ s/^\s*([^\s].*[^\s])\s*$/$1/;
  1270.                   $curargs{$arg} = 1;
  1271.               }
  1272.               $args =~ s/\b(\w)/\$$1/g;
  1273. ***************
  1274. *** 117,123 ****
  1275.               }
  1276.           }
  1277.           }
  1278. !         elsif (/^include <(.*)>/) {
  1279.           ($incl = $1) =~ s/\.h$/.ph/;
  1280.           print OUT $t,"require '$incl';\n";
  1281.           }
  1282. --- 118,124 ----
  1283.               }
  1284.           }
  1285.           }
  1286. !         elsif (/^include\s+<(.*)>/) {
  1287.           ($incl = $1) =~ s/\.h$/.ph/;
  1288.           print OUT $t,"require '$incl';\n";
  1289.           }
  1290.  
  1291. Index: handy.h
  1292. *** handy.h.old    Tue Nov  5 19:26:20 1991
  1293. --- handy.h    Tue Nov  5 19:26:20 1991
  1294. ***************
  1295. *** 1,4 ****
  1296. ! /* $RCSfile: handy.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:09:56 $
  1297.    *
  1298.    *    Copyright (c) 1991, Larry Wall
  1299.    *
  1300. --- 1,4 ----
  1301. ! /* $RCSfile: handy.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 17:23:38 $
  1302.    *
  1303.    *    Copyright (c) 1991, Larry Wall
  1304.    *
  1305. ***************
  1306. *** 6,11 ****
  1307. --- 6,14 ----
  1308.    *    License or the Artistic License, as specified in the README file.
  1309.    *
  1310.    * $Log:    handy.h,v $
  1311. +  * Revision 4.0.1.2  91/11/05  17:23:38  lwall
  1312. +  * patch11: prepared for ctype implementations that don't define isascii()
  1313. +  * 
  1314.    * Revision 4.0.1.1  91/06/07  11:09:56  lwall
  1315.    * patch4: new copyright notice
  1316.    * 
  1317. ***************
  1318. *** 51,56 ****
  1319. --- 54,75 ----
  1320.   #define strGE(s1,s2) (strcmp(s1,s2) >= 0)
  1321.   #define strnNE(s1,s2,l) (strncmp(s1,s2,l))
  1322.   #define strnEQ(s1,s2,l) (!strncmp(s1,s2,l))
  1323. + #if defined(CTYPE256) || !defined(isascii)
  1324. + #define isALNUM(c) (isalpha(c) || isdigit(c) || c == '_')
  1325. + #define isALPHA(c) isalpha(c)
  1326. + #define isSPACE(c) isspace(c)
  1327. + #define isDIGIT(c) isdigit(c)
  1328. + #define isUPPER(c) isupper(c)
  1329. + #define isLOWER(c) islower(c)
  1330. + #else
  1331. + #define isALNUM(c) (isascii(c) && (isalpha(c) || isdigit(c) || c == '_'))
  1332. + #define isALPHA(c) (isascii(c) && isalpha(c))
  1333. + #define isSPACE(c) (isascii(c) && isspace(c))
  1334. + #define isDIGIT(c) (isascii(c) && isdigit(c))
  1335. + #define isUPPER(c) (isascii(c) && isupper(c))
  1336. + #define isLOWER(c) (isascii(c) && islower(c))
  1337. + #endif
  1338.   
  1339.   #define MEM_SIZE unsigned int
  1340.   
  1341.  
  1342. Index: makedepend.SH
  1343. *** makedepend.SH.old    Tue Nov  5 19:27:10 1991
  1344. --- makedepend.SH    Tue Nov  5 19:27:10 1991
  1345. ***************
  1346. *** 15,23 ****
  1347.   echo "Extracting makedepend (with variable substitutions)"
  1348.   $spitshell >makedepend <<!GROK!THIS!
  1349.   $startsh
  1350. ! # $RCSfile: makedepend.SH,v $$Revision: 4.0.1.2 $$Date: 91/06/07 15:40:06 $
  1351.   #
  1352.   # $Log:    makedepend.SH,v $
  1353.   # Revision 4.0.1.2  91/06/07  15:40:06  lwall
  1354.   # patch4: fixed cppstdin to run in the right directory
  1355.   # 
  1356. --- 15,26 ----
  1357.   echo "Extracting makedepend (with variable substitutions)"
  1358.   $spitshell >makedepend <<!GROK!THIS!
  1359.   $startsh
  1360. ! # $RCSfile: makedepend.SH,v $$Revision: 4.0.1.3 $$Date: 91/11/05 17:56:33 $
  1361.   #
  1362.   # $Log:    makedepend.SH,v $
  1363. + # Revision 4.0.1.3  91/11/05  17:56:33  lwall
  1364. + # patch11: various portability fixes
  1365. + # 
  1366.   # Revision 4.0.1.2  91/06/07  15:40:06  lwall
  1367.   # patch4: fixed cppstdin to run in the right directory
  1368.   # 
  1369. ***************
  1370. *** 92,98 ****
  1371.       -e '}'
  1372.       $cppstdin -I/usr/local/include -I. $cppflags $cppminus <$file.c | sed -e 's#\.[0-9][0-9]*\.c#'"$file.c#" | \
  1373.       $sed \
  1374. !     -e '/^# *[0-9]/!d' \
  1375.       -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
  1376.       -e 's|: \./|: |' \
  1377.       -e 's|\.c\.c|.c|' | \
  1378. --- 95,102 ----
  1379.       -e '}'
  1380.       $cppstdin -I/usr/local/include -I. $cppflags $cppminus <$file.c | sed -e 's#\.[0-9][0-9]*\.c#'"$file.c#" | \
  1381.       $sed \
  1382. !     -e 's/^[     ]*#[     ]*line/#/' \
  1383. !     -e '/^# *[0-9][0-9]* *"/!d' \
  1384.       -e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
  1385.       -e 's|: \./|: |' \
  1386.       -e 's|\.c\.c|.c|' | \
  1387.  
  1388. Index: lib/cacheout.pl
  1389. *** lib/cacheout.pl.old    Tue Nov  5 19:26:50 1991
  1390. --- lib/cacheout.pl    Tue Nov  5 19:26:50 1991
  1391. ***************
  1392. *** 12,22 ****
  1393.       package cacheout;
  1394.   
  1395.       ($file) = @_;
  1396. -     ($package) = caller;
  1397.       if (!$isopen{$file}) {
  1398.       if (++$numopen > $maxopen) {
  1399. !         sub byseq {$isopen{$a} != $isopen{$b};}
  1400. !         local(@lru) = sort byseq keys(%isopen);
  1401.           splice(@lru, $maxopen / 3);
  1402.           $numopen -= @lru;
  1403.           for (@lru) { close $_; delete $isopen{$_}; }
  1404. --- 12,20 ----
  1405.       package cacheout;
  1406.   
  1407.       ($file) = @_;
  1408.       if (!$isopen{$file}) {
  1409.       if (++$numopen > $maxopen) {
  1410. !         local(@lru) = sort {$isopen{$a} <=> $isopen{$b};} keys(%isopen);
  1411.           splice(@lru, $maxopen / 3);
  1412.           $numopen -= @lru;
  1413.           for (@lru) { close $_; delete $isopen{$_}; }
  1414. ***************
  1415. *** 35,41 ****
  1416.   if (open(PARAM,'/usr/include/sys/param.h')) {
  1417.       local($.);
  1418.       while (<PARAM>) {
  1419. !     $maxopen = $1 - 4 if /^#define NOFILE\s+(\d+)/;
  1420.       }
  1421.       close PARAM;
  1422.   }
  1423. --- 33,39 ----
  1424.   if (open(PARAM,'/usr/include/sys/param.h')) {
  1425.       local($.);
  1426.       while (<PARAM>) {
  1427. !     $maxopen = $1 - 4 if /^\s*#\s*define\s+NOFILE\s+(\d+)/;
  1428.       }
  1429.       close PARAM;
  1430.   }
  1431.  
  1432. Index: t/op/sort.t
  1433. Prereq: 4.0
  1434. *** t/op/sort.t.old    Tue Nov  5 19:28:04 1991
  1435. --- t/op/sort.t    Tue Nov  5 19:28:04 1991
  1436. ***************
  1437. *** 1,8 ****
  1438.   #!./perl
  1439.   
  1440. ! # $Header: sort.t,v 4.0 91/03/20 01:54:38 lwall Locked $
  1441.   
  1442. ! print "1..8\n";
  1443.   
  1444.   sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
  1445.   
  1446. --- 1,8 ----
  1447.   #!./perl
  1448.   
  1449. ! # $RCSfile: sort.t,v $$Revision: 4.0.1.1 $$Date: 91/11/05 18:43:47 $
  1450.   
  1451. ! print "1..9\n";
  1452.   
  1453.   sub reverse { $a lt $b ? 1 : $a gt $b ? -1 : 0; }
  1454.   
  1455. ***************
  1456. *** 37,39 ****
  1457. --- 37,43 ----
  1458.   @a = (1,2,3,4);
  1459.   @b = reverse @a;
  1460.   print ("@b" eq "4 3 2 1" ? "ok 8\n" : "not ok 8 (@b)\n");
  1461. + @a = (10,2,3,4);
  1462. + @b = sort {$a <=> $b;} @a;
  1463. + print ("@b" eq "2 3 4 10" ? "ok 9\n" : "not ok 9 (@b)\n");
  1464.  
  1465. Index: regexp.h
  1466. *** regexp.h.old    Tue Nov  5 19:27:46 1991
  1467. --- regexp.h    Tue Nov  5 19:27:46 1991
  1468. ***************
  1469. *** 5,13 ****
  1470.    * not the System V one.
  1471.    */
  1472.   
  1473. ! /* $RCSfile: regexp.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 11:51:18 $
  1474.    *
  1475.    * $Log:    regexp.h,v $
  1476.    * Revision 4.0.1.1  91/06/07  11:51:18  lwall
  1477.    * patch4: new copyright notice
  1478.    * patch4: // wouldn't use previous pattern if it started with a null character
  1479. --- 5,17 ----
  1480.    * not the System V one.
  1481.    */
  1482.   
  1483. ! /* $RCSfile: regexp.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 18:24:31 $
  1484.    *
  1485.    * $Log:    regexp.h,v $
  1486. +  * Revision 4.0.1.2  91/11/05  18:24:31  lwall
  1487. +  * patch11: minimum match length calculation in regexp is now cumulative
  1488. +  * patch11: initial .* in pattern had dependency on value of $*
  1489. +  * 
  1490.    * Revision 4.0.1.1  91/06/07  11:51:18  lwall
  1491.    * patch4: new copyright notice
  1492.    * patch4: // wouldn't use previous pattern if it started with a null character
  1493. ***************
  1494. *** 25,30 ****
  1495. --- 29,35 ----
  1496.       char *regstclass;
  1497.       STR *regmust;        /* Internal use only. */
  1498.       int regback;        /* Can regmust locate first try? */
  1499. +     int minlen;        /* mininum possible length of $& */
  1500.       int prelen;        /* length of precomp */
  1501.       char *precomp;        /* pre-compilation regular expression */
  1502.       char *subbase;        /* saved string so \digit works forever */
  1503. ***************
  1504. *** 39,44 ****
  1505. --- 44,50 ----
  1506.   
  1507.   #define ROPT_ANCH 1
  1508.   #define ROPT_SKIP 2
  1509. + #define ROPT_IMPLICIT 4
  1510.   
  1511.   regexp *regcomp();
  1512.   int regexec();
  1513.  
  1514. Index: hints/aix_rs.sh
  1515. *** hints/aix_rs.sh.old    Tue Nov  5 22:55:53 1991
  1516. --- hints/aix_rs.sh    Tue Nov  5 22:55:53 1991
  1517. ***************
  1518. *** 1,4 ****
  1519.   eval_cflags='optimize="-g"'
  1520.   toke_cflags='optimize="-g"'
  1521.   teval_cflags='optimize="-g"'
  1522. ! ttoke_cflags='optimize="-g"'; cflags="$cflags -D_NO_PROTO"
  1523. --- 1,5 ----
  1524.   eval_cflags='optimize="-g"'
  1525.   toke_cflags='optimize="-g"'
  1526.   teval_cflags='optimize="-g"'
  1527. ! ttoke_cflags='optimize="-g"';
  1528. ! ccflags="$ccflags -D_NO_PROTO"
  1529.  
  1530. Index: handy.h
  1531. *** handy.h.old    Tue Nov  5 22:54:35 1991
  1532. --- handy.h    Tue Nov  5 22:54:36 1991
  1533. ***************
  1534. *** 1,4 ****
  1535. ! /* $RCSfile: handy.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 17:23:38 $
  1536.    *
  1537.    *    Copyright (c) 1991, Larry Wall
  1538.    *
  1539. --- 1,4 ----
  1540. ! /* $RCSfile: handy.h,v $$Revision: 4.0.1.3 $$Date: 91/11/05 22:54:26 $
  1541.    *
  1542.    *    Copyright (c) 1991, Larry Wall
  1543.    *
  1544. ***************
  1545. *** 6,11 ****
  1546. --- 6,14 ----
  1547.    *    License or the Artistic License, as specified in the README file.
  1548.    *
  1549.    * $Log:    handy.h,v $
  1550. +  * Revision 4.0.1.3  91/11/05  22:54:26  lwall
  1551. +  * patch11: erratum
  1552. +  * 
  1553.    * Revision 4.0.1.2  91/11/05  17:23:38  lwall
  1554.    * patch11: prepared for ctype implementations that don't define isascii()
  1555.    * 
  1556. ***************
  1557. *** 83,91 ****
  1558. --- 86,96 ----
  1559.   
  1560.   #ifndef lint
  1561.   #ifndef LEAKTEST
  1562. + #ifndef safemalloc
  1563.   char *safemalloc();
  1564.   char *saferealloc();
  1565.   void safefree();
  1566. + #endif
  1567.   #ifndef MSDOS
  1568.   #define New(x,v,n,t)  (v = (t*)safemalloc((MEM_SIZE)((n) * sizeof(t))))
  1569.   #define Newc(x,v,n,t,c)  (v = (c*)safemalloc((MEM_SIZE)((n) * sizeof(t))))
  1570.  
  1571. Index: regcomp.c
  1572. *** regcomp.c.old    Tue Nov  5 22:55:26 1991
  1573. --- regcomp.c    Tue Nov  5 22:55:27 1991
  1574. ***************
  1575. *** 7,15 ****
  1576.    * blame Henry for some of the lack of readability.
  1577.    */
  1578.   
  1579. ! /* $RCSfile: regcomp.c,v $$Revision: 4.0.1.3 $$Date: 91/11/05 18:22:28 $
  1580.    *
  1581.    * $Log:    regcomp.c,v $
  1582.    * Revision 4.0.1.3  91/11/05  18:22:28  lwall
  1583.    * patch11: minimum match length calculation in regexp is now cumulative
  1584.    * patch11: initial .* in pattern had dependency on value of $*
  1585. --- 7,18 ----
  1586.    * blame Henry for some of the lack of readability.
  1587.    */
  1588.   
  1589. ! /* $RCSfile: regcomp.c,v $$Revision: 4.0.1.4 $$Date: 91/11/05 22:55:14 $
  1590.    *
  1591.    * $Log:    regcomp.c,v $
  1592. +  * Revision 4.0.1.4  91/11/05  22:55:14  lwall
  1593. +  * patch11: Erratum
  1594. +  * 
  1595.    * Revision 4.0.1.3  91/11/05  18:22:28  lwall
  1596.    * patch11: minimum match length calculation in regexp is now cumulative
  1597.    * patch11: initial .* in pattern had dependency on value of $*
  1598. ***************
  1599. *** 157,163 ****
  1600. --- 160,168 ----
  1601.       int backest;
  1602.       int curback;
  1603.       int minlen;
  1604. + #ifndef safemalloc
  1605.       extern char *safemalloc();
  1606. + #endif
  1607.       extern char *savestr();
  1608.       int sawplus = 0;
  1609.       int sawopen = 0;
  1610.  
  1611. *** End of Patch 18 ***
  1612. exit 0 # Just in case...
  1613. -- 
  1614. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1615. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1616. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1617. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1618.