From: Andy Dougherty Date: Tue, 30 May 1995 22:59:41 +0000 (+0000) Subject: This is my patch patch.1i for perl5.001. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16d20bd98cd29be76029ebf04027a7edd34d817b;p=p5sagit%2Fp5-mst-13.2.git This is my patch patch.1i for perl5.001. To apply, change to your perl directory, run the commands above, then apply with patch -p1 -N < thispatch. After you apply this patch, I would recommend: rm config.sh sh Configure [whatever options you use] make depend make make test Here are the highlights: All pod documentation now installed, along with corresponding man pages, if possible (Configure allows you to change this). cppstdin no longer points back to the build directory. This necessitated two changes to the test suite: comp/cpp.t is now a front end that punts if cppstdin is not yet available (the old perl4 trick doesn't work for perl5). The op/misc.t test ./perl -P -e 'use POSIX;' has been dropped since I couldn't think of an elegant way to bypass it for systems that need the cppstdin wrapper. Grand autoload patch included (minus the installperl, lib/, and ext/ changes). The lib/ changes are in patch.1g, and the ext/ changes are in patch.1h. Better detection and use of stdio variants, especially on SVR4. Sarathy's consolidated patches (for ties) included. New filter stuff included. Three patches from Larry (gv.c, toke.c, pp_ctl.c) Patch and enjoy, Andy Dougherty doughera@lafcol.lafayette.edu Dept. of Physics Lafayette College Easton, PA 18042 Here's the file-by-file breakdown of what's included: Changes.Conf Document changes in the Configure & build process. Configure Upgrade to metaconfig PL55. Add /opt hierarchy to paths searched for programs. Tye McQueen's updated std stdio testing. Prompting for installation info for perl module pages. Add possible SITELIB to include site-specific include directories. By default this is disabled, but it seemed a neat idea now that the standard perl library is getting so big. Check that the compiler chosen exists and actually supports the options the user specified. Correctly sort multiple shared library version numbers. Use a compile & link test for gconvert(), dlopen(), and dlerror(). Do not include build directory name in cppstdin wrapper. MANIFEST Updated. Makefile.SH Reorganized a bit to support separate install.perl and install.man targets to use the new installman script and to accomodate those who don't want to install the man pages. Organize cleanup of .SH files a little better. No longer automatically make the pod/*.man files. This is done by installman only if requested. Include additional error messages and info for regenerating the automatically maintained header files. Add 'minitest' target. README Updated. README.vms Fix perl5-porters subscription info. config_H Updated. config_h.SH Updated. configpm Embedded pod. configure GNU configure-like front end to metaconfig's Configure. Only supports a few options. doio.c Updated to use new std stdio testing. embed.h Add new symbols for filtering. global.sym see embed.h. gv.c C patch from lwall. hints/README.hints Updated. hints/aux.sh Updated. hints/cxux.sh Updated. hints/epix.sh New file. hints/freebsd.sh Updated. hints/irix_4.sh Updated. hints/irix_5.sh Updated. hints/irix_6.sh Updated. hints/linux.sh Updated. hints/powerunix.sh Updated. installman New file to install pod/*.pod and lib/*.p(m|od) man pages. installperl Move installation of man pages over to installman script. Install pod/*.pod files in $privlib/pod/. Preserve timestamps on .a files. makedepend.SH Now includes . and .. in PATH to explicitly find cppstdin wrapper. opcode.h opcode.pl shmwrite fix. perl.c Changed unofficial patchlevel message. Included optional SITELIB directory. perl.h #include cryptswitch gone/filters added. EUNICE replaced by UNLINK_ALL_VERSIONS. Only matters for VMS. perldoc.SH New file. pod/perl.pod Describe where modpods are. pp_ctl.c sort bug fix from lwall. pp_hot.c csh glob bug fix from tchrist. Sarathy's consolidated "tie" patch for NETaa13753 N 2 trey pp_sys.c Emulate flock with lockf, if possible. Use new std stdio unit. proto.h Filters stuff. prototype for unlnk() is only needed #if UNLINK_ALL_VERSIONS sv.c Sarathy's consolidated "tie" patch for NETaa13753 N 2 trey Sarathy's consolidated patch for nested ties. Use new std stdio unit. t/comp/cpp.aux New file. This only gets called if cppstdin is avaiable. t/comp/cpp.t Calls cpp.aux test only if cppstdin is available. t/op/misc.t Drop perl -P -e 'use POSIX;' test. it couldn't work on systems without the cppstdin wrapper installed, and is usually misleading when it fails anyway. toke.c filter stuff. fix for NETaa13798 from lwall. unixish.h undef UNLINK_ALL_VERSIONS since it's irrelevant for unix. util.c s/EUNICE/UNLINK_ALL_VERSIONS/ for the unlnk() function. vms/config.vms VMS updates from Charles Bailey. std stdio updates to match changes in perl sources. add UNLINK_ALL_VERSIONS constant, but leave it #undef. vms/ext/MM_VMS.pm vms/ext/VMS/stdio/stdio.xs vms/perlvms.pod vms/vms.c VMS updates from Charles Bailey. x2p/Makefile.SH Updated to match man page Configure questions. Slight clean-up on .SH targets. x2p/str.c Use new std stdio unit. --- diff --git a/Changes.Conf b/Changes.Conf new file mode 100644 index 0000000..a897e13 --- /dev/null +++ b/Changes.Conf @@ -0,0 +1,131 @@ +------------- +Version 5.002 +------------- + +Summary of user-visible Configure and build changes since 5.001: + +Yet more enhancements and fixes have been made to the Configure and +build process for perl. Most of these will not be visible to the +ordinary user--they just make the process more robust and likely to +work on a wider range of platforms. + +This is a brief summary of the most important changes: + + Include 5.000 - 5.001 upgrage notes :-) (see below). You might + want to read through them as well as these notes. + + Install documentation for perl modules and pod2* translators. You can + now view perl module documentation with either your system's man(1) + program or with the supplied perldoc script. + + Support Linux ELF dynamic loading. + + Many hint file updates. + + +------------- +Version 5.001 +------------- + +Summary of user-visible Configure and build changes since 5.000: + +A large number of enhancements and fixes have been made to the +Configure and build process for perl. Most of these will not be +visible to the ordinary user--they just make the process more robust +and likely to work on a wider range of platforms. + +This is a brief summary of the most important changes. + +Configure changes: + New and improved Configure command line options. -O now overrides + config.sh settings. -D options can now include spaces, if + protected in quotes (e.g. -Dcc='gcc -posix'). Type Configure -h + for a full listing of options. + + Users can now turn on the defaults for the rest of Configure by + typing &-d at any Configure prompt. This is useful if you just + want to change one or two answers. + + Support on (non-Sun) SVR4 systems for dynamic loading and shared + libperl.so + + Numerous new or updated hints files: PowerUnix, aix 3.x and 4.x, + bsd386, convexos, cxux, DEC OSF, Esix, FreeBSD, HP-UX (especially if + you're using the bundled compiler), irix 4.x, 5.x, and 6.x, Linux, + MPE/IX, NeXT 3.0 and 3.2, Solaris, SVR4, Ultrix (especially 4.3), + and Unicos. + + Improved generation of a suitable name for architecture-dependent + library files. NOTE: This may differ from the name you had from + your 5.000 installation. + + Many many portability enhancements and fixes. + +Build process: + + The process for building extensions has been extensively revised. See + lib/ExtUtils/MakeMaker.pm for complete documentation. Basically, with + just a simple Makefile.PL (such as the one generated by h2xs), you can + now build an extension from anywhere on your system, even if you've + deleted the perl source. + + Improved build/install documentation in README. A little. + + Improved dynamic loading on HP-UX. Support dynamic loading on SVR4. + + Installperl now gets the version correct :-) + + Installperl now saves the perl *.h files and the libperl.a library + in your architecture-dependent library directory so that you can + later build extensions without having to re-install the perl + source. + + Include x2p/a2p.c generated by byacc from x2p/a2p.y. + + Many many portability fixes. + +Upgrade Traps and Pitfalls: + +Since a lot has changed in the build process, you are probably best +off starting with a fresh copy of the perl5.000 sources. In particular, +your 5.000 config.sh will contain several variables that are no longer +needed. Further, improvements in the Configure tests may mean that some +of the answers will be different than they were in 5.000, and which answer +to keep can be difficult to sort out. Therefore, you are probably +better off ignoring your old config.sh. + +One big change is that architecture-dependent library files may well +be stored in a different location in 5.001. This is because the default +name used in the 5.000 release was not sufficiently specific to +distinguish incompatible architectures. The relevant variable is $archlib +in config.sh. Before you run ``make install'' you should rename your old +$archlib. Thus if your $archlib for version 5.000 was +/usr/local/lib/perl5/foo, and your new value for 5.001 is +/usr/local/lib/perl5/foo-bar, then you should + mv /usr/local/lib/perl5/foo /usr/local/lib/perl5/foo-bar +before running ``make install''. + +Alternatively, you could override Configure's default guess for $archlib +either by sh Configure -Darchname='foo', or by answering 'foo' when +prompted by Configure for the architecture name. + +The following is the sequence of steps to upgrade to 5.001: + cd perl5.000 + make realclean + rm config.sh + + sh Configure + make depend + make + make test + + make install + + + + + + + + + diff --git a/Configure b/Configure index 916940b..e2910d5 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.7 1995/03/21 08:46:15 ram Exp $ # -# Generated on Mon Apr 17 15:46:57 EDT 1995 [metaconfig 3.0 PL53] +# Generated on Wed May 31 09:14:05 EDT 1995 [metaconfig 3.0 PL55] cat >/tmp/c1$$ <options.awk <<'EOF' BEGIN { - optstr = "dD:eEf:hOrsSU:V"; # getopt-style specification + optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification len = length(optstr); for (i = 1; i <= len; i++) { @@ -751,6 +765,7 @@ error='' silent='' extractsh='' override='' +knowitall='' rm -f optdef.sh : option parsing @@ -773,6 +788,7 @@ while test $# -gt 0; do -r) shift; reuseval=true;; -s) shift; silent=true;; -E) shift; alldone=exit;; + -K) shift; knowitall=true;; -O) shift; override=true;; -S) shift; extractsh=true;; -D) @@ -800,7 +816,7 @@ while test $# -gt 0; do esac shift ;; - -V) echo "$me generated by metaconfig 3.0 PL53." >&2 + -V) echo "$me generated by metaconfig 3.0 PL55." >&2 exit 0;; --) break;; -*) echo "$me: unknown option $1" >&2; shift; error=true;; @@ -811,7 +827,7 @@ done case "$error" in true) cat >&2 </dev/null 2>&1; then - eval "`grep myuname= ../config.sh`" - fi - if test "X$myuname" = "X$newmyuname"; then - dflt=y +case "$knowitall" in +'') + if test -f ../config.sh; then + if $contains myuname= ../config.sh >/dev/null 2>&1; then + eval "`grep myuname= ../config.sh`" + fi + if test "X$myuname" = "X$newmyuname"; then + dflt=y + fi fi -fi + ;; +*) dflt=y;; +esac : Get old answers from old config file if Configure was run on the : same system, otherwise use the hints. hint=default cd .. if test -f config.sh; then - $cat </dev/null 2>&1; then *) echo "You are using GNU cc $gccversion." ;; esac else - echo "I can't compile the test program -- Assuming it isn't GNU cc." + echo " " + echo "*** WHOA THERE!!! ***" >&4 + echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 + case "$knowitall" in + '') + echo " You'd better start hunting for one and let me know about it." >&4 + exit 1 + ;; + esac fi $rm -f gccvers* case "$gccversion" in @@ -2745,6 +2772,60 @@ none) ldflags='';; esac rmlist="$rmlist pdp11" +: coherency check +echo " " +echo "Checking your choice of C compiler and flags for coherency..." >&4 +set X $cc $optimize $ccflags try.c -o try $ldflags +shift +$cat >try.msg < try.c <<'EOF' +#include +main() { exit(0); } +EOF +dflt=y +if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then + if sh -c './try' >>try.msg 2>&1; then + dflt=n + else + echo "The program compiled OK, but exited with status $?." >>try.msg + rp="You have a problem. Shall I abort Configure" + dflt=y + fi +else + echo "I can't compile the test program." >>try.msg + rp="You have a BIG problem. Shall I abort Configure" + dflt=y +fi +case "$dflt" in +y) + $cat try.msg + case "$knowitall" in + '') + echo "(The supplied flags might be incorrect with this C compiler.)" + ;; + *) dflt=n;; + esac + echo " " + . ./myread + case "$ans" in + n*|N*) ;; + *) echo "Ok. Stopping Configure." >&4 + exit 1 + ;; + esac + ;; +n) echo "OK, that should do.";; +esac +$rm -f try try.* core + : Set private lib path case "$plibpth" in '') if ./mips; then @@ -2992,10 +3073,18 @@ unknown) set /usr/ccs/lib/libc.$so $test -r $1 || set /usr/lib/libc.$so $test -r $1 || set /usr/shlib/libc.$so - $test -r $1 || set /usr/lib/libc.$so.[0-9]* + $test -r $1 || \ + set `echo blurfl; echo /usr/lib/libc.$so.[0-9]* | \ + tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e ' + h + s/[0-9][0-9]*/0000&/g + s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g + G + s/\n/ /' | \ + sort | $sed -e 's/^.* //'` + eval set \$$# $test -r $1 || set /lib/libc.$so $test -r $1 || set /lib/libsys_s.a - eval set \$$# ;; *) set blurfl @@ -3085,7 +3174,8 @@ $echo $n ".$c" $grep fprintf libc.tmp > libc.ptf xscan='eval "libc.list"; $echo $n ".$c" >&4' xrun='eval "libc.list"; echo "done" >&4' -if com="$sed -n -e 's/__IO//' -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ +xxx='[ADTSIW]' +if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx //p'";\ eval $xscan;\ $contains '^fprintf$' libc.list >/dev/null 2>&1; then eval $xrun @@ -3128,11 +3218,12 @@ elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ eval $xrun else nm -p $* 2>/dev/null >libc.tmp - com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ - eval "libc.list" - if $contains '^fprintf$' libc.list >/dev/null 2>&1; then + $grep fprintf libc.tmp > libc.ptf + if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ + eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 + then nm_opt='-p' - echo "done" >&4 + eval $xrun else echo " " echo "nm didn't seem to work right. Trying ar instead..." >&4 @@ -3146,7 +3237,8 @@ else else echo "ar didn't seem to work right." >&4 echo "Maybe this is a Cray...trying bld instead..." >&4 - if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then + if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list + then for thisname in $libnames; do bld t $libnames | \ $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list @@ -3191,7 +3283,7 @@ yes) else tval=false; fi;; *) - echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c; + echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c; if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1; then tval=true; else tval=false; @@ -3247,8 +3339,15 @@ yes) esac' : see if gconvert exists +: On some SVR4 systems, gconvert is present but can not be used +: because it requires some other unavailable functions. +: Therefore, do not use the nm extraction, but use a real compile +: and link test instead. +xxx_runnm="$runnm" +runnm=false set gconvert d_gconvert eval $inlibc +runnm="$xxx_runnm" case "$d_gconvert" in $define) @@ -4152,16 +4251,28 @@ eval $setvar $rm -f try.c : see if dlerror exists +: On NetBSD and FreeBSD, dlerror might be available, but it is in +: /usr/lib/crt0.o, not in any of the libraries. Therefore, do not +: use the nm extraction, but use a real compile and link test instead. +xxx_runnm="$runnm" +runnm=false set dlerror d_dlerror eval $inlibc +runnm="$xxx_runnm" : see if dld is available set dld.h i_dld eval $inhdr : see if dlopen exists +: On NetBSD and FreeBSD, dlopen is available, but it is in +: /usr/lib/crt0.o, not in any of the libraries. Therefore, do not +: use the nm extraction, but use a real compile and link test instead. +xxx_runnm="$runnm" +runnm=false set dlopen d_dlopen eval $inlibc +runnm="$xxx_runnm" : determine which dynamic loading, if any, to compile in echo " " @@ -4229,9 +4340,8 @@ EOM '') case "$osname" in hpux) dflt='+z' ;; next) dflt='none' ;; - solaris) dflt='-K pic' ;; + solaris|svr4*|esix*) dflt='-Kpic' ;; sunos) dflt='-pic' ;; - svr4*|esix*) dflt='-Kpic' ;; *) dflt='none' ;; esac ;; *) dflt='-fpic' ;; @@ -4836,47 +4946,6 @@ eval $inlibc set link d_link eval $inlibc -: see if stdio is really std -echo " " -xxx=`./findhdr stdio.h` -if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then - if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then - echo "Your stdio is pretty std." >&4 - val="$define" - else - echo "Your stdio isn't very std." >&4 - val="$undef" - fi -else - echo "Your stdio isn't very std." >&4 - val="$undef" -fi -set d_stdstdio -eval $setvar - -: see if stdio is like that in linux -case "$d_stdstdio" in -"$undef") - echo " " - xxx=`./findhdr stdio.h` - $cppstdin $cppflags $cppminus < "$xxx" > stdio.E - if $contains 'char.*_IO_read_base' stdio.E >/dev/null 2>&1 && \ - $contains '_IO_read_ptr' stdio.E >/dev/null 2>&1 && \ - $contains '_IO_read_end' stdio.E >/dev/null 2>&1 ; then - echo "Your stdio looks like linux." >&4 - val="$define" - else - echo "You don't have linux stdio, either." >&4 - val="$undef" - fi - $rm -f stdio.E - ;; -*) val="$undef" ;; -esac - -set d_linuxstd -eval $setvar - : see if localeconv exists set localeconv d_locconv eval $inlibc @@ -5422,6 +5491,49 @@ fi set d_shm eval $setvar +: determine whether the user wants to include a site-specific library +: in addition to privlib. +$cat </dev/null 2>&1 ; then + echo "(Looks like you have stdio.h from Linux.)" + case "$stdio_ptr" in + '') stdio_ptr='((fp)->_IO_read_ptr)';; + esac + case "$stdio_cnt" in + '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)';; + esac + case "$stdio_base" in + '') stdio_base='((fp)->_IO_read_base)';; + esac + case "$stdio_bufsiz" in + '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base))';; + esac +else + case "$stdio_ptr" in + '') stdio_ptr='((fp)->_ptr)';; + esac + case "$stdio_cnt" in + '') stdio_cnt='((fp)->_cnt)';; + esac + case "$stdio_base" in + '') stdio_base='((fp)->_base)';; + esac + case "$stdio_bufsiz" in + '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';; + esac +fi +: test whether _ptr and _cnt really work +echo "Checking how std your stdio is..." >&4 +$cat >try.c < +#define FILE_ptr(fp) $stdio_ptr +#define FILE_cnt(fp) $stdio_cnt +main() { + FILE *fp = fopen("try.c", "r"); + char c = getc(fp); + if ( + 18 <= FILE_cnt(fp) && + strncmp(FILE_ptr(fp), "include \n", 18) == 0 + ) + exit(0); + exit(1); +} +EOP +val="$undef" +if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then + if ./try; then + echo "Your stdio acts pretty std." + val="$define" + else + echo "Your stdio isn't very std." + fi +else + echo "Your stdio doesn't appear very std." +fi +$rm -f try.c try +set d_stdstdio +eval $setvar + +: see if _base is also standard +val="$undef" +case "$d_stdstdio" in +$define) + $cat >try.c < +#define FILE_base(fp) $stdio_base +#define FILE_bufsiz(fp) $stdio_bufsiz +main() { + FILE *fp = fopen("try.c", "r"); + char c = getc(fp); + if ( + 19 <= FILE_bufsiz(fp) && + strncmp(FILE_base(fp), "#include \n", 19) == 0 + ) + exit(0); + exit(1); +} +EOP + if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then + if ./try; then + echo "Even its _base field acts std." + val="$define" + else + echo "But its _base field isn't std." + fi + else + echo "However, it seems to be lacking the _base field." + fi + $rm -f try.c try + ;; +esac +set d_stdiobase +eval $setvar + : see if strcoll exists set strcoll d_strcoll eval $inlibc @@ -6143,20 +6352,20 @@ eval $inhdr case "$i_db" in define) : Check the return type needed for hash + echo " " echo "Checking return type needed for hash for Berkeley DB ..." >&4 $cat >try.c <<'EOCP' #include #include -u_int32_t -hash_cb (ptr, size) -const void * ptr ; -size_t size ; +u_int32_t hash_cb (ptr, size) +void *ptr; +size_t size; { } -HASHINFO info ; +HASHINFO info; main() { - info.hash = hash_cb ; + info.hash = hash_cb; } EOCP if $cc $ccflags -c try.c >try.out 2>&1 ; then @@ -6179,20 +6388,20 @@ esac case "$i_db" in define) : Check the return type needed for prefix + echo " " echo "Checking return type needed for prefix for Berkeley DB ..." >&4 cat >try.c <<'EOCP' #include #include -size_t -prefix_cb (key1, key2) -const DBT * key1 ; -const DBT * key2 ; +size_t prefix_cb (key1, key2) +DBT *key1; +DBT *key2; { } -BTREEINFO info ; +BTREEINFO info; main() { - info.prefix = prefix_cb ; + info.prefix = prefix_cb; } EOCP if $cc $ccflags -c try.c >try.out 2>&1 ; then @@ -6571,7 +6780,7 @@ rp="What type is lseek's offset on this system declared as?" lseektype="$ans" : determine where manual pages go -set mansrc mansrc none +set man1dir man1dir none eval $prefixit $cat <&4 - xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`" "`./findhdr linux/signal.h` + xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h` + xxx="$xxx "`./findhdr linux/signal.h` set X `cat $xxx 2>&1 | $awk ' $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { sig[$3] = substr($2,4,20) @@ -7638,6 +7931,19 @@ case "$d_vfork" in ;; esac +: Remove build directory name from cppstdin so it can be used from +: either the present location or the final installed location. +echo " " +: Get out of the UU directory to get correct path name. +cd .. +case "$cppstdin" in +`pwd`/cppstdin) + echo "Stripping down cppstdin path name" + cppstdin=cppstdin + ;; +esac +cd UU + : end of configuration questions echo " " echo "End of configuration questions." @@ -7796,7 +8102,6 @@ d_index='$d_index' d_isascii='$d_isascii' d_killpg='$d_killpg' d_link='$d_link' -d_linuxstd='$d_linuxstd' d_locconv='$d_locconv' d_lockf='$d_lockf' d_lstat='$d_lstat' @@ -7865,9 +8170,11 @@ d_shmctl='$d_shmctl' d_shmdt='$d_shmdt' d_shmget='$d_shmget' d_shrplib='$d_shrplib' +d_sitelib='$d_sitelib' d_socket='$d_socket' d_sockpair='$d_sockpair' d_statblks='$d_statblks' +d_stdiobase='$d_stdiobase' d_stdstdio='$d_stdstdio' d_strchr='$d_strchr' d_strcoll='$d_strcoll' @@ -7983,9 +8290,11 @@ incpath='$incpath' inews='$inews' installarchlib='$installarchlib' installbin='$installbin' -installmansrc='$installmansrc' +installman1dir='$installman1dir' +installman3dir='$installman3dir' installprivlib='$installprivlib' installscript='$installscript' +installsitelib='$installsitelib' intsize='$intsize' known_extensions='$known_extensions' ksh='$ksh' @@ -8013,9 +8322,12 @@ make='$make' mallocobj='$mallocobj' mallocsrc='$mallocsrc' malloctype='$malloctype' -manext='$manext' -mansrc='$mansrc' -mansrcexp='$mansrcexp' +man1dir='$man1dir' +man1direxp='$man1direxp' +man1ext='$man1ext' +man3dir='$man3dir' +man3direxp='$man3direxp' +man3ext='$man3ext' medium='$medium' mips='$mips' mips_type='$mips_type' @@ -8067,6 +8379,8 @@ shrpdir='$shrpdir' shsharp='$shsharp' sig_name='$sig_name' signal_t='$signal_t' +sitelib='$sitelib' +sitelibexp='$sitelibexp' sizetype='$sizetype' sleep='$sleep' smail='$smail' @@ -8082,6 +8396,10 @@ ssizetype='$ssizetype' startsh='$startsh' static_ext='$static_ext' stdchar='$stdchar' +stdio_base='$stdio_base' +stdio_bufsiz='$stdio_bufsiz' +stdio_cnt='$stdio_cnt' +stdio_ptr='$stdio_ptr' strings='$strings' submit='$submit' sysman='$sysman' diff --git a/MANIFEST b/MANIFEST index 59137b7..4dcea9a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,5 +1,6 @@ Artistic The "Artistic License" -Changes Differences between Perl 4 and Perl 5 +Changes Differences from previous versions. +Changes.Conf Recent changes in the Configure & build process Configure Portability tool Copying The GNU General Public License Doc/perl5-notes Samples of new functionality @@ -11,19 +12,18 @@ README The Instructions README.vms Notes about VMS Todo The Wishlist XSUB.h Include file for extension subroutines -autosplit Splits up autoloader functions av.c Array value code av.h Array value header c2ph.SH program to translate dbx stabs to perl c2ph.doc documentation for c2ph cflags.SH A script that emits C compilation flags per file -config.H Sample config.h +config_H Sample config.h config_h.SH Produces config.h configpm Produces lib/Config.pm +configure Crude emulation of GNU configure cop.h Control operator header cv.h Code value header deb.c Debugging routines -doSH Script to run all the *.SH files doio.c I/O operations doop.c Support code for various operations dosish.h Some defines for MS/DOSish machines @@ -85,7 +85,6 @@ ext/DB_File/DB_File.xs Berkeley DB extension external subroutines ext/DB_File/DB_File_BS Berkeley DB extension mkbootstrap fodder ext/DB_File/Makefile.PL Berkeley DB extension makefile writer ext/DB_File/typemap Berkeley DB extension interface types -ext/DynaLoader/DynaLoader.doc Dynamic Loader specification ext/DynaLoader/DynaLoader.pm Dynamic Loader perl module ext/DynaLoader/Makefile.PL Dynamic Loader makefile writer ext/DynaLoader/README Dynamic Loader notes and intro @@ -187,6 +186,7 @@ hints/dec_osf.sh Hints for named architecture hints/dgux.sh Hints for named architecture hints/dnix.sh Hints for named architecture hints/dynix.sh Hints for named architecture +hints/epix.sh Hints for named architecture hints/esix4.sh Hints for named architecture hints/fps.sh Hints for named architecture hints/freebsd.sh Hints for named architecture @@ -230,6 +230,7 @@ hints/utekv.sh Hints for named architecture hints/uts.sh Hints for named architecture hv.c Hash value code hv.h Hash value header +installman Perl script to install man pages for pods. installperl Perl script to do "make install" dirty work interp.sym Interpreter specific symbols to hide in a struct ioctl.pl Sample ioctl.pl @@ -263,6 +264,7 @@ lib/Math/Complex.pm A Complex package lib/Net/Ping.pm Ping methods lib/Search/Dict.pm A module to do binary search on dictionaries lib/Shell.pm A module to make AUTOLOADEed system() calls +lib/SubstrHash.pm Compact hash for known key, value and table size lib/Sys/Hostname.pm Hostname methods lib/Sys/Syslog.pm Perl module supporting syslogging lib/Term/Cap.pm Perl module supporting termcap usage @@ -273,7 +275,6 @@ lib/Text/ParseWords.pm Perl module to split words on arbitrary delimiter lib/Text/Soundex.pm Perl module to implement Soundex lib/Text/Tabs.pm Do expand and unexpand lib/TieHash.pm Base class for tied hashes -lib/SubstrHash.pm Compact hash for known key, value and table size lib/Time/Local.pm Reverse translation of localtime, gmtime lib/abbrev.pl An abbreviation table builder lib/assert.pl assertion and panic with stack trace @@ -334,6 +335,7 @@ patchlevel.h The current patch level of perl perl.c main() perl.h Global declarations perl_exp.SH Creates list of exported symbols for AIX. +perldoc.SH A simple tool to find & display perl's documentation perlsh A poor man's perl shell perly.c A byacc'ed perly.y perly.c.diff Fixup perly.c to allow recursion @@ -342,39 +344,6 @@ perly.h The header file for perly.c perly.y Yacc grammar for perl pl2pm A pl to pm translator pod/Makefile Make pods into something else -pod/modpods/Abbrev.pod Doc for Abbrev.pm -pod/modpods/AnyDBMFile.pod Doc for AnyDBMFile.pm -pod/modpods/AutoLoader.pod Doc for AutoLoader.pm -pod/modpods/AutoSplit.pod Doc for AutoSplit.pm -pod/modpods/Basename.pod Doc for Basename.pm -pod/modpods/Benchmark.pod Doc for Benchmark.pm -pod/modpods/Carp.pod Doc for Carp.pm -pod/modpods/CheckTree.pod Doc for CheckTree.pm -pod/modpods/Collate.pod Doc for Collate.pm -pod/modpods/Config.pod Doc for Config.pm -pod/modpods/Cwd.pod Doc for Cwd.pm -pod/modpods/DB_File.pod Doc for File.pm -pod/modpods/Dynaloader.pod Doc for Dynaloader.pm -pod/modpods/English.pod Doc for English.pm -pod/modpods/Env.pod Doc for Env.pm -pod/modpods/Exporter.pod Doc for Exporter.pm -pod/modpods/Fcntl.pod Doc for Fcntl.pm -pod/modpods/FileHandle.pod Doc for FileHandle.pm -pod/modpods/Find.pod Doc for Find.pm -pod/modpods/Finddepth.pod Doc for Finddepth.pm -pod/modpods/GetOptions.pod Doc for GetOptions.pm -pod/modpods/Getopt.pod Doc for Getopt.pm -pod/modpods/MakeMaker.pod Doc for MakeMaker.pm -pod/modpods/Open2.pod Doc for Open2.pm -pod/modpods/Open3.pod Doc for Open3.pm -pod/modpods/POSIX.pod Doc for POSIX.pm -pod/modpods/Ping.pod Doc for Ping.pm -pod/modpods/Socket.pod Doc for Socket.pm -pod/modpods/integer.pod Doc for integer.pm -pod/modpods/less.pod Doc for less.pm -pod/modpods/sigtrap.pod Doc for sigtrap.pm -pod/modpods/strict.pod Doc for strict.pm -pod/modpods/subs.pod Doc for subs.pm pod/perl.pod Top level perl man page pod/perlapi.pod XS api info pod/perlbook.pod Book info @@ -435,6 +404,7 @@ t/cmd/subval.t See if subroutine values work t/cmd/switch.t See if switch optimizations work t/cmd/while.t See if while loops work t/comp/cmdopt.t See if command optimization works +t/comp/cpp.aux main file for cpp.t t/comp/cpp.t See if C preprocessor works t/comp/decl.t See if declarations work t/comp/multiline.t See if multiline strings work @@ -561,4 +531,3 @@ x2p/str.h Public declarations for the above x2p/util.c Utility routines x2p/util.h Public declarations for the above x2p/walk.c Parse tree walker -xf A script to translate Perl 4 symbols to Perl 5 diff --git a/Makefile.SH b/Makefile.SH index f5dff60..cdd6333 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -78,11 +78,7 @@ $spitshell >>Makefile <>Makefile <<'!NO!SUBS!' # The $& notation tells Sequent machines that it can do a parallel make, # and is harmless otherwise. @@ -250,11 +252,22 @@ sperl.o: perl.c perly.h patchlevel.h $(h) $(CCCMD) -DIAMSUID sperl.c $(RMS) sperl.c +# The following three header files are generated automatically +# The correct versions should be already supplied with the perl kit, +# in case you don't have perl or 'sh' available. +# The - is to ignore error return codes in case you have the source +# installed read-only or you don't have perl yet. +keywords.h: keywords.pl + @echo "Don't worry if this fails." + - perl keywords.pl + opcode.h: opcode.pl + @echo "Don't worry if this fails." - perl opcode.pl embed.h: embed_h.sh global.sym interp.sym - sh embed_h.sh + @echo "Don't worry if this fails." + - sh embed_h.sh # We have to call our ./makedir because Ultrix 4.3 make can't handle the line # test -d lib/auto || mkdir lib/auto @@ -273,9 +286,18 @@ lib/Config.pm: config.sh miniperl lib/ExtUtils/Miniperl.pm: miniperlmain.c miniperl minimod.PL lib/Config.pm ./miniperl minimod.PL > tmp && mv tmp $@ -install: all +install: all install.perl install.man + +install.perl: all ./perl installperl +install.man: all + ./perl installman + +# Not implemented yet. +#install.html: all +# ./perl installhtml + # I now supply perly.c with the kits, so the following section is # used only if you force byacc to run by saying # make run_byacc @@ -336,12 +358,11 @@ realclean: clean done rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl rm -rf $(addedbyconf) - rm -f Makefile cflags makedepend makedir writemain - rm -f config.h makefile makefile.old + rm -f makefile makefile.old rm -f $(private) rm -rf lib/auto rm -f lib/.exists - rm -f h2ph h2ph.man c2ph pstruct h2xs makeaperl + rm -f h2ph.man pstruct rm -rf .config @echo "Note that make realclean does not delete config.sh" @@ -374,6 +395,11 @@ test: miniperl perl preplibrary $(dynamic_ext) - cd t && chmod +x TEST */*.t - cd t && (rm -f perl; $(LNS) ../perl perl) && ./perl TEST .clist diff --git a/README b/README index 7ad35b7..23bc7ca 100644 --- a/README +++ b/README @@ -68,14 +68,16 @@ Installation run ok, the defaults will usually be right. It will then proceed to make config.h, config.sh, and Makefile. You may have to explicitly say sh Configure to ensure that Configure is run under sh. - If you're a hotshot, run Configure -d to take all the defaults and - then edit config.sh to patch up any flaws and run Configure -S. + If you're a hotshot, run Configure -d to take all the defaults, + edit config.sh to patch up any flaws, and then run Configure -S. Configure supports a number of useful options. Run Configure -h to get a listing. To compile with gcc, for example, you can run - Configure -Dcc=gcc, or answer 'gcc' at the cc prompt. This is the - preferred way to invoke an alternate compiler, since the hints - files can then set appropriate defaults. + Configure -Dcc=gcc, or answer 'gcc' at the cc prompt. + + If you wish to use gcc (or another alternative compiler)) + you should use Configure -Dcc=gcc. That way, the the hints + files can set appropriate defaults. If you change compilers or make other significant changes, you should probably _not_ re-use your old config.sh. Simply remove it or @@ -94,7 +96,7 @@ Installation if your sh doesn't handle them, but all other # comments will be taken care of. - (If you don't have sh, you'll have to copy the sample file config.H to + (If you don't have sh, you'll have to copy the sample file config_H to config.h and edit the config.h to reflect your system's peculiarities.) 2) Glance through config.h to make sure system dependencies are correct. @@ -130,37 +132,50 @@ Installation Makefile.SH, since a default rule only takes effect in the absence of a specific rule. - Many of the following hints are now done automatically by Configure. - Some of the hints here were for Perl 4, and are probably obsolete. - They're left here for the moment just to give you some ideas for - what to try if you're having trouble. + If you used a hint file, try reading the comments in the hint file + for further tips and information. + + If you can successfully build miniperl, but the process crashes + during the building of extensions, you should run + make minitest + to test your version of miniperl. + + Some additional things that have been reported for either perl4 or + perl5: - AIX/RT may need a -a switch and -DCRIPPLED_CC. - Ultrix 3.[01] on MIPS needs to undefine WAITPID--the system call is busted. - MIPS machines may need to undef d_volatile. - MIPS machines may need to turn off -O on some files. - Some MIPS machines may need to undefine CASTNEGFLOAT. Genix may need to use libc rather than libc_s, or #undef VARARGS. + NCR Tower 32 (OS 2.01.01) may need -W2,-Sl,2000 and #undef MKDIR. - A/UX may appear to work with -O -B/usr/lib/big/ optimizer flags. - A/UX may need -lposix to find rewinddir. - A/UX may need -ZP -DPOSIX, and -g if big cc is used. + UTS may need one or more of -DCRIPPLED_CC, -K or -g, and undef LSTAT. + If you get syntax errors on '(', try -DCRIPPLED_CC. + Machines with half-implemented dbm routines will need to #undef I_ODBM + SCO prior to 3.2.4 may be missing dbmclose(). An upgrade to 3.2.4 that includes libdbm.nfs (which includes dbmclose()) may be available. + If you get duplicates upon linking for malloc et al, say -DHIDEMYMALLOC. + If you get duplicate function definitions (a perl function has the same name as another function on your system) try -DEMBED. + If you get varags problems with gcc, be sure that gcc is installed correctly. When using gcc, you should probably have i_stdarg='define' - and i_varags='undef' in config.sh. + and i_varags='undef' in config.sh. The problem is usually solved + by running fixincludes correctly. + If you wish to use dynamic loading on SunOS or Solaris, and you have GNU as and GNU ld installed, you may need to add -B/bin/ to your $ccflags and $ldflags so that the system's versions of as and ld are used. + If you run into dynamic loading problems, check your setting of + the LD_LIBRARY_PATH environment variable. Perl should build + fine with LD_LIBRARY_PATH unset, though that may depend on details + of your local set-up. + 5) make test This will run the regression tests on the perl you just made. @@ -173,13 +188,14 @@ Installation 6) make install - This will put perl into a public directory (such as /usr/local/bin). - It will also try to put the man pages in a reasonable place. It will not - nroff the man page, however. You may need to be root to do this. If - you are not root, you must own the directories in question and you should - ignore any messages about chown not working. + This will put perl into a public directory (such as + /usr/local/bin). It will also try to put the man pages in a + reasonable place. It will not nroff the man page, however. You + may need to be root to run make install. If you are not root, you + must own the directories in question and you should ignore any + messages about chown not working. - make install will also install the following: + make install will install the following: perl, perl5.nnn where nnn is the current release number. This will be a link to perl. @@ -192,6 +208,7 @@ Installation s2p sed-to-perl translator find2perl find-to-perl translator h2xs Converts C .h header files to Perl extensions. + perldoc Tool to read perl's pod documentation. pod2html, Converters from perl's pod documentation format pod2latex, and to other useful formats. pod2man @@ -200,6 +217,9 @@ Installation Configure, usually under /usr/local/lib/perl5/. man pages in the location specified to Configure, usually something like /usr/local/man/man1. + module in the location specified to Configure, usually + man pages under /usr/local/lib/perl5/man/man3. + pod/*.pod in $privlib/pod/. Perl's *.h header files and the libperl.a library are also installed under $archlib so that you may later build new @@ -208,9 +228,11 @@ Installation make install may also offer to install perl in a "standard" location. Most of the documentation in the pod/ directory is also available - in HTML format. Type + in HTML and LaTeX format. Type cd pod; make html; cd .. - to generate the html versions. + to generate the html versions, and + cd pod; make tex; cd .. + to generate the LaTeX versions. 7) Read the manual entries before running perl. diff --git a/README.vms b/README.vms index 960d98f..e68d32d 100644 --- a/README.vms +++ b/README.vms @@ -211,7 +211,7 @@ If you're interested in up-to-date information on Perl development and internals, you might want to subscribe to the perl5-porters mailing list. You can do this by sending a message to perl5-porters-request@nicoh.com, containing the single line -subscribe perl5-porters Your Name Here +subscribe perl5-porters This is a moderately high-volume list at the moment (25-50 messages/day). Finally, if you're interested in ongoing information about the VMS port, you diff --git a/autosplit b/autosplit deleted file mode 100755 index 7d8e1d2..0000000 --- a/autosplit +++ /dev/null @@ -1,4 +0,0 @@ -#!./miniperl -BEGIN { unshift @INC, "lib" } -use AutoSplit; -autosplit_lib_modules(@ARGV); diff --git a/config.H b/config_H similarity index 94% rename from config.H rename to config_H index 2d2515c..aaba37e 100644 --- a/config.H +++ b/config_H @@ -1,4 +1,4 @@ -/* This file (config.H) is a sample config.h file. If you are unable +/* This file (config_H) is a sample config.h file. If you are unable to successfully run Configure, copy this file to config.h and edit it to suit your system. */ @@ -14,7 +14,7 @@ * $Id: Config_h.U,v 3.0.1.3 1995/01/30 14:25:39 ram Exp $ */ -/* Configuration time: Wed Apr 5 14:50:33 EDT 1995 +/* Configuration time: Tue May 30 13:05:37 EDT 1995 * Configured by: andy * Target system: crystal crystal 3.2 2 i386 */ @@ -161,7 +161,7 @@ * This symbol, if defined, indicates that the chsize routine is available * to truncate files. You might need a -lx to get this routine. */ -#define HAS_CHSIZE /**/ +/*#define HAS_CHSIZE /**/ /* VOID_CLOSEDIR: * This symbol, if defined, indicates that the closedir() routine @@ -296,6 +296,11 @@ * a macro using sprintf("%g") is used. Arguments for the Gconvert * macro are: value, number of digits, whether trailing zeros should * be retained, and the output buffer. + * Possible values are: + * d_Gconvert='gconvert((x),(n),(t),(b))' + * d_Gconvert='gcvt((x),(n),(b))' + * d_Gconvert='sprintf((b),"%.*g",(n),(x))' + * The last two assume trailing zeros should not be kept. */ #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x)) @@ -393,12 +398,6 @@ */ #define HAS_LINK /**/ -/* USE_LINUX_STDIO: - * This symbol is defined if this system has a FILE structure declaring - * _IO_read_base, _IO_read_ptr, and _IO_read_end in stdio.h. - */ -/*#define USE_LINUX_STDIO /**/ - /* HAS_LOCALECONV: * This symbol, if defined, indicates that the localeconv routine is * available for numeric and monetary formatting conventions. @@ -735,11 +734,55 @@ */ /*#define USE_STAT_BLOCKS /**/ -/* USE_STD_STDIO: - * This symbol is defined if this system has a FILE structure declaring - * _ptr and _cnt in stdio.h. +/* USE_STDIO_PTR: + * This symbol is defined if the _ptr and _cnt fields (or similar) + * of the stdio FILE structure can be used to access the stdio buffer + * for a file handle. If this is defined, then the FILE_ptr(fp) + * and FILE_cnt(fp) macros will also be defined and should be used + * to access these fields. + */ +/* USE_STDIO_BASE: + * This symbol is defined if the _base field (or similar) of the + * stdio FILE structure can be used to access the stdio buffer for + * a file handle. If this is defined, then the FILE_base(fp) macro + * will also be defined and should be used to access this field. + * Also, the FILE_bufsiz(fp) macro will be defined and should be used + * to determine the number of bytes in the buffer. USE_STDIO_BASE + * will never be defined unless USE_STDIO_PTR is. + */ +#define USE_STDIO_PTR /**/ +#define USE_STDIO_BASE /**/ + +/* FILE_ptr: + * This macro is used to access the _ptr field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +/* FILE_cnt: + * This macro is used to access the _cnt field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +#ifdef USE_STDIO_PTR +#define FILE_ptr(fp) ((fp)->_ptr) +#define FILE_cnt(fp) ((fp)->_cnt) +#endif + +/* FILE_base: + * This macro is used to access the _base field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_BASE is defined. + */ +/* FILE_bufsiz: + * This macro is used to determine the number of bytes in the I/O + * buffer pointed to by _base field (or equivalent) of the FILE + * structure pointed to its argument. This macro will always be defined + * if USE_STDIO_BASE is defined. */ -#define USE_STD_STDIO /**/ +#ifdef USE_STDIO_BASE +#define FILE_base(fp) ((fp)->_base) +#define FILE_bufsiz(fp) ((fp)->_cnt + (fp)->_ptr - (fp)->_base) +#endif /* HAS_STRCHR: * This symbol is defined to indicate that the strchr()/strrchr() @@ -1023,7 +1066,7 @@ /*#define I_MEMORY /**/ /* I_NDBM: - * This symbol, if defined, indicates that ndbm.h exists and should + * This symbol, if defined, indicates that exists and should * be included. */ #define I_NDBM /**/ @@ -1340,18 +1383,10 @@ #define M_VOID /* Xenix strikes again */ #endif -/* EUNICE: - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. - */ /* VMS: * This symbol, if defined, indicates that the program is running under * VMS. It is currently only set in conjunction with the EUNICE symbol. */ -/*#define EUNICE /**/ /*#define VMS /**/ /* LOC_SED: @@ -1400,4 +1435,10 @@ */ #define MYMALLOC /**/ +/* SITELIB_EXP: + * This symbol contains the ~name expanded version of SITELIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +/*#define SITELIB_EXP "" /**/ + #endif diff --git a/config_h.SH b/config_h.SH index f915d65..6752206 100755 --- a/config_h.SH +++ b/config_h.SH @@ -310,6 +310,11 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' * a macro using sprintf("%g") is used. Arguments for the Gconvert * macro are: value, number of digits, whether trailing zeros should * be retained, and the output buffer. + * Possible values are: + * d_Gconvert='gconvert((x),(n),(t),(b))' + * d_Gconvert='gcvt((x),(n),(b))' + * d_Gconvert='sprintf((b),"%.*g",(n),(x))' + * The last two assume trailing zeros should not be kept. */ #define Gconvert(x,n,t,b) $d_Gconvert @@ -407,12 +412,6 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #$d_link HAS_LINK /**/ -/* USE_LINUX_STDIO: - * This symbol is defined if this system has a FILE structure declaring - * _IO_read_base, _IO_read_ptr, and _IO_read_end in stdio.h. - */ -#$d_linuxstd USE_LINUX_STDIO /**/ - /* HAS_LOCALECONV: * This symbol, if defined, indicates that the localeconv routine is * available for numeric and monetary formatting conventions. @@ -749,11 +748,55 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #$d_statblks USE_STAT_BLOCKS /**/ -/* USE_STD_STDIO: - * This symbol is defined if this system has a FILE structure declaring - * _ptr and _cnt in stdio.h. +/* USE_STDIO_PTR: + * This symbol is defined if the _ptr and _cnt fields (or similar) + * of the stdio FILE structure can be used to access the stdio buffer + * for a file handle. If this is defined, then the FILE_ptr(fp) + * and FILE_cnt(fp) macros will also be defined and should be used + * to access these fields. + */ +/* USE_STDIO_BASE: + * This symbol is defined if the _base field (or similar) of the + * stdio FILE structure can be used to access the stdio buffer for + * a file handle. If this is defined, then the FILE_base(fp) macro + * will also be defined and should be used to access this field. + * Also, the FILE_bufsiz(fp) macro will be defined and should be used + * to determine the number of bytes in the buffer. USE_STDIO_BASE + * will never be defined unless USE_STDIO_PTR is. + */ +#$d_stdstdio USE_STDIO_PTR /**/ +#$d_stdiobase USE_STDIO_BASE /**/ + +/* FILE_ptr: + * This macro is used to access the _ptr field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +/* FILE_cnt: + * This macro is used to access the _cnt field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +#ifdef USE_STDIO_PTR +#define FILE_ptr(fp) $stdio_ptr +#define FILE_cnt(fp) $stdio_cnt +#endif + +/* FILE_base: + * This macro is used to access the _base field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_BASE is defined. + */ +/* FILE_bufsiz: + * This macro is used to determine the number of bytes in the I/O + * buffer pointed to by _base field (or equivalent) of the FILE + * structure pointed to its argument. This macro will always be defined + * if USE_STDIO_BASE is defined. */ -#$d_stdstdio USE_STD_STDIO /**/ +#ifdef USE_STDIO_BASE +#define FILE_base(fp) $stdio_base +#define FILE_bufsiz(fp) $stdio_bufsiz +#endif /* HAS_STRCHR: * This symbol is defined to indicate that the strchr()/strrchr() @@ -1037,7 +1080,7 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' #$i_memory I_MEMORY /**/ /* I_NDBM: - * This symbol, if defined, indicates that ndbm.h exists and should + * This symbol, if defined, indicates that exists and should * be included. */ #$i_ndbm I_NDBM /**/ @@ -1354,18 +1397,10 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' #define M_VOID /* Xenix strikes again */ #endif -/* EUNICE: - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. - */ /* VMS: * This symbol, if defined, indicates that the program is running under * VMS. It is currently only set in conjunction with the EUNICE symbol. */ -#$d_eunice EUNICE /**/ #$d_eunice VMS /**/ /* LOC_SED: @@ -1414,5 +1449,11 @@ sed <config.h -e 's!^#undef!/\*#define!' -e 's!^#un-def!#undef!' */ #$d_mymalloc MYMALLOC /**/ +/* SITELIB_EXP: + * This symbol contains the ~name expanded version of SITELIB, to be used + * in programs that are not prepared to deal with ~ expansion at run-time. + */ +#$d_sitelib SITELIB_EXP "$sitelibexp" /**/ + #endif !GROK!THIS! diff --git a/configpm b/configpm index 7f3ec3e..88abf2e 100755 --- a/configpm +++ b/configpm @@ -29,6 +29,52 @@ require Exporter; ENDOFBEG +print CONFIG <<'EndOfPod'; +=head1 NAME + +Config - access Perl configuration option + +=head1 SYNOPSIS + + use Config; + if ($Config{'cc'} =~ /gcc/) { + print "built by gcc\n"; + } + +=head1 DESCRIPTION + +The Config module contains everything that was available to the +C program at Perl build time. Shell variables from +F are stored in the readonly-variable C<%Config>, indexed by +their names. + +=head1 EXAMPLE + +Here's a more sophisticated example of using %Config: + + use Config; + + defined $Config{sig_name} || die "No sigs?"; + foreach $name (split(' ', $Config{sig_name})) { + $signo{$name} = $i; + $signame[$i] = $name; + $i++; + } + + print "signal #17 = $signame[17]\n"; + if ($signo{ALRM}) { + print "SIGALRM is $signo{ALRM}\n"; + } + +=head1 NOTE + +This module contains a good example of how to make a variable +readonly to those outside of it. + +=cut + +EndOfPod + @fast{@fast} = @fast; @extensions{@extensions} = @extensions; @non_v=(); diff --git a/configure b/configure new file mode 100644 index 0000000..effd0c8 --- /dev/null +++ b/configure @@ -0,0 +1,65 @@ +#! /bin/sh +# GNU configure-like front end to metaconfig's Configure. +# +# Written by Andy Dougherty (doughera@lafcol.lafayette.edu) +# and matthew green (mrg@mame.mu.oz.au) +# +# public domain. + +opts='' +for f in $* +do + case $f in + --help) + echo This is GNU configure-like front end for a MetaConfig Configure. + echo It understands the follow GNU configure options: + echo " --prefix=PREFIX" + echo " --help" + echo "" + echo And these environment variables: + echo " CFLAGS" + echo " CC" + echo " DEFS" + echo 0 + ;; + --prefix=*) + shift + arg=`echo $f | sed 's/--prefix=/-Dprefix=/'` + opts="$opts $arg" + ;; + --*) + opt=`echo $f | sed 's/=.*//'` + echo This GNU configure front end does not understand $opt + exit 1 + ;; + *) + shift + opts="$opts $f" + ;; + esac +done + +case "$CC" in + '') ;; + *) opts="$opts -Dcc='$CC'" ;; +esac + +# join DEFS and CFLAGS together. + +ccflags='' +if test "x$DEFS" != x +then + ccflags=$DEFS +fi +if test "x$CFLAGS" != x +then + ccflags="$ccflags $CFLAGS" +fi + +if test "x$ccflags" != x +then + opts="$opts -Dccflags='$ccflags'" +fi + +echo ./Configure "$opts" -des +./Configure "$opts" -des diff --git a/doSH b/doSH deleted file mode 100755 index e176054..0000000 --- a/doSH +++ /dev/null @@ -1,12 +0,0 @@ -: doSH is obsolete. Just use Configure -S -: -if test -f Configure ; then TOP=.; -elif test -f ../Configure ; then TOP=..; -elif test -f ../../Configure ; then TOP=../..; -elif test -f ../../../Configure ; then TOP=../../..; -elif test -f ../../../../Configure ; then TOP=../../../..; -else - echo "Can't find Configure" ; exit 1 -fi - -sh $TOP/Configure -S diff --git a/doio.c b/doio.c index 9f5a74a..7f2aee1 100644 --- a/doio.c +++ b/doio.c @@ -567,8 +567,8 @@ GV *gv; while (IoIFP(io)) { -#ifdef USE_STD_STDIO /* (the code works without this) */ - if (IoIFP(io)->_cnt > 0) /* cheat a little, since */ +#ifdef USE_STDIO_PTR /* (the code works without this) */ + if (FILE_cnt(IoIFP(io)) > 0) /* cheat a little, since */ return FALSE; /* this is the most usual case */ #endif @@ -577,9 +577,9 @@ GV *gv; (void)ungetc(ch, IoIFP(io)); return FALSE; } -#ifdef USE_STD_STDIO - if (IoIFP(io)->_cnt < -1) - IoIFP(io)->_cnt = -1; +#ifdef USE_STDIO_PTR + if (FILE_cnt(IoIFP(io)) < -1) + FILE_cnt(IoIFP(io)) = -1; #endif if (op->op_flags & OPf_SPECIAL) { /* not necessarily a real EOF yet? */ if (!nextargv(argvgv)) /* get another fp handy */ diff --git a/embed.h b/embed.h index 196a0b8..4c5683a 100644 --- a/embed.h +++ b/embed.h @@ -38,8 +38,6 @@ #define cop_seqmax Perl_cop_seqmax #define cos_amg Perl_cos_amg #define cryptseen Perl_cryptseen -#define cryptswitch_add Perl_cryptswitch_add -#define cryptswitch_fp Perl_cryptswitch_fp #define cshlen Perl_cshlen #define cshname Perl_cshname #define curcop Perl_curcop @@ -61,6 +59,9 @@ #define expect Perl_expect #define expectterm Perl_expectterm #define fallback_amg Perl_fallback_amg +#define filter_add Perl_filter_add +#define filter_del Perl_filter_del +#define filter_read Perl_filter_read #define fold Perl_fold #define freq Perl_freq #define ge_amg Perl_ge_amg @@ -179,6 +180,7 @@ #define retstack_ix Perl_retstack_ix #define retstack_max Perl_retstack_max #define rsfp Perl_rsfp +#define rsfp_filters Perl_rsfp_filters #define rshift_amg Perl_rshift_amg #define rshift_ass_amg Perl_rshift_ass_amg #define savestack Perl_savestack diff --git a/global.sym b/global.sym index 880829c..e400760 100644 --- a/global.sym +++ b/global.sym @@ -35,8 +35,6 @@ concat_ass_amg cop_seqmax cos_amg cryptseen -cryptswitch_add -cryptswitch_fp cshlen cshname curcop @@ -58,6 +56,9 @@ exp_amg expect expectterm fallback_amg +filter_add +filter_del +filter_read fold freq ge_amg @@ -176,6 +177,7 @@ retstack retstack_ix retstack_max rsfp +rsfp_filters rshift_amg rshift_ass_amg savestack diff --git a/gv.c b/gv.c index 276267e..5eee9b6 100644 --- a/gv.c +++ b/gv.c @@ -147,9 +147,7 @@ I32 level; if (GvCVGEN(topgv) >= sub_generation) return topgv; /* valid cached inheritance */ if (!GvCVGEN(topgv)) { /* not an inheritance cache */ - if (CvROOT(cv) || CvXSUB(cv)) - return topgv; /* real definition */ - /* a simple undef -- save the slot for possible re-use */ + return topgv; } else { /* stale cached entry, just junk it */ diff --git a/hints/README.hints b/hints/README.hints index 84503ce..26d1ba7 100644 --- a/hints/README.hints +++ b/hints/README.hints @@ -1,5 +1,5 @@ These files are used by Configure to set things which Configure either -can't or doesn't guess properly. Most of these hints files are from +can't or doesn't guess properly. Many of these hints files are from perl4. They may or may not work with perl5, but they are probably a good starting point. @@ -7,6 +7,7 @@ The following hints files have been tested with at least some version of perl5 and are probably reasonably close to being correct: aix.sh +aux.sh bsd386.sh dec_osf.sh dgux.sh @@ -15,6 +16,7 @@ freebsd.sh hpux_9.sh irix_4.sh irix_5.sh +irix_6.sh isc.sh linux.sh netbsd.sh @@ -33,7 +35,6 @@ The following hints files have not been tested with perl5: 3b1.sh altos486.sh apollo.sh -aux.sh dnix.sh dynix.sh fps.sh diff --git a/hints/aux.sh b/hints/aux.sh index b64f3fd..add0f4d 100644 --- a/hints/aux.sh +++ b/hints/aux.sh @@ -1,3 +1,20 @@ -optimize='-O' -ccflags="$ccflags -B/usr/lib/big/ -DPARAM_NEEDS_TYPES" -POSIX_cflags='ccflags="$ccflags -ZP -Du_long=U32"' +# hints/aux.sh +# +# Improved by Jake Hamby to support both Apple CC +# and GNU CC. Tested on A/UX 3.1.1 with GCC 2.6.3. +# Last modified +# Fri May 5 10:59:43 EDT 1995 + +case "$cc" in +gcc) optimize='-O2' + ccflags="$ccflags -D_POSIX_SOURCE" + echo "Setting hints for GNU CC." + ;; +*) optimize='-O' + ccflags="$ccflags -B/usr/lib/big/ -DPARAM_NEEDS_TYPES -D_POSIX_SOURCE" + POSIX_cflags='ccflags="$ccflags -ZP -Du_long=U32"' + echo "Setting hints for Apple's CC. If you plan to use" + echo "GNU CC, please rerun this Configure script as:" + echo "./Configure -Dcc=gcc" + ;; +esac diff --git a/hints/cxux.sh b/hints/cxux.sh index b4125ae..4946d0b 100644 --- a/hints/cxux.sh +++ b/hints/cxux.sh @@ -74,12 +74,6 @@ cccdlflags='-Zelf -Zpic' ccdlflags='-Zelf -Zlink=dynamic -Wl,-Bexport -u sigaction' lddlflags='-Zlink=so' -# Configure imagines that stdio.h is "standard", but it really isn't. -# Things like the -T and -B file test operators (on file handles) fail when -# it tries to treat it as "standard" -# -d_stdstdio='undef' - # Configure imagines that it sees a pw_quota field, but it is really in a # different structure than the one it thinks it is looking at. WARNING: # Setting this here in the hints file doesn't help. You need to fix this by diff --git a/hints/epix.sh b/hints/epix.sh new file mode 100644 index 0000000..9fd5c90 --- /dev/null +++ b/hints/epix.sh @@ -0,0 +1,73 @@ +# epix.sh +# Hint file for EP/IX on CDC RISC boxes. +# +# From: Stanley Donald Capelik +# Modified by Andy Dougherty +# Last modified: Mon May 8 15:29:18 EDT 1995 +# +# This hint file appears to be based on the svr4 hints for perl5.000, +# with some CDC-specific additions. I've tried to updated it to +# match the 5.001 svr4 hints, which allow for dynamic loading, +# but I have no way of testing the resulting file. +# +# There were also some contradictions that I've tried to straighten +# out, but I'm not sure I got them all right. +# +# Edit config.sh to change shmattype from 'char *' to 'void *'" + +# Use Configure -Dcc=gcc to use gcc. +case "$cc" in +'') cc='/bin/cc3.11' + test -f $cc || cc='/usr/ccs/bin/cc' + ;; +esac + +usrinc='/svr4/usr/include' + +# Various things that Configure apparently doesn't get right. +strings='/svr4/usr/include/string.h' +timeincl='/svr4/usr/include/sys/time.h ' +libc='/svr4/usr/lib/libc.a' +libpth='/svr4/usr/lib /svr4/usr/lib/cmplrs/cc /usr/ccs/lib /svr4/lib /svr4/usr/ucblib' +osname='epix2' +archname='epix2' +d_suidsafe='define' # "./Configure -d" can't figure this out easilly +d_flock='undef' + +# Old version had this, but I'm not sure why since the old version +# also mucked around with libswanted. This is also definitely wrong +# if the user is trying to use DB_File or GDBM_File. +# libs='-lsocket -lnsl -ldbm -ldl -lc -lcrypt -lm -lucb' + +# We include support for using libraries in /usr/ucblib, but the setting +# of libswanted excludes some libraries found there. You may want to +# prevent "ucb" from being removed from libswanted and see if perl will +# build on your system. +ldflags='-non_shared -systype svr4 -L/svr4/usr/lib -L/svr4/usr/lib/cmplrs/cc -L/usr/ccs/lib -L/svr4/usr/ucblib' +ccflags='-systype svr4 -D__STDC__=0 -I/svr4/usr/include -I/svr4/usr/ucbinclude' +cppflags='-D__STDC__=0 -I/svr4/usr/include -I/svr4/usr/ucbinclude' + +# Don't use problematic libraries: + +libswanted=`echo " $libswanted " | sed -e 's/ malloc / /'` # -e 's/ ucb / /'` +# libmalloc.a - Probably using Perl's malloc() anyway. +# libucb.a - Remove it if you have problems ld'ing. We include it because +# it is needed for ODBM_File and NDBM_File extensions. +if [ -r /usr/ucblib/libucb.a ]; then # If using BSD-compat. library: + # Use the "native" counterparts, not the BSD emulation stuff: + d_bcmp='undef'; d_bcopy='undef'; d_bzero='undef'; d_safebcpy='undef' + d_index='undef'; d_killpg='undef'; d_getprior='undef'; d_setprior='undef' + d_setlinebuf='undef'; d_setregid='undef'; d_setreuid='undef' +fi + +lddlflags="-G $ldflags" # Probably needed for dynamic loading + +cat <<'EOM' >&4 + +If you wish to use dynamic linking, you must use + LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH +or + setenv LD_LIBRARY_PATH `pwd` +before running make. + +EOM diff --git a/hints/freebsd.sh b/hints/freebsd.sh index f0c5433..c3a9830 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -10,6 +10,10 @@ # Ollivier Robert # Date: Sat, 8 Apr 1995 20:53:41 +0200 (MET DST) # +# Additional 2.0.5 and 2.1 defined from +# Ollivier Robert +# Date: Fri, 12 May 1995 14:30:38 +0200 (MET DST) +# # FreeBSD has the dynamic loading dl*() functions in /usr/lib/crt0.o, # so Configure doesn't find them (unless you abandon the nm scan). # @@ -18,7 +22,9 @@ # -DPIC is not used by perl proper) but the full define is included to # be consistent with the FreeBSD general shared libs building process. # -# setreuid and friends are inherently broken in all versions of FreeBSD. +# setreuid and friends are inherently broken in all versions of FreeBSD +# before 2.1-current (before approx date 4/15/95). It is fixed in 2.0.5 +# and what-will-be-2.1 # case "$osvers" in @@ -35,7 +41,7 @@ case "$osvers" in d_setrgid='undef' d_setruid='undef' ;; -*) +2.0-RELEASE*) d_dlopen="$define" cccdlflags='-DPIC -fpic' lddlflags='-Bshareable $lddlflags' @@ -44,6 +50,21 @@ case "$osvers" in d_setrgid='undef' d_setruid='undef' ;; +# +# Trying to cover 2.0.5, 2.1-current and future 2.1 +# It does not covert all 2.1-current versions as the output of uname +# changed a few times. +# +2.0.5*|2.0-BUILD|2.1*) + d_dlopen="$define" + cccdlflags='-DPIC -fpic' + lddlflags='-Bshareable $lddlflags' + # Are these defines necessary? Doesn't Configure find them + # correctly? + d_setregid='define' + d_setreuid='define' + d_setrgid='define' + d_setruid='define' esac # Avoid telldir prototype conflict in pp_sys.c (FreeBSD uses const DIR *) # Configure should test for this. Volunteers? diff --git a/hints/irix_4.sh b/hints/irix_4.sh index 9dc1fee..f934ac7 100644 --- a/hints/irix_4.sh +++ b/hints/irix_4.sh @@ -1,10 +1,16 @@ +#irix_4.sh +# Last modified Fri May 5 14:06:37 EDT 1995 optimize='-O1' -usemymalloc='y' + +# Does Configure really get these wrong? Why? d_voidsig=define -usevfork=false d_charsprf=undef -ccflags="-ansiposix -signed" -# + +case "$cc" in +*gcc) ccflags="$ccflags -D_BSD_TYPES" ;; +*) ccflags="$ccflags -ansiposix -signed" ;; +esac + # This hint due thanks Hershel Walters # Date: Tue, 31 Jan 1995 16:32:53 -0600 (CST) # Subject: IRIX4.0.4(.5? 5.0?) problems diff --git a/hints/irix_5.sh b/hints/irix_5.sh index 2f1e855..f0769d0 100644 --- a/hints/irix_5.sh +++ b/hints/irix_5.sh @@ -1,8 +1,16 @@ # irix_5.sh +# Last modified Fri May 5 11:01:23 EDT 1995 ld=ld i_time='define' -ccflags="$ccflags -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000" + +case "$cc" in +*gcc) ccflags="$ccflags -D_BSD_TYPES" ;; +*) ccflags="$ccflags -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000" ;; +esac + lddlflags="-shared" +# For some reason we don't want -lsocket -lnsl or -ldl. Can anyone +# contribute an explanation? set `echo X "$libswanted "|sed -e 's/ socket / /' -e 's/ nsl / /' -e 's/ dl / /'` shift libswanted="$*" diff --git a/hints/irix_6.sh b/hints/irix_6.sh index 0c4b0fc..e810af2 100644 --- a/hints/irix_6.sh +++ b/hints/irix_6.sh @@ -12,6 +12,8 @@ i_time='define' cc="cc -32" ccflags="$ccflags -D_POSIX_SOURCE -ansiposix -D_BSD_TYPES -Olimit 3000" lddlflags="-32 -shared" + +# We don't want these libraries. Anyone know why? set `echo X "$libswanted "|sed -e 's/ socket / /' -e 's/ nsl / /' -e 's/ dl / /'` shift libswanted="$*" diff --git a/hints/linux.sh b/hints/linux.sh index 00643ca..66c28dc 100644 --- a/hints/linux.sh +++ b/hints/linux.sh @@ -8,31 +8,28 @@ # # Consolidated by Andy Dougherty # -# Last updated Thu Apr 6 12:22:03 EDT 1995 +# Last updated Tue May 30 14:25:02 EDT 1995 # # If you wish to use something other than 'gcc' for your compiler, # you should specify it on the Configure command line. To use -# gcc-elf, for exmample, type +# gcc-elf, for exmample, type # ./Configure -Dcc=gcc-elf # perl goes into the /usr tree. See the Filesystem Standard # available via anonymous FTP at tsx-11.mit.edu in # /pub/linux/docs/linux-standards/fsstnd. -# This used to be -# bin='/usr/bin' -# but it doesn't seem sensible to put the binary in /usr and all the -# rest of the support stuff (lib, man pages) into /usr/local. -# However, allow a command line override, e.g. Configure -Dprefix=/foo/bar +# Allow a command line override, e.g. Configure -Dprefix=/foo/bar case "$prefix" in '') prefix='/usr' ;; esac # Perl expects BSD style signal handling. -# gcc defines _G_HAVE_BOOL to 1, but doesn't actually supply bool. +# gcc-2.6.3 defines _G_HAVE_BOOL to 1, but doesn't actually supply bool. ccflags="-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL $ccflags" # The following functions are gcc built-ins, but the Configure tests -# may fail because it doesn't supply a proper prototype. +# may fail because they don't supply proper prototypes. +# This should be fixed as of 5.001f. I'd appreciate reports. d_memcmp=define d_memcpy=define @@ -40,9 +37,13 @@ d_memcpy=define # function in . d_lstat=define +# Explanation? d_dosuid='define' +# I think Configure gets this right now, but I'd appreciate reports. malloctype='void *' + +# Explanation? usemymalloc='n' case "$optimize" in @@ -73,10 +74,16 @@ if ${cc:-gcc} try.c >/dev/null 2>&1 && ./a.out; then You appear to have ELF support. I'll try to use it for dynamic loading. EOM - # Configure now handles these automatically. else - echo "You don't have an ELF gcc, using dld if available." - # We might possibly have a version of DLD around. + cat <<'EOM' + +You don't have an ELF gcc. I will use dld if possible. If you are +using a version of DLD earlier than 3.2.6, or don't have it at all, you +should probably upgrade. If you are forced to use 3.2.4, you should +uncomment a couple of lines in hints/linux.sh and rerun Configure to +disallow shared libraries. + +EOM lddlflags="-r $lddlflags" # These empty values are so that Configure doesn't put in the # Linux ELF values. @@ -91,16 +98,21 @@ else fi rm -rf try.c a.out -cat <<'EOM' +case "$BASH_VERSION" in +1.14.3*) + cat <<'EOM' + +If you get failure of op/exec test #5 during the test phase, you probably +have a buggy version of bash. Upgrading to a recent version (1.14.4 or +later) should fix the problem. -You should take a look at hints/linux.sh. There are a some lines you -may wish to change. EOM +;; +esac + +# In addition, on some systems there is a problem with perl and NDBM, which +# causes AnyDBM and NDBM_File to lock up. This is evidenced in the tests as +# AnyDBM just freezing. Currently we disable NDBM for all linux systems. +# If someone can suggest a more robust test, that would be appreciated. +d_dbm_open=undef -# And -- reported by one user: -# We need to get -lc away from the link lines. -# If we leave it there we get SEGV from miniperl during the build. -# This may have to do with bugs in the pre-release version of libc for ELF. -# Uncomment the next two lines to remove -lc from the link line. -# set `echo " $libswanted " | sed -e 's@ c @ @'` -# libswanted="$*" diff --git a/hints/powerunix.sh b/hints/powerunix.sh index 9ce2462..0878e74 100644 --- a/hints/powerunix.sh +++ b/hints/powerunix.sh @@ -51,12 +51,6 @@ cccdlflags='-Zpic' ccdlflags='-Zlink=dynamic -Wl,-Bexport' lddlflags='-Zlink=so' -# Configure imagines that stdio.h is "standard", but it really isn't. -# Things like the -T and -B file test operators (on file handles) fail when -# it tries to treat it as "standard" -# -d_stdstdio='undef' - # Configure sometime finds what it believes to be ndbm header files on the # system and imagines that we have the NDBM library, but we really don't. # There is something there that once resembled ndbm, but it is purely diff --git a/installman b/installman new file mode 100644 index 0000000..f184fd5 --- /dev/null +++ b/installman @@ -0,0 +1,155 @@ +#!./perl +BEGIN { @INC = ('lib') } +use Config; +use Getopt::Long; +use File::Find; +require Cwd; + +umask 022; + +$ver = $]; +$release = substr($ver,0,3); # Not used presently. +$patchlevel = substr($ver,3,2); +die "Patchlevel of perl ($patchlevel)", + "and patchlevel of config.sh ($Config{'PATCHLEVEL'}) don't match\n" + if $patchlevel != $Config{'PATCHLEVEL'}; + +$usage = +"Usage: installman --man1dir=/usr/wherever --man1ext=1 + --man3dir=/usr/wherever --man3ext=3 + --notify --help + Defaults are: + man1dir = $Config{'installman1dir'}; + man1ext = $Config{'man1ext'}; + man3dir = $Config{'installman3dir'}; + man3ext = $Config{'man3ext'}; + --notify (or -n) just lists commands that would be executed.\n"; + +GetOptions( qw( man1dir=s man1ext=s man3dir=s man3ext=s notify help)) + || die $usage; + +# These are written funny to avoid -w typo warnings. +$man1dir = defined($opt_man1dir) ? $opt_man1dir : $Config{'installman1dir'}; +$man1ext = defined($opt_man1ext) ? $opt_man1ext : $Config{'man1ext'}; +$man3dir = defined($opt_man3dir) ? $opt_man3dir : $Config{'installman3dir'}; +$man3ext = defined($opt_man3ext) ? $opt_man3ext : $Config{'man3ext'}; + +$notify = defined($opt_notify) ? $opt_notify : 0; + +#Sanity checks + +-x "./perl" || warn "./perl not found! Have you run make?\n"; +-d $Config{'installprivlib'} + || warn "Perl library directory $Config{'installprivlib'} not found. + Have you run make install?. (Installing anyway.)\n"; +-x 't/TEST' || warn "WARNING: You've never run 'make test'!!!", + " (Installing anyway.)\n"; + +# Install the main pod pages. +runpod2man('pod', $man1dir, $man1ext); + +# Install the pods for library modules. +runpod2man('lib', $man3dir, $man3ext); + +sub runpod2man { + my($poddir, $mandir, $manext) = @_; + my($builddir) = Cwd::getcwd(); + + if ($mandir eq ' ' or $mandir eq '') { + print STDERR "Skipping installation of $poddir man pages.\n"; + return; + } + + chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n"; + + # We insist on using the current version of pod2man in case there + # are enhancements or changes from previous installed versions. + $pod2man = "../pod/pod2man"; + -x $pod2man || die "Executable $pod2man not found.\n"; + + &makedir($mandir); + # Make a list of all the .pm and .pod files in the directory. We will + # always run pod2man from the lib directory and feed it the full pathname + # of the pod. This might be useful for pod2man someday. + @modpods = (); + find(\&lsmodpods, '.'); + foreach $mod (@modpods) { + $manpage = $mod; + # Convert name from File/Basename.pm to File::Basename.3 format, + # if necessary. + $manpage =~ s#\.p(m|od)$##; + $manpage =~ s#/#::#g; + $manpage = "${mandir}/${manpage}.${manext}"; + # Print $release $patchlevel stuff? or should pod2man do that? + &cmd("$pod2man $mod > $manpage"); + } + chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n"; +} + +sub lsmodpods { + my $dir = $File::Find::dir; + my $name = $File::Find::name; + if (-f $_) { + $name =~ s#^\./##; + push(@modpods, $name) if ($name =~ /\.p(m|od)$/); + } +} + +print STDERR " Installation complete\n"; + +exit 0; + + +############################################################################### +# Utility subroutines from installperl + +sub cmd { + local($cmd) = @_; + print STDERR " $cmd\n"; + unless ($notify) { + system $cmd; + warn "Command failed!!!\n" if $?; + } +} + +sub link { + local($from,$to) = @_; + + print STDERR " ln $from $to\n"; + link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $notify; +} + +sub chmod { + local($mode,$name) = @_; + + printf STDERR " chmod %o %s\n", $mode, $name; + chmod($mode,$name) || warn sprintf("Couldn't chmod %o %s: $!\n",$mode,$name) + unless $notify; +} + +sub makedir { + local($dir) = @_; + unless (-d $dir) { + local($shortdir) = $dir; + + $shortdir =~ s#(.*)/.*#$1#; + &makedir($shortdir); + + print STDERR " mkdir $dir\n"; + mkdir($dir, 0777) || warn "Couldn't create $dir: $!\n" unless $notify; + } +} + +sub samepath { + local($p1, $p2) = @_; + local($dev1, $ino1, $dev2, $ino2); + + if ($p1 ne $p2) { + ($dev1, $ino1) = stat($p1); + ($dev2, $ino2) = stat($p2); + ($dev1 == $dev2 && $ino1 == $ino2); + } + else { + 1; + } +} diff --git a/installperl b/installperl index f9d0ecb..0530d15 100755 --- a/installperl +++ b/installperl @@ -13,8 +13,13 @@ while (@ARGV) { umask 022; @scripts = ('cppstdin', 'c2ph', 'h2xs', 'pstruct', 'x2p/s2p', 'x2p/find2perl', - 'pod/pod2man', 'pod/pod2html', 'pod/pod2latex' ); -@manpages = (, 'x2p/a2p.man', 'x2p/s2p.man'); + 'perldoc', 'pod/pod2man', 'pod/pod2html', 'pod/pod2latex' ); + +# pod documentation now handled by separate installman script. +# These two are archaic leftovers. +@manpages = ('x2p/a2p.man', 'x2p/s2p.man'); + +@pods = (); # Read in the config file. @@ -100,19 +105,27 @@ for (@scripts) { } } -# Install man pages. +# Install pod pages. Where? I guess in $installprivlib/pod. +&makedir("${installprivlib}/pod"); +foreach $file (@pods) { + # $file is a name like pod/perl.pod + cp_if_diff($file, "${installprivlib}/${file}"); +} + +# Install old man pages. -if ($installmansrc ne '') { - &makedir($installmansrc); +if ($installman1dir ne '') { + &makedir($installman1dir); - if (! &samepath($installmansrc, '.')) { + if (! &samepath($installman1dir, '.')) { for (@manpages) { - ($new = $_) =~ s/man$/$manext/; + ($new = $_) =~ s/man$/$man1ext/; $new =~ s#.*/##; - print STDERR " Installing $installmansrc/$new\n"; + print STDERR " Installing $installman1dir/$new\n"; next if $nonono; open(MI,$_) || warn "Can't open $_: $!\n"; - open(MO,">$installmansrc/$new") || warn "Can't install $installmansrc/$new: $!\n"; + open(MO,">$installman1dir/$new") || + warn "Can't install $installman1dir/$new: $!\n"; print MO ".ds RP Release $release Patchlevel $patchlevel\n"; while () { print MO; @@ -146,11 +159,6 @@ else { makedir("$installarchlib/CORE"); foreach $file (<*.h libperl*.*>) { cp_if_diff($file,"$installarchlib/CORE/$file"); - if ($file =~ /\.a$/ && $osname =~ /^(next|sunos)$/) { - # on NeXTs and Suns we have to rerun ranlib after copying libraries - # (maybe on all platforms which have ranlib ?) - &cmd("$ranlib $installarchlib/CORE/$file"); - } } # AIX needs perl.exp installed as well. cp_if_diff("perl.exp" ,"$installarchlib/CORE/perl.exp") if ($osname eq 'aix'); @@ -319,11 +327,7 @@ sub installlib { if ($?) { &unlink("$installlib/$name"); &makedir("$installlib/$dir"); - &cmd("cp $_ $installlib/$dir"); - if (/\.a$/ && $osname eq 'next') { - #on NeXTs we have to rerun ranlib after copying libraries - &cmd("$ranlib $installlib/$dir/$_"); - } + cp_if_diff("$_", "$installlib/$dir/$_"); # HP-UX (at least) needs to maintain execute permissions # on dynamically-loaded libraries. if ($name =~ /\.(so|$dlext)$/o) { @@ -338,12 +342,26 @@ sub installlib { } } +# Copy $from to $to, only if $from is different than $to. +# Also preserve modification times for .a libraries. +# On some systems, if you do +# ranlib libperl.a +# cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a +# and then try to link against the installed libperl.a, you might +# get an error message to the effect that the symbol table is older +# than the library. sub cp_if_diff { my($from,$to)=@_; -f $from || die "$0: $from not found"; system "cmp", "-s", $from, $to; if ($?) { + my ($atime, $mtime); unlink($to); # In case we don't have write permissions. cmd("cp $from $to"); + # Restore timestamps if it's a .a library. + if ($to =~ /\.a$/) { + ($atime, $mtime) = (stat $from)[8,9]; + utime $atime, $mtime, $to; + } } } diff --git a/makedepend.SH b/makedepend.SH index 038d9bf..e958185 100755 --- a/makedepend.SH +++ b/makedepend.SH @@ -43,7 +43,9 @@ case $CONFIG in ;; esac -PATH="$PATH:." +# We need .. when we are in the x2p directory if we are using the +# cppstdin wrapper script. +PATH="$PATH:.:.." export PATH $cat /dev/null >.deptmp diff --git a/opcode.h b/opcode.h index d623cf9..1651a25 100644 --- a/opcode.h +++ b/opcode.h @@ -2058,7 +2058,7 @@ EXT U32 opargs[] = { 0x0001111d, /* shmget */ 0x0001111d, /* shmctl */ 0x0011111d, /* shmread */ - 0x0011111c, /* shmwrite */ + 0x0011111d, /* shmwrite */ 0x0000111d, /* msgget */ 0x0001111d, /* msgctl */ 0x0001111d, /* msgsnd */ diff --git a/opcode.pl b/opcode.pl index dcd03b5..dcb6afe 100755 --- a/opcode.pl +++ b/opcode.pl @@ -558,7 +558,7 @@ sleep sleep ck_fun ist S? shmget shmget ck_fun imst S S S shmctl shmctl ck_fun imst S S S shmread shmread ck_fun imst S S S S -shmwrite shmwrite ck_fun ist S S S S +shmwrite shmwrite ck_fun imst S S S S # Message passing. diff --git a/perl.c b/perl.c index a01afc1..eee8e0f 100644 --- a/perl.c +++ b/perl.c @@ -996,7 +996,7 @@ char *s; return s; case 'v': printf("\nThis is perl, version %s\n\n",patchlevel); - fputs("\tUnofficial patchlevel 1e.\n",stdout); + fputs("\tUnofficial patchlevel 1i.\n",stdout); fputs("\nCopyright 1987-1994, Larry Wall\n",stdout); #ifdef MSDOS fputs("MS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n", @@ -1690,6 +1690,9 @@ init_perllib() incpush(getenv("PERLLIB")); } +#ifdef SITELIB_EXP + incpush(SITELIB_EXP); +#endif #ifdef ARCHLIB_EXP incpush(ARCHLIB_EXP); #endif diff --git a/perl.h b/perl.h index 8cb8330..5656d25 100644 --- a/perl.h +++ b/perl.h @@ -127,6 +127,10 @@ EXT char Error[1]; # undef HAS_MEMCMP #endif +#ifdef I_MEMORY +# include +#endif + #ifdef HAS_MEMCPY # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY) # ifndef memcpy @@ -525,10 +529,13 @@ typedef struct xpvio XPVIO; typedef struct mgvtbl MGVTBL; typedef union any ANY; -typedef int (*cryptswitch_t) _((void)); - #include "handy.h" +typedef I32 (*filter_t) _((int, SV *, int)); +#define FILTER_READ(idx, sv, len) filter_read(idx, sv, len) +#define FILTER_DATA(idx) (AvARRAY(rsfp_filters)[idx]) +#define FILTER_ISREADER(idx) (idx >= AvFILL(rsfp_filters)) + #ifdef DOSISH # include "dosish.h" #else @@ -780,7 +787,7 @@ Off_t lseek _((int,Off_t,int)); char *getlogin _((void)); #endif -#ifdef EUNICE +#ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */ #define UNLINK unlnk I32 unlnk _((char*)); #else @@ -1080,7 +1087,7 @@ EXT char * oldoldbufptr; EXT char * bufend; EXT expectation expect INIT(XSTATE); /* how to interpret ambiguous tokens */ EXT char * autoboot_preamble INIT(Nullch); -EXT cryptswitch_t cryptswitch_fp; +EXT AV * rsfp_filters; EXT I32 multi_start; /* 1st line of multi-line string */ EXT I32 multi_end; /* last line of multi-line string */ diff --git a/perldoc.SH b/perldoc.SH new file mode 100644 index 0000000..e752f56 --- /dev/null +++ b/perldoc.SH @@ -0,0 +1,201 @@ +case $CONFIG in +'') + if test -f config.sh; then TOP=.; + elif test -f ../config.sh; then TOP=..; + elif test -f ../../config.sh; then TOP=../..; + elif test -f ../../../config.sh; then TOP=../../..; + elif test -f ../../../../config.sh; then TOP=../../../..; + else + echo "Can't find config.sh."; exit 1 + fi + . $TOP/config.sh + ;; +esac +: This forces SH files to create target in same directory as SH file. +: This is so that make depend always knows where to find SH derivatives. +case "$0" in +*/*) cd `expr X$0 : 'X\(.*\)/'` ;; +esac +echo "Extracting perldoc (with variable substitutions)" +$spitshell >perldoc <>perldoc <<'!NO!SUBS!' + +# +# Perldoc revision #1 -- look up a piece of documentation in .pod format that +# is embedded in the perl installation tree. +# +# This is not to be confused with Tom Christianson's perlman, which is a +# man replacement, written in perl. This perldoc is strictly for reading +# the perl manuals, though it too is written in perl. +# +# Version 1.01: Tue May 30 14:47:34 EDT 1995 +# Andy Dougherty +# -added pod documentation. +# -added PATH searching. +# -added searching pod/ subdirectory (mainly to pick up perlfunc.pod +# and friends. + +=head1 NAME + +perldoc - Look up Perl documentation in pod format. + +=head1 SYNOPSIS + +B [B<-h>] PageName|ModuleName + +=head1 DESCRIPTION + +I looks up a piece of documentation in .pod format that is +embedded in the perl installation tree or in a perl script, and displays +it via pod2man | nroff -man | $PAGER. This is primarily used for the +documentation for the perl library modules. + +Your system may also have man pages installed for those modules, in +which case you can probably just use the man(1) command. + +=head1 OPTIONS + +=over 5 + +=item B<-h> help + +Prints out a brief help message. + +=item B + +The item you want to look up. Nested modules (such as C) +are specified either as C or C. You +may also give a descriptive name of a page, such as C. + +=back + +=head1 ENVIRONMENT + +Any switches in the C environment variable will be used before the +command line arguments. C also searches directories +specified by the C (or C if C is not +defined) and C environment variables. +(The latter is so that embedded pods for executables, such as +C itself, are available.) + +=head1 AUTHOR + +Kenneth Albanowski + +Minor updates by Andy Dougherty + +=head1 SEE ALSO + +=head1 DIAGNOSTICS + +=cut + +if(@ARGV<1) { + die < to get aquainted +with the system. +EOF +} + +use Getopt::Std; + +sub usage{ + warn "@_\n" if @_; + die <) { + if(/^=head/) { + close(TEST); + return 1; + } + } + close(TEST); + return 0; +} + +sub searchfor { + my($s,@dirs) = @_; + $s =~ s!::!/!g; + printf STDERR "looking for $s in @dirs\n"; + + foreach $dir (@dirs) { + if( -f "$dir/$s.pod") { return "$dir/$s.pod" } + elsif( -f "$dir/$s.pm" and containspod("$dir/$s.pm")) + { return "$dir/$s.pm" } + elsif( -f "$dir/$s" and containspod("$dir/$s")) + { return "$dir/$s" } + elsif( -f "$dir/pod/$s.pod") { return "$dir/pod/$s.pod" } + elsif( -f "$dir/pod/$s" and containspod("$dir/pod/$s")) + { return "$dir/pod/$s" } + } + return (); +} + + +$ENV{PAGER} ||= "more"; + +foreach (@pages) { + print STDERR "Searching for $_\n"; + # We must look both in @INC for library modules and in PATH + # for executables, like h2xs or perldoc itself. + @searchdirs = @INC; + push(@searchdirs, split(':', $ENV{'PATH'}) ); + @files= searchfor($_,@searchdirs); + if( @files ) { + print STDERR "Found as @files\n"; + } else { + print STDERR "No documentation found for $_\n"; + } + push(@found,@files); +} + +$cmd=$filter=""; + +if( ! -t STDOUT ) { $opt_f = 1 } + +$cmd = "pod2man - | nroff -man"; +if( ! $opt_f ) { $filter = "|$ENV{PAGER}" }; + +open(OUT,"|$cmd$filter"); +foreach (@found) { + open(IN,"<$_"); + print OUT while ; + close(IN); +} +close(OUT); +!NO!SUBS! +chmod 755 perldoc +$eunicefix perldoc diff --git a/pod/perl.pod b/pod/perl.pod index d0d15b1..1f54df7 100644 --- a/pod/perl.pod +++ b/pod/perl.pod @@ -36,6 +36,22 @@ of sections: (If you're intending to read these straight through for the first time, the suggested order will tend to reduce the number of forward references.) +Additional documentation for perl modules is available in +the F directory. You can view this +with a man(1) program by including the following in the +appropriate start-up files. (You may have to adjust the path to +match $Config{'man3dir'}.) + + .profile (for sh, bash or ksh users): + MANPATH=$MANPATH:/usr/local/lib/perl5/man + export MANPATH + + .login (for csh or tcsh users): + setenv MANPATH $MANPATH:/usr/local/lib/perl5/man + +If that doesn't work for some reason, you can still use the +supplied perldoc script to view module information. + If something strange has gone wrong with your program and you're not sure where you should look for help, try the B<-w> switch first. It will often point out exactly where the trouble is. @@ -269,3 +285,4 @@ how many more is left as an exercise to the reader. The three principle virtues of a programmer are Laziness, Impatience, and Hubris. See the Camel Book for why. + diff --git a/pp_ctl.c b/pp_ctl.c index 201c32e..a2dc38e 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -1298,6 +1298,8 @@ PP(pp_return) if (stack == sortstack) { if (cxstack_ix == sortcxix || dopoptosub(cxstack_ix) < sortcxix) { + if (cxstack_ix > sortcxix) + dounwind(sortcxix); AvARRAY(stack)[1] = *SP; stack_sp = stack_base + 1; return 0; diff --git a/pp_hot.c b/pp_hot.c index 2812428..2628c3a 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -974,7 +974,7 @@ do_readline() sv_setpvn(tmpcmd, cshname, cshlen); sv_catpv(tmpcmd, " -cf 'set nonomatch; glob "); sv_catsv(tmpcmd, tmpglob); - sv_catpv(tmpcmd, "'|"); + sv_catpv(tmpcmd, "' 2>/dev/null |"); #else sv_setpv(tmpcmd, "echo "); sv_catsv(tmpcmd, tmpglob); @@ -1809,8 +1809,10 @@ PP(pp_method) sv = *(stack_base + TOPMARK + 1); gv = 0; + if (SvGMAGICAL(sv)) + mg_get(sv); if (SvROK(sv)) - ob = SvRV(sv); + ob = (SV*)SvRV(sv); else { GV* iogv; char* packname = 0; diff --git a/pp_sys.c b/pp_sys.c index 8776975..8a6c17a 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -17,11 +17,15 @@ #include "EXTERN.h" #include "perl.h" -/* Omit this -- it causes too much grief on mixed systems. -#ifdef I_UNISTD -#include -#endif +/* XXX Omit this -- it causes too much grief on mixed systems. + Next time, I should force broken systems to unset i_unistd in + hint files. */ +#if 0 +# ifdef I_UNISTD +# include +# endif +#endif /* Put this after #includes because fork and vfork prototypes may conflict. @@ -1242,7 +1246,12 @@ PP(pp_flock) int argtype; GV *gv; FILE *fp; -#ifdef HAS_FLOCK + +#if !defined(HAS_FLOCK) && defined(HAS_LOCKF) +# define flock lockf_emulate_flock +#endif + +#if defined(HAS_FLOCK) || defined(flock) argtype = POPi; if (MAXARG <= 0) gv = last_in_gv; @@ -1260,11 +1269,7 @@ PP(pp_flock) PUSHi(value); RETURN; #else -# ifdef HAS_LOCKF - DIE(no_func, "flock()"); /* XXX emulate flock() with lockf()? */ -# else DIE(no_func, "flock()"); -# endif #endif } @@ -2032,18 +2037,12 @@ PP(pp_fttty) RETPUSHNO; } -#if defined(USE_STD_STDIO) || defined(atarist) /* this will work with atariST */ -# define FBASE(f) ((f)->_base) -# define FSIZE(f) ((f)->_cnt + ((f)->_ptr - (f)->_base)) -# define FPTR(f) ((f)->_ptr) -# define FCOUNT(f) ((f)->_cnt) -#else -# if defined(USE_LINUX_STDIO) -# define FBASE(f) ((f)->_IO_read_base) -# define FSIZE(f) ((f)->_IO_read_end - FBASE(f)) -# define FPTR(f) ((f)->_IO_read_ptr) -# define FCOUNT(f) ((f)->_IO_read_end - FPTR(f)) -# endif +#if defined(atarist) /* this will work with atariST. Configure will + make guesses for other systems. */ +# define FILE_base(f) ((f)->_base) +# define FILE_ptr(f) ((f)->_ptr) +# define FILE_cnt(f) ((f)->_cnt) +# define FILE_bufsiz(f) ((f)->_cnt + ((f)->_ptr - (f)->_base)) #endif PP(pp_fttext) @@ -2073,22 +2072,22 @@ PP(pp_fttext) io = GvIO(statgv); } if (io && IoIFP(io)) { -#ifdef FBASE +#ifdef FILE_base Fstat(fileno(IoIFP(io)), &statcache); if (S_ISDIR(statcache.st_mode)) /* handle NFS glitch */ if (op->op_type == OP_FTTEXT) RETPUSHNO; else RETPUSHYES; - if (FCOUNT(IoIFP(io)) <= 0) { + if (FILE_cnt(IoIFP(io)) <= 0) { i = getc(IoIFP(io)); if (i != EOF) (void)ungetc(i, IoIFP(io)); } - if (FCOUNT(IoIFP(io)) <= 0) /* null file is anything */ + if (FILE_cnt(IoIFP(io)) <= 0) /* null file is anything */ RETPUSHYES; - len = FSIZE(IoIFP(io)); - s = FBASE(IoIFP(io)); + len = FILE_bufsiz(IoIFP(io)); + s = FILE_base(IoIFP(io)); #else DIE("-T and -B not implemented on filehandles"); #endif @@ -2321,7 +2320,7 @@ char *cmd; char *filename; { char mybuf[8192]; - char *s, + char *s, *save_filename = filename; int anum = 1; FILE *myfp; @@ -3871,3 +3870,91 @@ PP(pp_syscall) #endif } +#if !defined(HAS_FLOCK) && defined(HAS_LOCKF) + +/* XXX Emulate flock() with lockf(). This is just to increase + portability of scripts. The calls are not completely + interchangeable. What's really needed is a good file + locking module. +*/ + +/* We might need because it sometimes defines the lockf() + constants. Unfortunately, causes troubles on some mixed + (BSD/POSIX) systems, such as SunOS 4.1.3. We could just try including + here in this part of the file, but that might + conflict with various other #defines and includes above, such as + #define vfork fork above. + + Further, the lockf() constants aren't POSIX, so they might not be + visible if we're compiling with _POSIX_SOURCE defined. Thus, we'll + just stick in the SVID values and be done with it. Sigh. +*/ + +# ifndef F_ULOCK +# define F_ULOCK 0 /* Unlock a previously locked region */ +# endif +# ifndef F_LOCK +# define F_LOCK 1 /* Lock a region for exclusive use */ +# endif +# ifndef F_TLOCK +# define F_TLOCK 2 /* Test and lock a region for exclusive use */ +# endif +# ifndef F_TEST +# define F_TEST 3 /* Test a region for other processes locks */ +# endif + +/* These are the flock() constants. Since this sytems doesn't have + flock(), the values of the constants are probably not available. +*/ +# ifndef LOCK_SH +# define LOCK_SH 1 +# endif +# ifndef LOCK_EX +# define LOCK_EX 2 +# endif +# ifndef LOCK_NB +# define LOCK_NB 4 +# endif +# ifndef LOCK_UN +# define LOCK_UN 8 +# endif + +int +lockf_emulate_flock (fd, operation) +int fd; +int operation; +{ + int i; + switch (operation) { + + /* LOCK_SH - get a shared lock */ + case LOCK_SH: + /* LOCK_EX - get an exclusive lock */ + case LOCK_EX: + i = lockf (fd, F_LOCK, 0); + break; + + /* LOCK_SH|LOCK_NB - get a non-blocking shared lock */ + case LOCK_SH|LOCK_NB: + /* LOCK_EX|LOCK_NB - get a non-blocking exclusive lock */ + case LOCK_EX|LOCK_NB: + i = lockf (fd, F_TLOCK, 0); + if (i == -1) + if ((errno == EAGAIN) || (errno == EACCES)) + errno = EWOULDBLOCK; + break; + + /* LOCK_UN - unlock */ + case LOCK_UN: + i = lockf (fd, F_ULOCK, 0); + break; + + /* Default - can't decipher operation */ + default: + i = -1; + errno = EINVAL; + break; + } + return (i); +} +#endif diff --git a/proto.h b/proto.h index 8002cd1..14d8567 100644 --- a/proto.h +++ b/proto.h @@ -48,7 +48,9 @@ void cv_undef _((CV* cv)); #ifdef DEBUGGING void cx_dump _((CONTEXT* cs)); #endif -void cryptswitch_add _((cryptswitch_t funcp)); +SV * filter_add _((filter_t funcp, SV *datasv)); +void filter_del _((filter_t funcp)); +I32 filter_read _((int idx, SV *buffer, int maxlen)); I32 cxinc _((void)); void deb _((char* pat,...)) __attribute__((format(printf,1,2))); void deb_growlevel _((void)); @@ -448,7 +450,9 @@ void sv_usepvn _((SV* sv, char* ptr, STRLEN len)); void taint_env _((void)); void taint_not _((char *s)); void taint_proper _((char* f, char* s)); +#ifdef UNLINK_ALL_VERSIONS I32 unlnk _((char* f)); +#endif void utilize _((int aver, OP* id, OP* arg)); I32 wait4pid _((int pid, int* statusp, int flags)); void warn _((char* pat,...)) __attribute__((format(printf,1,2))); diff --git a/sv.c b/sv.c index 4a7a02d..f97c564 100644 --- a/sv.c +++ b/sv.c @@ -1045,7 +1045,9 @@ register SV *sv; not_a_number(sv); return (IV)atol(SvPVX(sv)); } - return 0; + if (!SvROK(sv)) { + return 0; + } } if (SvTHINKFIRST(sv)) { if (SvROK(sv)) { @@ -1123,7 +1125,9 @@ register SV *sv; } if (SvIOKp(sv)) return (double)SvIVX(sv); - return 0; + if (!SvROK(sv)) { + return 0; + } } if (SvTHINKFIRST(sv)) { if (SvROK(sv)) { @@ -1202,8 +1206,10 @@ STRLEN *lp; Gconvert(SvNVX(sv), DBL_DIG, 0, tokenbuf); goto tokensave; } - *lp = 0; - return ""; + if (!SvROK(sv)) { + *lp = 0; + return ""; + } } if (SvTHINKFIRST(sv)) { if (SvROK(sv)) { @@ -2362,7 +2368,7 @@ register FILE *fp; I32 append; { register char *bp; /* we're going to steal some values */ -#ifdef USE_STD_STDIO +#ifdef USE_STDIO_PTR register I32 cnt; /* from the stdio struct and put EVERYTHING */ register STDCHAR *ptr; /* in the innermost loop into registers */ STRLEN bpx; @@ -2392,8 +2398,8 @@ I32 append; } } while (i != EOF); } -#ifdef USE_STD_STDIO /* Here is some breathtakingly efficient cheating */ - cnt = fp->_cnt; /* get count into register */ +#ifdef USE_STDIO_PTR /* Here is some breathtakingly efficient cheating */ + cnt = FILE_cnt(fp); /* get count into register */ (void)SvPOK_only(sv); /* validate pointer */ if (SvLEN(sv) - append <= cnt + 1) { /* make sure we have the room */ if (cnt > 80 && SvLEN(sv) > append) { @@ -2408,7 +2414,7 @@ I32 append; else shortbuffered = 0; bp = SvPVX(sv) + append; /* move these two too to registers */ - ptr = fp->_ptr; + ptr = FILE_ptr(fp); for (;;) { screamer: if (cnt > 0) { @@ -2428,11 +2434,11 @@ I32 append; continue; } - fp->_cnt = cnt; /* deregisterize cnt and ptr */ - fp->_ptr = ptr; + FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */ + FILE_ptr(fp) = ptr; i = _filbuf(fp); /* get more characters */ - cnt = fp->_cnt; - ptr = fp->_ptr; /* reregisterize cnt and ptr */ + cnt = FILE_cnt(fp); + ptr = FILE_ptr(fp); /* reregisterize cnt and ptr */ if (i == EOF) /* all done for ever? */ goto thats_really_all_folks; @@ -2455,12 +2461,12 @@ thats_all_folks: thats_really_all_folks: if (shortbuffered) cnt += shortbuffered; - fp->_cnt = cnt; /* put these back or we're in trouble */ - fp->_ptr = ptr; + FILE_cnt(fp) = cnt; /* put these back or we're in trouble */ + FILE_ptr(fp) = ptr; *bp = '\0'; SvCUR_set(sv, bp - SvPVX(sv)); /* set length */ -#else /* !USE_STD_STDIO */ /* The big, slow, and stupid way */ +#else /* !USE_STDIO_PTR */ /* The big, slow, and stupid way */ { char buf[8192]; @@ -2493,7 +2499,7 @@ screamer: } } -#endif /* USE_STD_STDIO */ +#endif /* USE_STDIO_PTR */ if (rspara) { while (i != EOF) { diff --git a/t/comp/cpp.aux b/t/comp/cpp.aux new file mode 100644 index 0000000..bb93d21 --- /dev/null +++ b/t/comp/cpp.aux @@ -0,0 +1,39 @@ +#!./perl -P + +# $RCSfile: cpp.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:18 $ + +print "1..3\n"; + +#this is a comment +#define MESS "ok 1\n" +print MESS; + +#If you capitalize, it's a comment. +#ifdef MESS + print "ok 2\n"; +#else + print "not ok 2\n"; +#endif + +open(TRY,">Comp.cpp.tmp") || die "Can't open temp perl file."; + +($prog = <<'END') =~ s/X//g; +X$ok = "not ok 3\n"; +X#include "Comp.cpp.inc" +X#ifdef OK +X$ok = OK; +X#endif +Xprint $ok; +END +print TRY $prog; +close TRY; + +open(TRY,">Comp.cpp.inc") || (die "Can't open temp include file."); +print TRY '#define OK "ok 3\n"' . "\n"; +close TRY; + +$pwd=`pwd`; +$pwd =~ s/\n//; +$x = `./perl -P Comp.cpp.tmp`; +print $x; +unlink "Comp.cpp.tmp", "Comp.cpp.inc"; diff --git a/t/comp/cpp.t b/t/comp/cpp.t index 942f77f..880aed8 100755 --- a/t/comp/cpp.t +++ b/t/comp/cpp.t @@ -1,51 +1,17 @@ -#!./perl -P +#!./perl # $RCSfile: cpp.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:18 $ -open(CONFIG,"../config.sh") || die; -while () { - if (/^cppstdin/) { - if (/^cppstdin='(.*cppstdin)'/ && ! -e $1) { - print "1..0\n"; - exit; # Cannot test till after install, alas. - } - last; - } +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; } -close CONFIG; -print "1..3\n"; - -#this is a comment -#define MESS "ok 1\n" -print MESS; - -#If you capitalize, it's a comment. -#ifdef MESS - print "ok 2\n"; -#else - print "not ok 2\n"; -#endif - -open(TRY,">Comp.cpp.tmp") || die "Can't open temp perl file."; - -($prog = <<'END') =~ s/X//g; -X$ok = "not ok 3\n"; -X#include "Comp.cpp.inc" -X#ifdef OK -X$ok = OK; -X#endif -Xprint $ok; -END -print TRY $prog; -close TRY; - -open(TRY,">Comp.cpp.inc") || (die "Can't open temp include file."); -print TRY '#define OK "ok 3\n"' . "\n"; -close TRY; +use Config; +if ( ($Config{'cppstdin'} =~ /\bcppstdin\b/) and + ( ! -x $Config{'scriptdir'} . "/cppstdin") ) { + print "1..0\n"; + exit; # Cannot test till after install, alas. +} -$pwd=`pwd`; -$pwd =~ s/\n//; -$x = `./perl -P Comp.cpp.tmp`; -print $x; -unlink "Comp.cpp.tmp", "Comp.cpp.inc"; +system "./perl -P comp/cpp.aux" diff --git a/t/op/misc.t b/t/op/misc.t index decba2d..8fdd11a 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -46,9 +46,6 @@ BEGIN "foo"; } ######## --P -use POSIX; -######## $array[128]=1 ######## $x=0x0eabcd; print $x->ref; diff --git a/toke.c b/toke.c index 783974e..9b9db64 100644 --- a/toke.c +++ b/toke.c @@ -43,6 +43,7 @@ static I32 sublex_start _((void)); #ifdef CRIPPLED_CC static int uni _((I32 f, char *s)); #endif +static char * filter_gets _((SV *sv, FILE *fp)); /* The following are arranged oddly so that the guard on the switch statement * can get by with a single comparison (if the compiler is smart enough). @@ -329,7 +330,7 @@ register char *s; } if (s < bufend || !rsfp || lex_state != LEX_NORMAL) return s; - if ((s = sv_gets(linestr, rsfp, 0)) == Nullch) { + if ((s = filter_gets(linestr, rsfp)) == Nullch) { if (minus_n || minus_p) { sv_setpv(linestr,minus_p ? ";}continue{print" : ""); sv_catpv(linestr,";}"); @@ -982,15 +983,132 @@ incl_perldb() } -/* Encrypted script support: cryptswitch_add() may be called to */ -/* define a function which may manipulate the input stream */ -/* (via popen() etc) to decode the input if required. */ -/* At the moment we only allow one cryptswitch function. */ +/* Encoded script support. filter_add() effectively inserts a + * 'pre-processing' function into the current source input stream. + * Note that the filter function only applies to the current source file + * (e.g., it will not affect files 'require'd or 'use'd by this one). + * + * The datasv parameter (which may be NULL) can be used to pass + * private data to this instance of the filter. The filter function + * can recover the SV using the FILTER_DATA macro and use it to + * store private buffers and state information. + * + * The supplied datasv parameter is upgraded to a PVIO type + * and the IoDIRP field is used to store the function pointer. + * Note that IoTOP_NAME, IoFMT_NAME, IoBOTTOM_NAME, if set for + * private use must be set using malloc'd pointers. + */ +static int filter_debug = 0; + +SV * +filter_add(funcp, datasv) + filter_t funcp; + SV *datasv; +{ + if (!funcp){ /* temporary handy debugging hack to be deleted */ + filter_debug = atoi((char*)datasv); + return NULL; + } + if (!rsfp_filters) + rsfp_filters = newAV(); + if (!datasv) + datasv = newSV(0); + if (!SvUPGRADE(datasv, SVt_PVIO)) + die("Can't upgrade filter_add data to SVt_PVIO"); + IoDIRP(datasv) = (DIR*)funcp; /* stash funcp into spare field */ + if (filter_debug) + warn("filter_add func %lx (%s)", funcp, SvPV(datasv,na)); + av_push(rsfp_filters, datasv); + return(datasv); +} + + +/* Delete most recently added instance of this filter function. */ void -cryptswitch_add(funcp) - cryptswitch_t funcp; +filter_del(funcp) + filter_t funcp; +{ + if (filter_debug) + warn("filter_del func %lx", funcp); + if (!rsfp_filters || AvFILL(rsfp_filters)<0) + return; + /* if filter is on top of stack (usual case) just pop it off */ + if (IoDIRP(FILTER_DATA(AvFILL(rsfp_filters))) == (void*)funcp){ + sv_free(av_pop(rsfp_filters)); + return; + } + /* we need to search for the correct entry and clear it */ + die("filter_del can only delete in reverse order (currently)"); +} + + +/* Invoke the n'th filter function for the current rsfp. */ +I32 +filter_read(idx, buf_sv, maxlen) + int idx; + SV *buf_sv; + int maxlen; /* 0 = read one text line */ { - cryptswitch_fp = funcp; + filter_t funcp; + SV *datasv = NULL; + if (!rsfp_filters) + return -1; + if (idx > AvFILL(rsfp_filters)){ /* Any more filters? */ + /* Provide a default input filter to make life easy. */ + /* Note that we append to the line. This is handy. */ + /* We ignore maxlen here */ + if (filter_debug) + warn("filter_read %d: from rsfp\n", idx); + if (maxlen) { + /* Want a block */ + int len ; + int old_len = SvCUR(buf_sv) ; + + /* ensure buf_sv is large enough */ + SvGROW(buf_sv, old_len + maxlen) ; + if ((len = fread(SvPVX(buf_sv) + old_len, 1, maxlen, rsfp)) <= 0) + return len ; + SvCUR_set(buf_sv, old_len + len) ; + } else { + /* Want a line */ + if (sv_gets(buf_sv, rsfp, (SvCUR(buf_sv)>0) ? 1 : 0) == NULL) + return -1; /* end of file */ + } + return SvCUR(buf_sv); + } + /* Skip this filter slot if filter has been deleted */ + if ( (datasv = FILTER_DATA(idx)) == &sv_undef){ + if (filter_debug) + warn("filter_read %d: skipped (filter deleted)\n", idx); + return FILTER_READ(idx+1, buf_sv, maxlen); /* recurse */ + } + /* Get function pointer hidden within datasv */ + funcp = (filter_t)IoDIRP(datasv); + if (filter_debug) + warn("filter_read %d: via function %lx (%s)\n", + idx, funcp, SvPV(datasv,na)); + /* Call function. The function is expected to */ + /* call "FILTER_READ(idx+1, buf_sv)" first. */ + /* Return: <0:error/eof, >=0:not eof (see yylex()) */ + return (*funcp)(idx, buf_sv, maxlen); +} + +static char * +filter_gets(sv,fp) +register SV *sv; +register FILE *fp; +{ + if (rsfp_filters) { + + SvCUR_set(sv, 0); /* start with empty line */ + if (FILTER_READ(0, sv, 0) > 0) + return ( SvPVX(sv) ) ; + else + return Nullch ; + } + else + return (sv_gets(sv, fp, 0)) ; + } @@ -1236,16 +1354,8 @@ yylex() } goto retry; } - /* Give cryptswitch a chance. Note that cryptswitch_fp may */ - /* be either be called once if it redirects rsfp and unregisters */ - /* itself, or it may be called on every line if it loads linestr. */ - if (cryptswitch_fp && (*cryptswitch_fp)()) { - oldoldbufptr = oldbufptr = s = SvPVX(linestr); - bufend = SvPVX(linestr) + SvCUR(linestr); - goto retry; - } do { - if ((s = sv_gets(linestr, rsfp, 0)) == Nullch) { + if ((s = filter_gets(linestr, rsfp)) == Nullch) { fake_eof: if (rsfp) { if (preprocess && !in_eval) @@ -1560,6 +1670,9 @@ yylex() OPERATOR(tmp); case ')': tmp = *s++; + s = skipspace(s); + if (*s == '{') + PREBLOCK(tmp); TERM(tmp); case ']': s++; @@ -4246,7 +4359,7 @@ register char *s; sv_setpvn(tmpstr,"",0); /* avoid "uninitialized" warning */ while (s >= bufend) { /* multiple line string? */ if (!rsfp || - !(oldoldbufptr = oldbufptr = s = sv_gets(linestr, rsfp, 0))) { + !(oldoldbufptr = oldbufptr = s = filter_gets(linestr, rsfp))) { curcop->cop_line = multi_start; missingterm(tokenbuf); } @@ -4405,7 +4518,7 @@ char *start; if (s < bufend) break; /* string ends on this line? */ if (!rsfp || - !(oldoldbufptr = oldbufptr = s = sv_gets(linestr, rsfp, 0))) { + !(oldoldbufptr = oldbufptr = s = filter_gets(linestr, rsfp))) { curcop->cop_line = multi_start; return Nullch; } @@ -4583,7 +4696,7 @@ register char *s; } s = eol; if (rsfp) { - s = sv_gets(linestr, rsfp, 0); + s = filter_gets(linestr, rsfp); oldoldbufptr = oldbufptr = bufptr = SvPVX(linestr); bufend = bufptr + SvCUR(linestr); if (!s) { diff --git a/unixish.h b/unixish.h index fe81018..aa4ddbf 100644 --- a/unixish.h +++ b/unixish.h @@ -33,6 +33,20 @@ #define HAS_KILL #define HAS_WAIT + +/* UNLINK_ALL_VERSIONS: + * This symbol, if defined, indicates that the program should arrange + * to remove all versions of a file if unlink() is called. This is + * probably only relevant for VMS. + */ +/* #define UNLINK_ALL_VERSIONS /**/ + +/* VMS: + * This symbol, if defined, indicates that the program is running under + * VMS. It is currently automatically set by cpps running under VMS, + * and is included here for completeness only. + */ +/* #define VMS /**/ #if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) # include diff --git a/util.c b/util.c index 9b3dd87..160a391 100644 --- a/util.c +++ b/util.c @@ -1031,7 +1031,7 @@ char *nam; } #endif /* !VMS */ -#ifdef EUNICE +#ifdef UNLINK_ALL_VERSIONS I32 unlnk(f) /* unlink all versions of a file */ char *f; diff --git a/vms/config.vms b/vms/config.vms index 001ce21..60de301 100644 --- a/vms/config.vms +++ b/vms/config.vms @@ -10,7 +10,7 @@ * config.h for VMS */ -/* Configuration time: 12-Oct-1994 17:00 +/* Configuration time: 18-Apr-1995 17:00 * Configured by: Charles Bailey bailey@genetics.upenn.edu * Target system: VMS */ @@ -460,7 +460,7 @@ * but not always right so it should be emitted by the program only * when HAS_SHMAT_PROTOTYPE is not defined to avoid conflicting defs. */ -#undef Shmat_t char * /**/ /* config-skip */ +#undef Shmat_t /**/ /* config-skip */ #undef HAS_SHMAT_PROTOTYPE /**/ /* USE_STAT_BLOCKS: @@ -469,11 +469,51 @@ */ #undef USE_STAT_BLOCKS /**/ -/* USE_STD_STDIO: - * This symbol is defined if this system has a FILE structure declaring - * _ptr and _cnt in stdio.h. +/* USE_STDIO_PTR: + * This symbol is defined if the _ptr and _cnt fields (or similar) + * of the stdio FILE structure can be used to access the stdio buffer + * for a file handle. If this is defined, then the FILE_ptr(fp) + * and FILE_cnt(fp) macros will also be defined and should be used + * to access these fields. + */ +/* USE_STDIO_BASE: + * This symbol is defined if the _base field (or similar) of the + * stdio FILE structure can be used to access the stdio buffer for + * a file handle. If this is defined, then the FILE_base(fp) macro + * will also be defined and should be used to access this field. + * Also, the FILE_bufsiz(fp) macro will be defined and should be used + * to determine the number of bytes in the buffer. USE_STDIO_BASE + * will never be defined unless USE_STDIO_PTR is. + */ +#undef USE_STDIO_PTR /**/ +#undef USE_STDIO_BASE /**/ + +/* FILE_ptr: + * This macro is used to access the _ptr field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +/* FILE_cnt: + * This macro is used to access the _cnt field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_PTR is defined. + */ +#ifdef USE_STDIO_PTR +#endif + +/* FILE_base: + * This macro is used to access the _base field (or equivalent) of the + * FILE structure pointed to by its argument. This macro will always be + * defined if USE_STDIO_BASE is defined. + */ +/* FILE_bufsiz: + * This macro is used to determine the number of bytes in the I/O + * buffer pointed to by _base field (or equivalent) of the FILE + * structure pointed to its argument. This macro will always be defined + * if USE_STDIO_BASE is defined. */ -#undef USE_STD_STDIO /**/ +#ifdef USE_STDIO_BASE +#endif /* USE_STRUCT_COPY: * This symbol, if defined, indicates that this C compiler knows how @@ -892,20 +932,15 @@ #define M_VOID /* Xenix strikes again */ /* config-skip */ #endif - -/* EUNICE: - * This symbol, if defined, indicates that the program is being compiled - * under the EUNICE package under VMS. The program will need to handle - * things like files that don't go away the first time you unlink them, - * due to version numbering. It will also need to compensate for lack - * of a respectable link() command. +/* UNLINK_ALL_VERSIONS: + * This symbol, if defined, indicates that the program should arrange + * to remove all versions of a file if unlink() is called. */ +#undef UNLINK_ALL_VERSIONS /**/ + /* VMS: * This symbol, if defined, indicates that the program is running under - * VMS. It is currently only set in conjunction with the EUNICE symbol. - */ -#define EUNICE /**/ -/* This symbol is automagically defined by all VMS C compilers I've seen. + * VMS. It's symbol automagically defined by all VMS C compilers I've seen. * Just in case, however . . . */ #ifndef VMS #define VMS /**/ diff --git a/vms/ext/MM_VMS.pm b/vms/ext/MM_VMS.pm index f861d83..801f2f8 100644 --- a/vms/ext/MM_VMS.pm +++ b/vms/ext/MM_VMS.pm @@ -83,7 +83,7 @@ FULLPERL = $att{FULLPERL} # FULLEXT = Pathname for extension directory (eg DBD/Oracle). # BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. # ROOTEXT = Directory part of FULLEXT with leading slash (e.g /DBD) -FULLEXT = ",vmsify($att{FULLEXT})," +FULLEXT = ",vmspath($att{FULLEXT})," BASEEXT = $att{BASEEXT} ROOTEXT = ",($att{ROOTEXT} eq '') ? '[]' : vmspath($att{ROOTEXT})," diff --git a/vms/ext/VMS/stdio/stdio.xs b/vms/ext/VMS/stdio/stdio.xs index 367f489..958c040 100644 --- a/vms/ext/VMS/stdio/stdio.xs +++ b/vms/ext/VMS/stdio/stdio.xs @@ -20,7 +20,7 @@ /* Use type for FILE * from Perl's XSUB typemap. This is a bit * of a hack, since all Perl filehandles using this type will permit - * both read & write operations, but it saves to write the PPCODE + * both read & write operations, but it saves having to write the PPCODE * directly for updating the Perl filehandles. */ typedef FILE * InOutStream; @@ -46,6 +46,7 @@ vmsfopen(name,...) if (*(name+1) == '>') *mode = 'a', name += 2; else *mode = 'w', name++; } + else if (*name == '<') name++; myargc = items - 1; for (i = 0; i < myargc; i++) args[i] = SvPV(ST(i+1),na); /* This hack brought to you by C's opaque arglist management */ diff --git a/vms/perlvms.pod b/vms/perlvms.pod index e7f811e..c0cec10e 100644 --- a/vms/perlvms.pod +++ b/vms/perlvms.pod @@ -271,7 +271,7 @@ Perl functions were implemented in the VMS port of Perl setpwent, shift, sin, sleep, sort, splice, split, sprintf, sqrt, srand, stat, study, substr, sysread, system*, syswrite, tell, telldir, tie, time, times*, - tr///, uc, ucfirst, umask, undef, unlink, unpack, + tr///, uc, ucfirst, umask, undef, unlink*, unpack, untie, unshift, use, utime*, values, vec, wait, waitpid*, wantarray, warn, write, y/// @@ -414,6 +414,37 @@ subprocesses spawned using L and L; it will not accumulate the times of suprocesses spawned via pipes, L, or backticks. +=item unlink LIST + +C will delete the highest version of a file only; in +order to delete all versions, you need to say + 1 while (unlink LIST); +You may need to make this change to scripts written for a +Unix system which expect that after a call to C, +no files with the names passed to C will exist. +(Note: This can be changed at compile time by including +C<#define UNLINK_ALL_VERSIONS> in config.h. + +C will delete a file if at all possible, even if it +requires changing file protection (though it won't try to +change the protection of the parent directory). You can tell +whether you've got explicit delete access to a file by using the +C operator. For instance, in order +to delete only files to which you have delete access, you could +say something like + sub safe_unlink { + my($file,$num); + foreach $file (@_) { + next unless VMS::Filespec::candelete($file); + $num += unlink $file; + } + $num; + } +Finally, if C has to change the file protection to +delete the file, and you interrupt it in midstream, the file +may be left intact, but with a changed ACL allowing you delete +access. + =item utime LIST Since ODS-2, the VMS file structure for disk files, does not keep diff --git a/vms/vms.c b/vms/vms.c index ae4f608..fd4ec3a 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -1100,7 +1100,7 @@ static char *do_tovmsspec(char *path, char *buf, int ts) { if (path == NULL) return NULL; if (buf) rslt = buf; - else if (ts) New(7016,rslt,strlen(path)+1,char); + else if (ts) New(7016,rslt,strlen(path)+3,char); else rslt = __tovmsspec_retbuf; if (strpbrk(path,"]:>") || (dirend = strrchr(path,'/')) == NULL) { diff --git a/x2p/Makefile.SH b/x2p/Makefile.SH index 725d92e..bb26d4e 100755 --- a/x2p/Makefile.SH +++ b/x2p/Makefile.SH @@ -26,8 +26,6 @@ cat >Makefile <_cnt; /* get count into register */ + cnt = FILE_cnt(fp); /* get count into register */ str->str_nok = 0; /* invalidate number */ str->str_pok = 1; /* validate pointer */ if (str->str_len <= cnt) /* make sure we have the room */ GROWSTR(&(str->str_ptr), &(str->str_len), cnt+1); bp = str->str_ptr; /* move these two too to registers */ - ptr = fp->_ptr; + ptr = FILE_ptr(fp); for (;;) { while (--cnt >= 0) { if ((*bp++ = *ptr++) == newline) @@ -314,11 +314,11 @@ register FILE *fp; } } - fp->_cnt = cnt; /* deregisterize cnt and ptr */ - fp->_ptr = ptr; + FILE_cnt(fp) = cnt; /* deregisterize cnt and ptr */ + FILE_ptr(fp) = ptr; i = _filbuf(fp); /* get more characters */ - cnt = fp->_cnt; - ptr = fp->_ptr; /* reregisterize cnt and ptr */ + cnt = FILE_cnt(fp); + ptr = FILE_ptr(fp); /* reregisterize cnt and ptr */ bpx = bp - str->str_ptr; /* prepare for possible relocation */ GROWSTR(&(str->str_ptr), &(str->str_len), str->str_cur + cnt + 1); @@ -334,12 +334,12 @@ register FILE *fp; } thats_all_folks: - fp->_cnt = cnt; /* put these back or we're in trouble */ - fp->_ptr = ptr; + FILE_cnt(fp) = cnt; /* put these back or we're in trouble */ + FILE_ptr(fp) = ptr; *bp = '\0'; str->str_cur = bp - str->str_ptr; /* set length */ -#else /* !USE_STD_STDIO */ /* The big, slow, and stupid way */ +#else /* !USE_STDIO_PTR */ /* The big, slow, and stupid way */ static char buf[4192]; @@ -348,7 +348,7 @@ thats_all_folks: else str_set(str, No); -#endif /* USE_STD_STDIO */ +#endif /* USE_STDIO_PTR */ return str->str_cur ? str->str_ptr : Nullch; } diff --git a/xf b/xf deleted file mode 100755 index dc9d273..0000000 --- a/xf +++ /dev/null @@ -1,244 +0,0 @@ -#!/usr/bin/perl -i.bak - -while (<>) { - study; - s/\bSTR\b/SV/g && study; - s/\bARRAY\b/AV/g && study; - s/\bARG\b/OP/g && study; - s/\bHASH\b/HV/g && study; - s/\bHENT\b/HE/g && study; - s/\bCMD\b/COP/g && study; - s/\bSPAT\b/PM/g && study; - s/\bSTIO\b/IO/g && study; - s/\bSTAB\b/GV/g && study; - s/\bSTBP\b/GP/g && study; - s/\bSUBR\b/CV/g && study; - - s/\bNullstr\b/Nullsv/g && study; - s/\bNullarg\b/Nullop/g && study; - s/\bNullcmd\b/Nullcop/g && study; - s/\bNullstab\b/Nullgv/g && study; - - s/\bstruct stab\b/struct gv/g && study; - s/\bstruct stabptrs\b/struct gp/g && study; - s/\bstruct stio\b/struct io/g && study; - s/\bstruct string\b/struct sv/g && study; - s/\bstruct scanpat\b/struct pm/g && study; - s/\bstruct formcmd\b/struct ff/g && study; - s/\bstruct hentry\b/struct he/g && study; - s/\bstruct atbl\b/struct av/g && study; - s/\bstruct htbl\b/struct hv/g && study; - s/\bstruct cmd\b/struct cop/g && study; - - s/\bcmdname\b/cop_name/g && study; - s/\bopname\b/op_name/g && study; - - s/\bstab_stab\b/GvGV/g && study; - s/\bstab_estab\b/GvEGV/g && study; - s/\bstab_stash\b/GvSTASH/g && study; - s/\bstab_estash\b/GvESTASH/g && study; - s/\bstab_name\b/GvNAME/g && study; - s/\bstab_ename\b/GvENAME/g && study; - s/\bstab_hash\b/GvHVn/g && study; - s/\bstab_xhash\b/GvHV/g && study; - s/\bstab_array\b/GvAVn/g && study; - s/\bstab_xarray\b/GvAV/g && study; - s/\bstab_sub\b/GvCV/g && study; - s/\bstab_form\b/GvFORM/g && study; - s/\bstab_magic\b/GvMAGIC/g && study; - s/\bstab_val\b/GvSV/g && study; - s/\bstab_xio\b/GvIO/g && study; - s/\bstab_io\b/GvIOn/g && study; - s/\bstab_lastexpr\b/GvLASTEXPR/g && study; - s/\bstab_line\b/GvLINE/g && study; - s/\bstab_flags\b/GvFLAGS/g && study; - - s/\bstbp_val\b/gp_sv/g && study; - s/\bstbp_array\b/gp_av/g && study; - s/\bstbp_hash\b/gp_hv/g && study; - s/\bstbp_stab\b/gp_egv/g && study; - - s/\bstr_array\b/sv_av/g && study; - s/\bstr_hash\b/sv_hv/g && study; - s/\bstr_cmd\b/sv_cop/g && study; - s/\bstr_args\b/sv_op/g && study; - s/\bstr_nval\b/sv_nv/g && study; - s/\bstr_pval\b/sv_pv/g && study; - - s/\bSTABSET\b/SvSETMAGIC/g && study; - s/\bstabset\b/sv_setmagic/g && study; - s/\bSTR_SSET\b/sv_setsv/g && study; - s/\bSTR_GROW\b/SvGROW/g && study; - - s/\bstr_true\b/SvTRUE/g && study; - s/\bstr_peek\b/SvPEEK/g && study; - s/\bstr_get\b/SvPV/g && study; - s/\bstr_gnum\b/SvNV/g && study; - - s/\bstab\b/gv/g && study; - s/\bstr\b/sv/g && study; - s/\bStr\b/Sv/g && study; - - s/\baadd\b/gv_AVn/g && study; - - s/\baclear\b/av_clear/g && study; - s/\bafake\b/av_fake/g && study; - s/\bafetch\b/av_fetch/g && study; - s/\bafill\b/av_fill/g && study; - s/\bafree\b/av_free/g && study; - s/\balen\b/av_len/g && study; - s/\banew\b/newAV/g && study; - s/\bapop\b/av_pop/g && study; - s/\bapush\b/av_push/g && study; - s/\barg_free\b/op_free/g && study; - s/\bashift\b/av_shift/g && study; - s/\bastore\b/av_store/g && study; - s/\baunshift\b/av_unshift/g && study; - s/\bcastulong\b/cast_ulong/g && study; - s/\bcmd_free\b/op_free/g && study; - s/\bcurcmd\b/curcop/g && study; - s/\bdump_arg\b/dump_op/g && study; - s/\bdump_cmd\b/dump_op/g && study; - s/\bdump_spat\b/dump_pm/g && study; - s/\bdump_stab\b/dump_gv/g && study; - s/\bdumpfds\b/dump_fds/g && study; - s/\bfbmcompile\b/fbm_compile/g && study; - s/\bfbminstr\b/fbm_instr/g && study; - s/\bfstab\b/newGVfile/g && study; - s/\bgenstab\b/newGVgen/g && study; - s/\bgrow_dlevel\b/deb_growlevel/g && study; - s/\bhadd\b/gv_HVn/g && study; - s/\bhclear\b/hv_clear/g && study; - s/\bhdelete\b/hv_delete/g && study; - s/\bhentdelayfree\b/he_delayfree/g && study; - s/\bhentfree\b/he_free/g && study; - s/\bhfetch\b/hv_fetch/g && study; - s/\bhfree\b/hv_free/g && study; - s/\bhiterinit\b/hv_iterinit/g && study; - s/\bhiterkey\b/hv_iterkey/g && study; - s/\bhiternext\b/hv_iternext/g && study; - s/\bhiterval\b/hv_iterval/g && study; - s/\bhnew\b/newHV/g && study; - s/\bhstore\b/hv_store/g && study; - s/\blistish\b/forcelist/g && study; - s/\bmaybelistish\b/maybeforcelist/g && study; - s/\bmylstat\b/my_lstat/g && study; - s/\bmypclose\b/my_pclose/g && study; - s/\bmypfiopen\b/my_pfiopen/g && study; - s/\bmypopen\b/my_popen/g && study; - s/\bmystat\b/my_stat/g && study; - s/\bop_new\b/newOP/g && study; - s/\bperl_alloc\b/perl_alloc/g && study; - s/\bperl_callback\b/perl_callpv/g && study; - s/\bperl_callv\b/perl_callargv/g && study; - s/\bperl_construct\b/perl_construct/g && study; - s/\bperl_destruct\b/perl_destruct/g && study; - s/\bperl_free\b/perl_free/g && study; - s/\bperl_parse\b/perl_parse/g && study; - s/\bperl_run\b/perl_run/g && study; - s/\bregcomp\b/regcomp/g && study; - s/\bregdump\b/regdump/g && study; - s/\bregexec\b/regexec/g && study; - s/\bregfree\b/regfree/g && study; - s/\bregnext\b/regnext/g && study; - s/\bregprop\b/regprop/g && study; - s/\brepeatcpy\b/repeatcpy/g && study; - s/\brestorelist\b/leave_scope/g && study; - s/\bsaveaptr\b/save_aptr/g && study; - s/\bsaveary\b/save_ary/g && study; - s/\bsavehash\b/save_hash/g && study; - s/\bsavehptr\b/save_hptr/g && study; - s/\bsaveint\b/save_int/g && study; - s/\bsaveitem\b/save_item/g && study; - s/\bsavelines\b/save_lines/g && study; - s/\bsavelist\b/save_list/g && study; - s/\bsavelong\b/save_long/g && study; - s/\bsavenostab\b/save_nostab/g && study; - s/\bsavesptr\b/save_sptr/g && study; - s/\bscanconst\b/scan_const/g && study; - s/\bscanhex\b/scan_hex/g && study; - s/\bscanident\b/scan_ident/g && study; - s/\bscanoct\b/scan_oct/g && study; - s/\bscanpat\b/scan_pat/g && study; - s/\bscanstr\b/scan_str/g && study; - s/\bscansubst\b/scan_subst/g && study; - s/\bscantrans\b/scan_trans/g && study; - s/\bstab_check\b/gv_check/g && study; - s/\bstab_clear\b/gv_clear/g && study; - s/\bstab_efullname\b/gv_efullname/g && study; - s/\bstab_fullname\b/gv_fullname/g && study; - s/\bstab_len\b/gv_len/g && study; - s/\bstab_str\b/gv_str/g && study; - s/\bstabent\b/gv_fetchpv/g && study; - s/\bstio_new\b/newIO/g && study; - s/\bstr_2mortal\b/sv_2mortal/g && study; - s/\bstr_2num\b/sv_2num/g && study; - s/\bstr_2ptr\b/sv_2ptr/g && study; - s/\bstr_cat\b/sv_catpv/g && study; - s/\bstr_chop\b/sv_chop/g && study; - s/\bstr_cmp\b/sv_cmp/g && study; - s/\bstr_dec\b/sv_dec/g && study; - s/\bstr_eq\b/sv_eq/g && study; - s/\bstr_free\b/sv_free/g && study; - s/\bstr_gets\b/sv_gets/g && study; - s/\bstr_grow\b/sv_grow/g && study; - s/\bstr_inc\b/sv_inc/g && study; - s/\bstr_insert\b/sv_insert/g && study; - s/\bstr_len\b/sv_len/g && study; - s/\bstr_magic\b/sv_magic/g && study; - s/\bstr_make\b/newSVpv/g && study; - s/\bstr_mortal\b/sv_mortalcopy/g && study; - s/\bstr_ncat\b/sv_catpvn/g && study; - s/\bstr_new\b/newSV/g && study; - s/\bstr_nmake\b/newSVnv/g && study; - s/\bstr_nset\b/sv_setpvn/g && study; - s/\bstr_numset\b/sv_setnv/g && study; - s/\bstr_replace\b/sv_replace/g && study; - s/\bstr_reset\b/sv_reset/g && study; - s/\bstr_scat\b/sv_catsv/g && study; - s/\bstr_set\b/sv_setpv/g && study; - s/\bstr_smake\b/newSVsv/g && study; - s/\bstr_sset\b/sv_setsv/g && study; - s/\btaintenv\b/taint_env/g && study; - s/\btaintproper\b/taint_proper/g && study; - s/\barg\b/op/g && study; - s/\barg_ptr\.//g && study; - s/\barg_/op_/g && study; - - s/\bSTR_/SV_/g && study; - s/\bSP_/SVp_/g && study; - s/\bSS_/SVs_/g && study; - s/\bSTAB_/GV_/g && study; - s/\bSF_/GVf_/g && study; - s/\bSPAT_/PMf_/g && study; - #s/\bF_/FFt_/g && study; - s/\bFC_/FFf_/g && study; - s/\bO_/OP_/g && study; - s/\bC_/COP_/g && study; - s/\bCF_/COPf_/g && study; - s/\bCFT_/COPo_/g && study; - s/\bARF_/AVf_/g && study; - s/\bIOF_/IOf_/g && study; - s/\bStr_new\b/NEWSV/g && study; - - s/\bstbp_/gp_/g && study; - s/\bstab_/gv_/g && study; - s/\bspat_/pm_/g && study; - s/\bstio/io/g && study; - s/\bf_/ff_/g && study; - s/\bStr_/Sv_/g && study; - s/\bstr_/sv_/g && study; - s/\btbl_/hv_/g && study; - s/\bary_/av_/g && study; - s/acmd\.ac_/acop_/g && study; - s/ccmd\.cc_/ccop_/g && study; - s/scmd\.sc_/scop_/g && study; - s/\bac_/acop_/g; - s/\bcc_/ccop_/g; - s/\bsc_/scop_/g; - s/\bc_/cop_/g; - s/spat/pm/g; - s/stab/gv/g; - - print; -}