diff options
-rwxr-xr-x | Configure | 232 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | config_h.SH | 67 | ||||
-rw-r--r-- | ext/DB_File/Changes | 194 | ||||
-rw-r--r-- | ext/DB_File/DB_File.pm | 46 | ||||
-rw-r--r-- | ext/DB_File/DB_File.xs | 44 | ||||
-rw-r--r-- | hints/machten.sh | 10 | ||||
-rw-r--r-- | lib/ExtUtils/Install.pm | 59 | ||||
-rw-r--r-- | lib/Pod/Html.pm | 11 | ||||
-rw-r--r-- | lib/Pod/Text.pm | 4 | ||||
-rw-r--r-- | lib/perl5db.pl | 2 | ||||
-rw-r--r-- | malloc.c | 6 | ||||
-rw-r--r-- | pod/perldiag.pod | 24 | ||||
-rw-r--r-- | pod/perlpod.pod | 65 | ||||
-rw-r--r-- | pod/pod2man.PL | 3 | ||||
-rw-r--r-- | pp_sys.c | 24 | ||||
-rw-r--r-- | regcomp.c | 27 | ||||
-rw-r--r-- | regexec.c | 2 | ||||
-rw-r--r-- | scope.h | 8 | ||||
-rw-r--r-- | sv.c | 33 | ||||
-rwxr-xr-x | t/lib/db-recno.t | 94 | ||||
-rwxr-xr-x | t/lib/filecopy.t | 1 | ||||
-rwxr-xr-x | t/op/misc.t | 1 | ||||
-rwxr-xr-x | t/op/pat.t | 27 | ||||
-rw-r--r-- | t/op/re_tests | 12 | ||||
-rwxr-xr-x | t/pragma/locale.t | 10 |
26 files changed, 800 insertions, 207 deletions
@@ -317,13 +317,20 @@ d_Gconvert='' d_getgrps='' d_setgrps='' d_gethent='' -d_gethbadd='' -gethbadd_addr_type='' -gethbadd_alen_type='' -d_getnbadd='' -getnbadd_net_type='' +d_gethbyaddr='' +netdb_host_type='' +netdb_hlen_type='' +d_gethbyname='' +netdb_name_type='' +d_getnbyaddr='' +d_getnbyname='' +netdb_net_type='' aphostname='' d_gethname='' +d_getpbyname='' +d_getpbynumber='' +d_getsbyname='' +d_getsbyport='' d_phostname='' d_uname='' d_getlogin='' @@ -6624,7 +6631,11 @@ set fsetpos d_fsetpos eval $inlibc : see if gethostbyaddr exists -set gethostbyaddr d_gethbadd +set gethostbyaddr d_gethbyaddr +eval $inlibc + +: see if gethostbyname exists +set gethostbyname d_gethbyname eval $inlibc : see if gethostent exists @@ -6636,7 +6647,11 @@ set getlogin d_getlogin eval $inlibc : see if getnetbyaddr exists -set getnetbyaddr d_getnbadd +set getnetbyaddr d_getnbyaddr +eval $inlibc + +: see if getnetbyname exists +set getnetbyname d_getnbyname eval $inlibc : see if getpgid exists @@ -6655,6 +6670,22 @@ eval $inlibc set getpriority d_getprior eval $inlibc +: see if getprotobyname exists +set getprotobyname d_getpbyname +eval $inlibc + +: see if getprotobynumber exists +set getprotobynumber d_getpbynumber +eval $inlibc + +: see if getservbyname exists +set getservbyname d_getsbyname +eval $inlibc + +: see if getservbyport exists +set getservbyport d_getsbyport +eval $inlibc + : see if gettimeofday or ftime exists set gettimeofday d_gettimeod eval $inlibc @@ -9262,10 +9293,10 @@ eval $inhdr : check for type of arguments to gethostbyaddr. This will only really : work if the system supports prototypes and provides one for -: gethostbyaddr. -case "$d_gethbadd" in +: gethostbyaddr. The netdb_host_type and netdb_hlen_type get defined. +case "$d_gethbyaddr" in $define) - if test "X$gethbadd_addr_type" = X -o "X$gethbadd_alen_type" = X; then + if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then $cat <<EOM Checking to see what type of arguments are expected by gethostbyaddr(). @@ -9292,72 +9323,130 @@ EOM #define Size_t $sizetype main() { - Gethbadd_addr_t addr; - Gethbadd_alen_t alen; + Netdb_alen_t alen = sizeof(struct in_addr); + Netdb_addr_t addr = (Netdb_addr_t)malloc(alen); struct hostent* hent; - extern struct hostent *gethostbyaddr(const Gethbadd_addr_t, Gethbadd_alen_t, int); + extern struct hostent *gethostbyaddr(Netdb_addr_t, Netdb_alen_t, int); - alen = sizeof(struct in_addr); - addr = (Gethbadd_addr_t)malloc(alen); - /* We do not execute this so the contents of the addr matter not. */ + /* We do not execute this so the arguments matter not. */ hent = gethostbyaddr(addr, alen, AF_INET); exit(0); } EOCP - for xxx in "void *" "char *"; do - for yyy in Size_t int; do - if $cc $ccflags -c -DGethbadd_addr_t="$xxx" -DGethbadd_alen_t="$yyy" try.c >/dev/null 2>&1 ; then - gethbadd_addr_type="$xxx" - gethbadd_alen_type="$yyy" + for xxx in in_addr_t "const void *" "const char *" "void *" "char *"; do + for yyy in Size_t long int; do + if $cc $ccflags -c -DNetdb_addr_t="$xxx" -DNetdb_alen_t="$yyy" try.c >/dev/null 2>&1 ; then + netdb_host_type="$xxx" + netdb_hlen_type="$yyy" $cat >&4 <<EOM -Your system uses $xxx for the 1st argument to gethostbyaddr. -and the 2nd argument to gethostbyaddr is $yyy. +Your system accepts $xxx for the 1st argument to gethostbyaddr. +and the 2nd argument to gethostbyaddr can be $yyy. EOM break fi done - test "X$gethbadd_addr_type" != X && break + test "X$netdb_host_type" != X && break done - if test "X$gethbadd_addr_type" = X; then + if test "X$netdb_host_type" = X; then rp='What is the type for the 1st argument to gethostbyaddr?' dflt="void *" . ./myread - gethbadd_addr_type="$ans" + netdb_host_type="$ans" # Remove the "const" if needed. - gethbadd_addr_type=`echo "$gethbadd_addr_type" | sed 's/^const //'` + netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'` rp='What is the type for the 2nd argument to gethostbyaddr ?' dflt="Size_t" . ./myread - gethbadd_alen_type="$ans" + netdb_hlen_type="$ans" fi $rm -f try.[co] else $cat >&4 <<EOM -Your system uses $gethbadd_addr_type for the 1st argument to gethostbyaddr. -and the 2nd argument to gethostbyaddr is $gethbadd_alen_type. +Your system accepts $netdb_host_type for the 1st argument to gethostbyaddr. +and the 2nd argument to gethostbyaddr can be $netdb_hlen_type. EOM fi ;; -*) gethbadd_addr_type='void *' - gethbadd_alen_type='Size_t' +*) netdb_host_type='void *' + netdb_hlen_type='Size_t' ;; esac +: check for type of arguments to gethostbyname. This will only really +: work if the system supports prototypes and provides one for +: gethostbyname. The netdb_name_type gets defined. +case "$d_gethbyname" in +$define) + if test "X$netdb_name_type" = X; then + $cat <<EOM + +Checking to see what type of arguments are expected by gethostbyname(). +EOM + $cat >try.c <<EOCP +#$i_niin I_NIIN +#$i_netdb I_NETDB +#$d_socket HAS_SOCKET +#$d_socket HAS_SOCKET +#include <sys/types.h> +#ifdef HAS_SOCKET +#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ +#endif +#ifdef I_NIIN +#include <netinet/in.h> +#endif +#ifdef I_NETDB +#include <netdb.h> +#endif +main() +{ + char* host = "localhost"; + struct hostent* hent; + + extern struct hostent *gethostbyname(Netdb_name_t); + + /* We do not execute this so the arguments matter not. */ + hent = gethostbyname(host); + + exit(0); +} +EOCP + for xxx in "const char *" "char *"; do + if $cc $ccflags -c -DNetdb_name_t="$xxx" try.c >/dev/null 2>&1 ; then + netdb_name_type="$xxx" + echo "Your system accepts $xxx for the 1st argument to gethostbyname." >&4 + break + fi + done + if test "X$netdb_name_type" = X; then + rp='What is the type for the 1st argument to gethostbyname?' + dflt="char *" + . ./myread + netdb_name_type="$ans" + fi + $rm -f try.[co] + else + echo "Your system accepts $netdb_name_type for the 1st argument to gethostbyname." >&4 + fi + ;; +*) netdb_name_type='char *' + ;; +esac + : check for type of arguments to getnetbyaddr. This will only really : work if the system supports prototypes and provides one for -: getnetbyaddr. -case "$d_getnbadd" in +: getnetbyaddr. The netdb_net_type gets defined. +case "$d_getnbyaddr" in $define) - if test "X$getnbadd_net_type" = X; then - $cat <<EOM + if test "X$netdb_net_type" = X; then + $cat <<EOM Checking to see what type of arguments are expected by getnetbyaddr(). EOM - $cat >try.c <<EOCP + $cat >try.c <<EOCP #$i_niin I_NIIN #$i_netdb I_NETDB #$d_socket HAS_SOCKET @@ -9374,37 +9463,37 @@ EOM #endif main() { - Getnbadd_net_t net; - struct netent* nent; + Netdb_net_t net; + struct netent* nent; - extern struct netent *getnetbyaddr(Getnbadd_net_t, int); + extern struct netent *getnetbyaddr(Netdb_net_t, int); - /* We do not execute this so the contents of the net matter not. */ - nent = getnetbyaddr(net, AF_INET); + /* We do not execute this so the arguments matter not. */ + nent = getnetbyaddr(net, 2); - exit(0); + exit(0); } EOCP - for xxx in in_addr_t long int; do - if $cc $ccflags -c -DGetnbadd_net_t="$xxx" try.c >/dev/null 2>&1 ; then - getnbadd_net_type="$xxx" - echo "Your system uses $xxx for the 1st argument to getnetbyaddr." >&4 - break - fi - done - if test "X$getnbadd_net_type" = X; then - rp='What is the type for the 1st argument to getnetbyaddr?' - dflt="long" - . ./myread - getnbadd_net_type="$ans" - fi - $rm -f try.[co] - else - echo "Your system uses $getnbadd_net_type for the 1st argument to getnetbyaddr." >&4 - fi - ;; -*) getnbadd_net_type='long' - ;; + for xxx in in_addr_t "unsigned long" long "unsigned int" int; do + if $cc $ccflags -c -DNetdb_net_t="$xxx" try.c >/dev/null 2>&1 ; then + netdb_net_type="$xxx" + echo "Your system accepts $xxx for the 1st argument to getnetbyaddr." >&4 + break + fi + done + if test "X$netdb_net_type" = X; then + rp='What is the type for the 1st argument to getnetbyaddr?' + dflt="long" + . ./myread + netdb_net_type="$ans" + fi + $rm -f try.[co] + else + echo "Your system accepts $netdb_net_type for the 1st argument to getnetbyaddr." >&4 + fi + ;; +*) netdb_net_type='long' + ;; esac : see what type of char stdio uses. @@ -10356,19 +10445,26 @@ d_fsetpos='$d_fsetpos' d_ftime='$d_ftime' d_getgrps='$d_getgrps' d_setgrps='$d_setgrps' -d_gethbadd='$d_gethbadd' -gethbadd_addr_type='$gethbadd_addr_type' -gethbadd_alen_type='$gethbadd_alen_type' +d_gethbyaddr='$d_gethbyaddr' +netdb_host_type='$netdb_host_type' +netdb_hlen_type='$netdb_hlen_type' +d_gethbynam='$d_gethbynam' +netdb_name_type='$netdb_name_type' d_gethent='$d_gethent' d_gethname='$d_gethname' d_getlogin='$d_getlogin' -d_getnbadd='$d_getnbadd' -getnbadd_net_type='$getnbadd_net_type' +d_getnbyaddr='$d_getnbyaddr' +d_getnbyname='$d_getnbyname' +netdb_net_type='$netdb_net_type' d_getpgid='$d_getpgid' d_getpgrp2='$d_getpgrp2' d_getpgrp='$d_getpgrp' d_getppid='$d_getppid' d_getprior='$d_getprior' +d_getpbyname='$d_getpbyname' +d_getpbynumber='$d_getpbynumber' +d_getsbyname='$d_getsbyname' +d_getsbyport='$d_getsbyport' d_gettimeod='$d_gettimeod' d_gnulibc='$d_gnulibc' d_htonl='$d_htonl' @@ -120,6 +120,7 @@ emacs/ptags Creates smart TAGS file embed.h Maps symbols to safer names embed.pl Produces embed.h embedvar.h C namespace management +ext/DB_File/Changes Berkeley DB extension change log ext/DB_File/DB_File.pm Berkeley DB extension Perl module ext/DB_File/DB_File.xs Berkeley DB extension external subroutines ext/DB_File/DB_File_BS Berkeley DB extension mkbootstrap fodder diff --git a/config_h.SH b/config_h.SH index 33009ab3c2..5ff88445ac 100644 --- a/config_h.SH +++ b/config_h.SH @@ -329,35 +329,80 @@ sed <<!GROK!THIS! >config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #$d_gethent HAS_GETHOSTENT /**/ -/* HAS_GETHBADD: +/* HAS_GETHOSTBYADDR: * This symbol, if defined, indicates that the gethostbyaddr routine is - * available to lookup host names by their IP addresses. + * available to lookup hosts by their IP addresses. */ -#$d_gethbadd HAS_GETHBADD /**/ +#$d_gethbyaddr HAS_GETHOSTBYADDR /**/ -/* Gethbadd_addr_t: +/* Netdb_host_t: * This symbol holds the type used for the 1st argument * to gethostbyaddr(). */ -#define Gethbadd_addr_t $gethbadd_addr_type +#define Netdb_host_t $netdb_host_type -/* Gethbadd_alen_t: +/* Netdb_hlen_t: * This symbol holds the type used for the 2nd argument * to gethostbyaddr(). */ -#define Gethbadd_alen_t $gethbadd_alen_type +#define Netdb_hlen_t $netdb_hlen_type -/* HAS_GETNBADD: +/* HAS_GETHOSTBYNAME: + * This symbol, if defined, indicates that the gethostbyname routine is + * available to lookup hosts by their DNS names. + */ +#$d_gethbyname HAS_GETHOSTBYNAME /**/ + +/* Netdb_name_t: + * This symbol holds the type used for the 1st argument + * to gethostbyname(), the 1st argument to getnetbyname(), + * the 1st argument to getprotobyname(), the 1st argument to + * getservbyname(), the 2nd argument to getservbyname(), + * and the 2nd argument to getservbyport(). + */ +#define Netdb_name_t $netdb_name_type + +/* HAS_GETNETBYADD: * This symbol, if defined, indicates that the getnetbyaddr routine is * available to lookup networks by their IP addresses. */ -#$d_getnbadd HAS_GETNBADD /**/ +#$d_getnbyaddr HAS_GETNETBYADD /**/ -/* Gethbadd_net_t: +/* Netdb_net_t: * This symbol holds the type used for the 1st argument * to getnetbyaddr(). */ -#define Getnbadd_net_t $getnbadd_net_type +#define Netdb_net_t $netdb_net_type + +/* HAS_GETNETBYNAME: + * This symbol, if defined, indicates that the getnetbyname routine is + * available to lookup networks by their names. + */ +#$d_getnbyname HAS_GETNETBYNAME /**/ + +/* HAS_GETPROTOBYNAME: + * This symbol, if defined, indicates that the getprotobyname routine is + * available to lookup protocols by their names. + */ +#$d_getpbyname HAS_GETPROTOBYNAME /**/ + +/* HAS_GETPROTOBYNUMBER: + * This symbol, if defined, indicates that the getprotobynumber routine is + * available to lookup protocols by their numbers. + */ +#$d_getpbynumber HAS_GETPROTOBYNUMBER /**/ + +/* HAS_GETSERVBYNAME: + * This symbol, if defined, indicates that the getservbyname routine is + * available to lookup services by their names. + */ +#$d_getsbyname HAS_GETSERVBYNAME /**/ + +/* HAS_GETSERVBYPORT: + * This symbol, if defined, indicates that the getservbyport routine is + * available to lookup services by their ports. + */ +#$d_getsbyport HAS_GETSERVBYPORT /**/ /* HAS_UNAME: * This symbol, if defined, indicates that the C program may use the diff --git a/ext/DB_File/Changes b/ext/DB_File/Changes new file mode 100644 index 0000000000..a86ea4a26d --- /dev/null +++ b/ext/DB_File/Changes @@ -0,0 +1,194 @@ + +0.1 + + First Release. + +0.2 + + When DB_File is opening a database file it no longer terminates the + process if dbopen returned an error. This allows file protection + errors to be caught at run time. Thanks to Judith Grass + <grass@cybercash.com> for spotting the bug. + +0.3 + + Added prototype support for multiple btree compare callbacks. + +1.0 + + DB_File has been in use for over a year. To reflect that, the + version number has been incremented to 1.0. + + Added complete support for multiple concurrent callbacks. + + Using the push method on an empty list didn't work properly. This + has been fixed. + +1.01 + + Fixed a core dump problem with SunOS. + + The return value from TIEHASH wasn't set to NULL when dbopen + returned an error. + +1.02 + + Merged OS/2 specific code into DB_File.xs + + Removed some redundant code in DB_File.xs. + + Documentation update. + + Allow negative subscripts with RECNO interface. + + Changed the default flags from O_RDWR to O_CREAT|O_RDWR. + + The example code which showed how to lock a database needed a call + to sync added. Without it the resultant database file was empty. + + Added get_dup method. + +1.03 + + Documentation update. + + DB_File now imports the constants (O_RDWR, O_CREAT etc.) from Fcntl + automatically. + + The standard hash function exists is now supported. + + Modified the behavior of get_dup. When it returns an associative + array, the value is the count of the number of matching BTREE + values. + +1.04 + + Minor documentation changes. + + Fixed a bug in hash_cb. Patches supplied by Dave Hammen, + <hammen@gothamcity.jsc.nasa.govt>. + + Fixed a bug with the constructors for DB_File::HASHINFO, + DB_File::BTREEINFO and DB_File::RECNOINFO. Also tidied up the + constructors to make them -w clean. + + Reworked part of the test harness to be more locale friendly. + +1.05 + + Made all scripts in the documentation strict and -w clean. + + Added logic to DB_File.xs to allow the module to be built after + Perl is installed. + +1.06 + + Minor namespace cleanup: Localized PrintBtree. + +1.07 + + Fixed bug with RECNO, where bval wasn't defaulting to "\n". + +1.08 + + Documented operation of bval. + +1.09 + + Minor bug fix in DB_File::HASHINFO, DB_File::RECNOINFO and + DB_File::BTREEINFO. + + Changed default mode to 0666. + +1.10 + + Fixed fd method so that it still returns -1 for in-memory files + when db 1.86 is used. + +1.11 + + Documented the untie gotcha. + +1.12 + + Documented the incompatibility with version 2 of Berkeley DB. + +1.13 + + Minor changes to DB_FIle.xs and DB_File.pm + +1.14 + + Made it illegal to tie an associative array to a RECNO database and + an ordinary array to a HASH or BTREE database. + +1.15 + + Patch from Gisle Aas <gisle@aas.no> to suppress "use of undefined + value" warning with db_get and db_seq. + + Patch from Gisle Aas <gisle@aas.no> to make DB_File export only the + O_* constants from Fcntl. + + Removed the DESTROY method from the DB_File::HASHINFO module. + + Previously DB_File hard-wired the class name of any object that it + created to "DB_File". This makes sub-classing difficult. Now + DB_File creats objects in the namespace of the package it has been + inherited into. + + +1.16 + + A harmless looking tab was causing Makefile.PL to fail on AIX 3.2.5 + + Small fix for the AIX strict C compiler XLC which doesn't like + __attribute__ being defined via proto.h and redefined via db.h. Fix + courtesy of Jarkko Hietaniemi. + +1.50 + + DB_File can now build with either DB 1.x or 2.x, but not both at + the same time. + +1.51 + + Fixed the test harness so that it doesn't expect DB_File to have + been installed by the main Perl build. + + + Fixed a bug in mapping 1.x O_RDONLY flag to 2.x DB_RDONLY equivalent + +1.52 + + Patch from Nick Ing-Simmons now allows DB_File to build on NT. + Merged 1.15 patch. + +1.53 + + Added DB_RENUMBER to flags for recno. + +1.54 + + Fixed a small bug in the test harness when run under win32 + The emulation of fd when useing DB 2.x was busted. + +1.55 + Merged 1.16 changes. + +1.56 + Documented the Solaris 2.5 mutex bug + +1.57 + If Perl has been compiled with Threads support,the symbol op will be + defined. This clashes with a field name in db.h, so it needs to be + #undef'ed before db.h is included. + +1.58 + Tied Array support was enhanced in Perl 5.004_57. DB_File now + supports PUSH,POP,SHIFT,UNSHIFT & STORESIZE. + + Fixed a problem with the use of sv_setpvn. When the size is + specified as 0, it does a strlen on the data. This was ok for DB + 1.x, but isn't for DB 2.x. + diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index 812464361a..95e0a5599f 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -1,8 +1,8 @@ # DB_File.pm -- Perl 5 interface to Berkeley DB # # written by Paul Marquess (pmarquess@bfsec.bt.co.uk) -# last modified 20th Nov 1997 -# version 1.56 +# last modified 20th Dec 1997 +# version 1.57 # # Copyright (c) 1995, 1996, 1997 Paul Marquess. All rights reserved. # This program is free software; you can redistribute it and/or @@ -106,7 +106,7 @@ package DB_File::RECNOINFO ; use strict ; -@DB_File::RECNOINFO::ISA = qw(DB_File::HASHINFO) ; +@DB_File::RECNOINFO::ISA = qw(DB_File::HASHINFO) ; sub TIEHASH { @@ -145,7 +145,7 @@ use vars qw($VERSION @ISA @EXPORT $AUTOLOAD $DB_BTREE $DB_HASH $DB_RECNO $db_ver use Carp; -$VERSION = "1.56" ; +$VERSION = "1.58" ; #typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; $DB_BTREE = new DB_File::BTREEINFO ; @@ -189,9 +189,7 @@ require DynaLoader; R_SNAPSHOT __R_UNUSED -); - -*FETCHSIZE = \&length; +); sub AUTOLOAD { my($constname); @@ -267,7 +265,8 @@ sub TIEARRAY tie_hash_or_array(@_) ; } -sub CLEAR { +sub CLEAR +{ my $self = shift; my $key = "" ; my $value = "" ; @@ -283,6 +282,23 @@ sub CLEAR { } } +sub EXTEND { } + +sub STORESIZE +{ + my $self = shift; + my $length = shift ; + my $current_length = $self->length() ; + + if ($length < $current_length) { + my $key ; + for ($key = $current_length - 1 ; $key >= $length ; -- $key) + { $self->del($key) } + } + elsif ($length > $current_length) + { $self->put($length-1, "") } +} + sub get_dup { croak "Usage: \$db->get_dup(key [,flag])\n" @@ -1022,11 +1038,15 @@ Here is the output from the script: =head2 Extra Methods -As you can see from the example above, the tied array interface is -quite limited. To make the interface more useful, a number of methods -are supplied with B<DB_File> to simulate the standard array operations -that are not currently implemented in Perl's tied array interface. All -these methods are accessed via the object returned from the tie call. +If you are using a version of Perl earlier than 5.004_57, the tied +array interface is quite limited. The example script above will work, +but you won't be able to use C<push>, C<pop>, C<shift>, C<unshift> +etc. with the tied array. + +To make the interface more useful for older versions of Perl, a number +of methods are supplied with B<DB_File> to simulate the missing array +operations. All these methods are accessed via the object returned from +the tie call. Here are the methods: diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index 8f2eda10b0..91b4dc2ad5 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -3,12 +3,12 @@ DB_File.xs -- Perl 5 interface to Berkeley DB written by Paul Marquess (pmarquess@bfsec.bt.co.uk) - last modified 20th Nov 1997 - version 1.56 + last modified 2nd Feb 1998 + version 1.58 All comments/suggestions/problems are welcome - Copyright (c) 1995, 1996, 1997 Paul Marquess. All rights reserved. + Copyright (c) 1995, 1996, 1997, 1998 Paul Marquess. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -50,6 +50,10 @@ 1.54 - Fixed bug in the fd method 1.55 - Fix for AIX from Jarkko Hietaniemi 1.56 - No change to DB_File.xs + 1.57 - added the #undef op to allow building with Threads support. + 1.58 - Fixed a problem with the use of sv_setpvn. When the + size is specified as 0, it does a strlen on the data. + This was ok for DB 1.x, but isn't for DB 2.x. @@ -65,6 +69,12 @@ #undef __attribute__ +/* If Perl has been compiled with Threads support,the symbol op will + be defined here. This clashes with a field name in db.h, so get rid of it. + */ +#ifdef op +#undef op +#endif #include <db.h> #include <fcntl.h> @@ -238,10 +248,11 @@ typedef struct { typedef DB_File_type * DB_File ; typedef DBT DBTKEY ; +#define my_sv_setpvn(sv, d, s) sv_setpvn(sv, (s ? d : (void*)""), s) #define OutputValue(arg, name) \ { if (RETVAL == 0) { \ - sv_setpvn(arg, name.data, name.size) ; \ + my_sv_setpvn(arg, name.data, name.size) ; \ } \ } @@ -249,13 +260,14 @@ typedef DBT DBTKEY ; { if (RETVAL == 0) \ { \ if (db->type != DB_RECNO) { \ - sv_setpvn(arg, name.data, name.size); \ + my_sv_setpvn(arg, name.data, name.size); \ } \ else \ sv_setiv(arg, (I32)*(I32*)name.data - 1); \ } \ } + /* Internal Global Data */ static recno_t Value ; static recno_t zero = 0 ; @@ -560,13 +572,12 @@ SV * sv ; { SV ** svp; HV * action ; - DB_File RETVAL; + DB_File RETVAL = (DB_File)safemalloc(sizeof(DB_File_type)) ; void * openinfo = NULL ; - INFO * info; + INFO * info = &RETVAL->info ; /* printf("In ParseOpenInfo name=[%s] flags=[%d] mode = [%d]\n", name, flags, mode) ; */ - Newz(777, RETVAL, 1, DB_File_type) ; - info = &RETVAL->info ; + Zero(RETVAL, 1, DB_File_type) ; /* Default to HASH */ RETVAL->hash = RETVAL->compare = RETVAL->prefix = NULL ; @@ -1159,7 +1170,7 @@ db_FETCH(db, key, flags=0) RETVAL = db_get(db, key, value, flags) ; ST(0) = sv_newmortal(); if (RETVAL == 0) - sv_setpvn(ST(0), value.data, value.size); + my_sv_setpvn(ST(0), value.data, value.size); } int @@ -1189,7 +1200,7 @@ db_FIRSTKEY(db) if (RETVAL == 0) { if (db->type != DB_RECNO) - sv_setpvn(ST(0), key.data, key.size); + my_sv_setpvn(ST(0), key.data, key.size); else sv_setiv(ST(0), (I32)*(I32*)key.data - 1); } @@ -1211,7 +1222,7 @@ db_NEXTKEY(db, key) if (RETVAL == 0) { if (db->type != DB_RECNO) - sv_setpvn(ST(0), key.data, key.size); + my_sv_setpvn(ST(0), key.data, key.size); else sv_setiv(ST(0), (I32)*(I32*)key.data - 1); } @@ -1224,6 +1235,7 @@ db_NEXTKEY(db, key) int unshift(db, ...) DB_File db + ALIAS: UNSHIFT = 1 CODE: { DBTKEY key ; @@ -1264,6 +1276,7 @@ unshift(db, ...) I32 pop(db) DB_File db + ALIAS: POP = 1 CODE: { DBTKEY key ; @@ -1281,7 +1294,7 @@ pop(db) if (RETVAL == 0) { /* the call to del will trash value, so take a copy now */ - sv_setpvn(ST(0), value.data, value.size); + my_sv_setpvn(ST(0), value.data, value.size); RETVAL = db_del(db, key, R_CURSOR) ; if (RETVAL != 0) sv_setsv(ST(0), &sv_undef); @@ -1291,6 +1304,7 @@ pop(db) I32 shift(db) DB_File db + ALIAS: SHIFT = 1 CODE: { DBT value ; @@ -1307,7 +1321,7 @@ shift(db) if (RETVAL == 0) { /* the call to del will trash value, so take a copy now */ - sv_setpvn(ST(0), value.data, value.size); + my_sv_setpvn(ST(0), value.data, value.size); RETVAL = db_del(db, key, R_CURSOR) ; if (RETVAL != 0) sv_setsv (ST(0), &sv_undef) ; @@ -1318,6 +1332,7 @@ shift(db) I32 push(db, ...) DB_File db + ALIAS: PUSH = 1 CODE: { DBTKEY key ; @@ -1365,6 +1380,7 @@ push(db, ...) I32 length(db) DB_File db + ALIAS: FETCHSIZE = 1 CODE: CurrentDB = db ; RETVAL = GetArrayLength(db) ; diff --git a/hints/machten.sh b/hints/machten.sh index 380f70261d..25b7062ea5 100644 --- a/hints/machten.sh +++ b/hints/machten.sh @@ -13,6 +13,8 @@ # Martijn Koster <m.koster@webcrawler.com> # Richard Yeh <rcyeh@cco.caltech.edu> # +# Raise stack size further; slight tweaks to accomodate MT 4.1 +# -- Dominic Dunlop <domo@computer.org> 980211 # Raise perl's stack size -- Dominic Dunlop <domo@tcp.ip.lu> 970922 # Reinstate sigsetjmp iff version is 4.0.3 or greater; use nm # (assumes Configure change); prune libswanted -- Dominic Dunlop 970113 @@ -37,7 +39,7 @@ nmopts=-gp # Increase perl's stack size. Without this, lib/complex.t crashes out. # Particularly perverse programs may require that perl has an even larger # stack allocation than that specified here. (See man setstackspace ) -ldflags='-Xlstack=0x014000' +ldflags='-Xlstack=0x018000' # Install in /usr/local by default prefix='/usr/local' @@ -61,6 +63,8 @@ set `echo X "$libswanted "|sed -e 's/ net / /' -e 's/ socket / /' \ shift libswanted="$*" +# While link counts on MachTen 4.1's fast file systems work correctly, +# on Macintosh Heirarchical File Systems, (and on HFS+) # MachTen always reports ony two links to directories, even if they # contain subdirectories. Consequently, we use this variable to stop # File::Find using the link count to determine whether there are @@ -74,7 +78,7 @@ cat <<'EOM' >&4 Tests io/fs test 4 and op/stat test 3 -may fail since MachTen does not return a useful nlinks field to stat +may fail since MachTen may not return a useful nlinks field to stat on directories. At the end of Configure, you will see a harmless message @@ -85,4 +89,4 @@ Hmm...You had some extra variables I don't know about...I'll try to keep 'em. Read the File::Find documentation for more information about dont_use_nlink EOM -test -r ./broken-db.msg && . ./broken-db.msg +expr "$osvers" \< "4.1" && test -r ./broken-db.msg && . ./broken-db.msg diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index 0803a999ff..a3d2481224 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -1,7 +1,7 @@ package ExtUtils::Install; -$VERSION = substr q$Revision: 1.19 $, 10; -# $Date: 1997/08/01 08:39:37 $ +$VERSION = substr q$Revision: 1.28 $, 10; +# $Date: 1998/01/25 07:08:24 $ use Exporter; use Carp (); @@ -52,10 +52,12 @@ sub install { opendir DIR, $source_dir_or_file or next; for (readdir DIR) { next if $_ eq "." || $_ eq ".." || $_ eq ".exists"; - if (-w $hash{$source_dir_or_file} || mkpath($hash{$source_dir_or_file})) { + if (-w $hash{$source_dir_or_file} || + mkpath($hash{$source_dir_or_file})) { last; } else { - warn "Warning: You do not have permissions to install into $hash{$source_dir_or_file}" + warn "Warning: You do not have permissions to " . + "install into $hash{$source_dir_or_file}" unless $warn_permissions++; } } @@ -73,11 +75,6 @@ sub install { my $cwd = cwd(); my $umask = umask 0 unless $Is_VMS; - # This silly reference is just here to be able to call MY->catdir - # without a warning (Waiting for a proper path/directory module, - # Charles!) - my $MY = {}; - bless $MY, 'MY'; my($source); MOD_INSTALL: foreach $source (sort keys %hash) { #copy the tree to the target directory without altering @@ -85,14 +82,24 @@ sub install { #file. The packlist file contains the absolute paths of the #install locations. AFS users may call this a bug. We'll have #to reconsider how to add the means to satisfy AFS users also. + + #October 1997: we want to install .pm files into archlib if + #there are any files in arch. So we depend on having ./blib/arch + #hardcoded here. + my $targetroot = $hash{$source}; + if ($source eq "./blib/lib" and + exists $hash{"./blib/arch"} and + directory_not_empty("./blib/arch")) { + $targetroot = $hash{"./blib/arch"}; + } chdir($source) or next; find(sub { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat; return unless -f _; return if $_ eq ".exists"; - my $targetdir = $MY->catdir($hash{$source},$File::Find::dir); - my $targetfile = $MY->catfile($targetdir,$_); + my $targetdir = MY->catdir($targetroot,$File::Find::dir); + my $targetfile = MY->catfile($targetdir,$_); my $diff = 0; if ( -f $targetfile && -s _ == $size) { @@ -145,6 +152,19 @@ sub install { } } +sub directory_not_empty ($) { + my($dir) = @_; + my $files = 0; + find(sub { + return if $_ eq ".exists"; + if (-f) { + $File::Find::prune++; + $files = 1; + } + }, $dir); + return $files; +} + sub install_default { @_ < 2 or die "install_default should be called with 0 or 1 argument"; my $FULLEXT = @_ ? shift : $ARGV[0]; @@ -158,7 +178,9 @@ sub install_default { install({ read => "$Config{sitearchexp}/auto/$FULLEXT/.packlist", write => "$Config{installsitearch}/auto/$FULLEXT/.packlist", - $INST_LIB => $Config{installsitelib}, + $INST_LIB => (directory_not_empty($INST_ARCHLIB)) ? + $Config{installsitearch} : + $Config{installsitelib}, $INST_ARCHLIB => $Config{installsitearch}, $INST_BIN => $Config{installbin} , $INST_SCRIPT => $Config{installscript}, @@ -173,26 +195,29 @@ sub uninstall { # my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al)); # require $my_req; # Hairy, but for the first local *P; - open P, $fil or Carp::croak("uninstall: Could not read packlist file $fil: $!"); + open P, $fil or Carp::croak("uninstall: Could not read packlist " . + "file $fil: $!"); while (<P>) { chomp; print "unlink $_\n" if $verbose; forceunlink($_) unless $nonono; } print "unlink $fil\n" if $verbose; + close P; forceunlink($fil) unless $nonono; } sub inc_uninstall { my($file,$libdir,$verbose,$nonono) = @_; my($dir); - my $MY = {}; - bless $MY, 'MY'; my %seen_dir = (); - foreach $dir (@INC, @PERL_ENV_LIB, @Config{qw/archlibexp privlibexp sitearchexp sitelibexp/}) { + foreach $dir (@INC, @PERL_ENV_LIB, @Config{qw(archlibexp + privlibexp + sitearchexp + sitelibexp)}) { next if $dir eq "."; next if $seen_dir{$dir}++; - my($targetfile) = $MY->catfile($dir,$libdir,$file); + my($targetfile) = MY->catfile($dir,$libdir,$file); next unless -f $targetfile; # The reason why we compare file's contents is, that we cannot diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index d6add626a6..d03c1b6680 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -1344,6 +1344,9 @@ sub process_L { $str =~ s/\n/ /g; # undo word-wrapped tags $s1 = $str; for ($s1) { + # LREF: a la HREF L<show this text|man/section> + $linktext = $1 if s:^([^|]+)\|::; + # a :: acts like a / s,::,/,; @@ -1369,13 +1372,13 @@ sub process_L { $page=$page83 if (defined $pages{$page83}); if ($page eq "") { $link = "#" . htmlify(0,$section); - $linktext = $section; + $linktext = $section unless defined($linktext); } elsif (!defined $pages{$page}) { warn "$0: $podfile: cannot resolve L<$str> in paragraph $paragraph: no such page '$page'\n"; $link = ""; - $linktext = $page; + $linktext = $page unless defined($linktext); } else { - $linktext = ($section ? "$section" : "the $page manpage"); + $linktext = ($section ? "$section" : "the $page manpage") unless defined($linktext); $section = htmlify(0,$section) if $section ne ""; # if there is a directory by the name of the page, then assume that an @@ -1397,7 +1400,7 @@ sub process_L { warn "$0: $podfile: cannot resolve L$str in paragraph $paragraph: ". "no .pod or .pm found\n"; $link = ""; - $linktext = $section; + $linktext = $section unless defined($linktext); } } } diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm index 96fda96aed..67993db3f5 100644 --- a/lib/Pod/Text.pm +++ b/lib/Pod/Text.pm @@ -165,6 +165,10 @@ sub prepare_for_output { s/I<(.*?)>/*$1*/sg; # s/[CB]<(.*?)>/bold($1)/ge; s/X<.*?>//sg; + + # LREF: a la HREF L<show this text|man/section> + s:L<([^|>]+)\|[^>]+>:$1:g; + # LREF: a manpage(3f) s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the $1$2 manpage:g; # LREF: an =item on another manpage diff --git a/lib/perl5db.pl b/lib/perl5db.pl index f0774bcdac..9048ed2baf 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -1386,7 +1386,7 @@ sub system { # We save, change, then restore STDIN and STDOUT to avoid fork() since # many non-Unix systems can do system() but have problems with fork(). open(SAVEIN,"<&STDIN") || &warn("Can't save STDIN"); - open(SAVEOUT,">&OUT") || &warn("Can't save STDOUT"); + open(SAVEOUT,">&STDOUT") || &warn("Can't save STDOUT"); open(STDIN,"<&IN") || &warn("Can't redirect STDIN"); open(STDOUT,">&OUT") || &warn("Can't redirect STDOUT"); system(@_); @@ -178,7 +178,7 @@ static u_short blk_shift[11 - 3] = {256, 128, 64, 32, static char *emergency_buffer; static MEM_SIZE emergency_buffer_size; -static char * +static Malloc_t emergency_sbrk(size) MEM_SIZE size; { @@ -237,14 +237,14 @@ static union overhead *nextf[NBUCKETS]; #ifdef USE_PERL_SBRK #define sbrk(a) Perl_sbrk(a) -char * Perl_sbrk _((int size)); +Malloc_t Perl_sbrk _((int size)); #else #ifdef DONT_DECLARE_STD #ifdef I_UNISTD #include <unistd.h> #endif #else -extern char *sbrk(int); +extern Malloc_t sbrk(int); #endif #endif diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 20c0ae1325..6802b08ac5 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -899,6 +899,30 @@ a B<-e> switch. Maybe your /tmp partition is full, or clobbered. opposed to a subroutine reference): no such method callable via the package. If method name is C<???>, this is an internal error. +=item Character class syntax [. .] is reserved for future extensions + +(W) Within regular expression character classes ([]) the syntax beginning +with "[." and ending with ".]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[." and ".\]". + +=item Character class syntax [: :] is reserved for future extensions + +(W) Within regular expression character classes ([]) the syntax beginning +with "[:" and ending with ":]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[:" and ":\]". + +=item Character class syntax [= =] is reserved for future extensions + +(W) Within regular expression character classes ([]) the syntax +beginning with "[=" and ending with "=]" is reserved for future extensions. +If you need to represent those character sequences inside a regular +expression character class, just quote the square brackets with the +backslash: "\[=" and "=\]". + =item chmod: mode argument is missing initial 0 (W) A novice will sometimes say diff --git a/pod/perlpod.pod b/pod/perlpod.pod index 6a578caec3..d20d62d06a 100644 --- a/pod/perlpod.pod +++ b/pod/perlpod.pod @@ -7,10 +7,12 @@ perlpod - plain old documentation A pod-to-whatever translator reads a pod file paragraph by paragraph, and translates it to the appropriate output format. There are three kinds of paragraphs: +L<verbatim|/"Verbatim Paragraph">, +L<command|/"Command Paragraph">, and +L<ordinary text|/"Ordinary Block of Text">. -=over 4 -=item * +=head2 Verbatim Paragraph A verbatim paragraph, distinguished by being indented (that is, it starts with space or tab). It should be reproduced exactly, @@ -18,9 +20,10 @@ with tabs assumed to be on 8-column boundaries. There are no special formatting escapes, so you can't italicize or anything like that. A \ means \, and nothing else. -=item * -A command. All command paragraphs start with "=", followed by an +=head2 Command Paragraph + +All command paragraphs start with "=", followed by an identifier, followed by arbitrary text that the command can use however it pleases. Currently recognized commands are @@ -35,13 +38,29 @@ use however it pleases. Currently recognized commands are =begin X =end X +=over 4 + +=item =pod + +=item =cut + The "=pod" directive does nothing beyond telling the compiler to lay off parsing code through the next "=cut". It's useful for adding another paragraph to the doc if you're mixing up code and pod a lot. +=item =head1 + +=item =head2 + Head1 and head2 produce first and second level headings, with the text in the same paragraph as the "=headn" directive forming the heading description. +=item =over + +=item =back + +=item =item + Item, over, and back require a little more explanation: "=over" starts a section specifically for the generation of a list using "=item" commands. At the end of your list, use "=back" to end it. You will probably want to give @@ -56,6 +75,13 @@ or use "=item 1.", "=item 2.", etc., to produce numbered lists, or use or numbers. If you start with bullets or numbers, stick with them, as many formatters use the first "=item" type to decide how to format the list. + +=item =for + +=item =begin + +=item =end + For, begin, and end let you include sections that are not interpreted as pod text, but passed directly to particular formatters. A formatter that can utilize that format will use the section, otherwise it will be @@ -123,9 +149,13 @@ Some examples of lists include: =back -=item * -An ordinary block of text. It will be filled, and maybe even +=back + + +=head2 Ordinary Block of Text + +It will be filled, and maybe even justified. Certain interior sequences are recognized both here and in commands: @@ -140,6 +170,14 @@ here and in commands: L<"sec"> section in this manual page (the quotes are optional) L</"sec"> ditto + same as above but only 'text' is used for output. + (Text can not contain the characters '|' or '>') + L<text|name> + L<text|name/ident> + L<text|name/"sec"> + L<text|"sec"> + L<text|/"sec"> + F<file> Used for filenames X<index> An index entry Z<> A zero-width character @@ -152,7 +190,8 @@ here and in commands: E<html> Some non-numeric HTML entity, such as E<Agrave> -=back + +=head2 The Intent That's it. The intent is simplicity, not power. I wanted paragraphs to look like paragraphs (block format), so that they stand out @@ -179,9 +218,10 @@ Note that I'm not at all claiming this to be sufficient for producing a book. I'm just trying to make an idiot-proof common source for nroff, TeX, and other markup languages, as used for online documentation. Translators exist for B<pod2man> (that's for nroff(1) and troff(1)), -B<pod2html>, B<pod2latex>, and B<pod2fm>. +B<pod2text>, B<pod2html>, B<pod2latex>, and B<pod2fm>. -=head1 Embedding Pods in Perl Modules + +=head2 Embedding Pods in Perl Modules You can embed pod documentation in your Perl scripts. Start your documentation with a "=head1" command at the beginning, and end it @@ -201,7 +241,8 @@ directive. If you had not had that empty line there, then the translators wouldn't have seen it. -=head1 Common Pod Pitfalls + +=head2 Common Pod Pitfalls =over 4 @@ -219,6 +260,10 @@ B<pod2man> for details). Thus, you shouldn't write things like C<the LE<lt>fooE<gt> manpage>, if you want the translated document to read sensibly. +If you don need or want total control of the text used for a +link in the output use the form LE<lt>show this text|fooE<gt> +instead. + =item * The script F<pod/checkpods.PL> in the Perl source distribution diff --git a/pod/pod2man.PL b/pod/pod2man.PL index 5c8afc7a6d..5e5dfb0b66 100644 --- a/pod/pod2man.PL +++ b/pod/pod2man.PL @@ -801,6 +801,9 @@ while (<>) { # no break -- usually we want C<> for this s/S<([^<>]*)>/nobreak($1)/eg; + # LREF: a la HREF L<show this text|man/section> + s:L<([^|>]+)\|[^>]+>:$1:g; + # LREF: a manpage(3f) s:L<([a-zA-Z][^\s\/]+)(\([^\)]+\))?>:the I<$1>$2 manpage:g; @@ -3579,8 +3579,8 @@ PP(pp_ghostent) register char **elem; register SV *sv; #if defined(HAS_GETHOSTENT) && !defined(DONT_DECLARE_STD) - struct hostent *PerlSock_gethostbyname(const char *); - struct hostent *PerlSock_gethostbyaddr(const Gethbadd_addr_t, Gethbadd_alen_t, int); + struct hostent *PerlSock_gethostbyaddr(Netdb_host_t, Netdb_hlen_t, int); + struct hostent *PerlSock_gethostbyname(Netdb_name_t); #ifndef PerlSock_gethostent struct hostent *PerlSock_gethostent(void); #endif @@ -3596,9 +3596,9 @@ PP(pp_ghostent) int addrtype = POPi; SV *addrsv = POPs; STRLEN addrlen; - Gethbadd_addr_t addr = (Gethbadd_addr_t) SvPV(addrsv, addrlen); + Netdb_host_t addr = (Netdb_host_t) SvPV(addrsv, addrlen); - hent = PerlSock_gethostbyaddr(addr, (Gethbadd_alen_t) addrlen, addrtype); + hent = PerlSock_gethostbyaddr(addr, (Netdb_hlen_t) addrlen, addrtype); } else #ifdef HAS_GETHOSTENT @@ -3682,12 +3682,8 @@ PP(pp_gnetent) register char **elem; register SV *sv; #ifdef NETDB_H_OMITS_GETNET - struct netent *getnetbyname(const char *); - /* - * long is wrong for getnetbyadddr (e.g. on Alpha). POSIX.1g says - * in_addr_t but then such systems don't have broken netdb.h anyway. - */ - struct netent *getnetbyaddr(Getnbadd_net_t, int); + struct netent *getnetbyaddr(Netdb_net_t, int); + struct netent *getnetbyname(Netdb_name_t); struct netent *getnetent(void); #endif struct netent *nent; @@ -3696,7 +3692,7 @@ PP(pp_gnetent) nent = getnetbyname(POPp); else if (which == OP_GNBYADDR) { int addrtype = POPi; - Getnbadd_net_t addr = (Getnbadd_net_t) U_L(POPn); + Netdb_net_t addr = (Netdb_net_t) U_L(POPn); nent = getnetbyaddr(addr, addrtype); } else @@ -3761,7 +3757,7 @@ PP(pp_gprotoent) register char **elem; register SV *sv; #ifndef DONT_DECLARE_STD - struct protoent *PerlSock_getprotobyname(const char *); + struct protoent *PerlSock_getprotobyname(Netdb_name_t); struct protoent *PerlSock_getprotobynumber(int); #ifndef PerlSock_getprotoent struct protoent *PerlSock_getprotoent(void); @@ -3833,8 +3829,8 @@ PP(pp_gservent) register char **elem; register SV *sv; #ifndef DONT_DECLARE_STD - struct servent *PerlSock_getservbyname(const char *, const char *); - struct servent *PerlSock_getservbynumber(); + struct servent *PerlSock_getservbyname(Netdb_name_t, Netdb_name_t); + struct servent *PerlSock_getservbyport(int, Netdb_name_t); #ifndef PerlSock_getservent struct servent *PerlSock_getservent(void); #endif @@ -1866,6 +1866,30 @@ regclass(void) while (regparse < regxend && *regparse != ']') { skipcond: Class = UCHARAT(regparse++); + if (Class == '[' && regparse + 1 < regxend && + /* I smell either [: or [= or [. -- POSIX has been here, right? */ + (*regparse == ':' || *regparse == '=' || *regparse == '.')) { + char posixccc = *regparse; + char* posixccs = regparse++; + + while (regparse < regxend && *regparse != posixccc) + regparse++; + if (regparse == regxend) + /* Grandfather lone [:, [=, [. */ + regparse = posixccs; + else { + regparse++; /* skip over the posixccc */ + if (*regparse == ']') { + /* Not Implemented Yet. + * (POSIX Extended Character Classes, that is) + * The text between e.g. [: and :] would start + * at posixccs + 1 and stop at regparse - 2. */ + if (dowarn && !SIZE_ONLY) + warn("Character class syntax [%c %c] is reserved for future extensions", posixccc, posixccc); + regparse++; /* skip over the ending ] */ + } + } + } if (Class == '\\') { Class = UCHARAT(regparse++); switch (Class) { @@ -2662,6 +2686,3 @@ re_croak2(const char* pat1,const char* pat2, va_alist) buf[l1] = '\0'; /* Overwrite \n */ croak("%s", buf); } - - - @@ -979,7 +979,7 @@ regmatch(regnode *prog) n = ARG(scan); /* which paren pair */ s = regstartp[n]; if (*reglastparen < n || !s) - break; /* Zero length always matches */ + sayNO; /* Do not match unless seen CLOSEn. */ if (s == regendp[n]) break; /* Inline the first character, for speed. */ @@ -43,13 +43,13 @@ #define ENTER \ STMT_START { \ push_scope(); \ - DEBUG_l(deb("ENTER scope %ld at %s:%d\n", \ - scopestack_ix, __FILE__, __LINE__)); \ + DEBUG_l(WITH_THR(deb("ENTER scope %ld at %s:%d\n", \ + scopestack_ix, __FILE__, __LINE__))); \ } STMT_END #define LEAVE \ STMT_START { \ - DEBUG_l(deb("LEAVE scope %ld at %s:%d\n", \ - scopestack_ix, __FILE__, __LINE__)); \ + DEBUG_l(WITH_THR(deb("LEAVE scope %ld at %s:%d\n", \ + scopestack_ix, __FILE__, __LINE__))); \ pop_scope(); \ } STMT_END #else @@ -1085,6 +1085,10 @@ sv_grow(SV* sv, unsigned long newlen) s = SvPVX(sv); if (newlen > SvLEN(sv)) newlen += 10 * (newlen - SvCUR(sv)); /* avoid copy each time */ +#ifdef HAS_64K_LIMIT + if (newlen >= 0x10000) + newlen = 0xFFFF; +#endif } else s = SvPVX(sv); @@ -1169,7 +1173,6 @@ sv_setnv(register SV *sv, double num) case SVt_IV: sv_upgrade(sv, SVt_NV); break; - case SVt_NV: case SVt_RV: case SVt_PV: case SVt_PVIV: @@ -1716,8 +1719,7 @@ sv_2pv(register SV *sv, STRLEN *lp) return ""; } } - if (!SvUPGRADE(sv, SVt_PV)) - return 0; + (void)SvUPGRADE(sv, SVt_PV); if (SvNOKp(sv)) { if (SvTYPE(sv) < SVt_PVNV) sv_upgrade(sv, SVt_PVNV); @@ -2199,6 +2201,7 @@ sv_setsv_mg(SV *dstr, register SV *sstr) void sv_setpvn(register SV *sv, register const char *ptr, register STRLEN len) { + register char *dptr; assert(len >= 0); /* STRLEN is probably unsigned, so this may elicit a warning, but it won't hurt. */ sv_check_thinkfirst(sv); @@ -2210,12 +2213,14 @@ sv_setpvn(register SV *sv, register const char *ptr, register STRLEN len) if (SvFAKE(sv) && SvTYPE(sv) == SVt_PVGV) sv_unglob(sv); } - else if (!sv_upgrade(sv, SVt_PV)) - return; + else + sv_upgrade(sv, SVt_PV); + SvGROW(sv, len + 1); - Move(ptr,SvPVX(sv),len,char); + dptr = SvPVX(sv); + Move(ptr,dptr,len,char); + dptr[len] = '\0'; SvCUR_set(sv, len); - *SvEND(sv) = '\0'; (void)SvPOK_only(sv); /* validate pointer */ SvTAINT(sv); } @@ -2242,8 +2247,9 @@ sv_setpv(register SV *sv, register const char *ptr) if (SvFAKE(sv) && SvTYPE(sv) == SVt_PVGV) sv_unglob(sv); } - else if (!sv_upgrade(sv, SVt_PV)) - return; + else + sv_upgrade(sv, SVt_PV); + SvGROW(sv, len + 1); Move(ptr,SvPVX(sv),len+1,char); SvCUR_set(sv, len); @@ -2262,8 +2268,7 @@ void sv_usepvn(register SV *sv, register char *ptr, register STRLEN len) { sv_check_thinkfirst(sv); - if (!SvUPGRADE(sv, SVt_PV)) - return; + (void)SvUPGRADE(sv, SVt_PV); if (!ptr) { (void)SvOK_off(sv); return; @@ -2434,8 +2439,7 @@ sv_magic(register SV *sv, SV *obj, int how, char *name, I32 namlen) } } else { - if (!SvUPGRADE(sv, SVt_PVMG)) - return; + (void)SvUPGRADE(sv, SVt_PVMG); } Newz(702,mg, 1, MAGIC); mg->mg_moremagic = SvMAGIC(sv); @@ -3081,8 +3085,7 @@ sv_gets(register SV *sv, register PerlIO *fp, I32 append) I32 i; sv_check_thinkfirst(sv); - if (!SvUPGRADE(sv, SVt_PV)) - return 0; + (void)SvUPGRADE(sv, SVt_PV); SvSCREAM_off(sv); if (RsSNARF(rs)) { diff --git a/t/lib/db-recno.t b/t/lib/db-recno.t index b332c5eb6c..c2161b279c 100755 --- a/t/lib/db-recno.t +++ b/t/lib/db-recno.t @@ -12,7 +12,10 @@ BEGIN { use DB_File; use Fcntl; use strict ; -use vars qw($dbh $Dfile $bad_ones) ; +use vars qw($dbh $Dfile $bad_ones $FA) ; + +# full tied array support started in Perl 5.004_57 +$FA = ($] >= 5.004_57) ; sub ok { @@ -41,7 +44,7 @@ sub bad_one EOM } -print "1..66\n"; +print "1..78\n"; my $Dfile = "recno.tmp"; unlink $Dfile ; @@ -98,7 +101,7 @@ ok(18, ((stat($Dfile))[2] & 0777) == (($^O eq 'os2' || $^O eq 'MSWin32') ? 0666 #my $l = @h ; my $l = $X->length ; -ok(19, !$l ); +ok(19, ($FA ? @h == 0 : !$l) ); my @data = qw( a b c d ever f g h i j k longername m n o p) ; @@ -113,7 +116,7 @@ unshift (@data, 'a') ; ok(21, defined $h[1] ); ok(22, ! defined $h[16] ); -ok(23, $X->length == @data ); +ok(23, $FA ? @h == @data : $X->length == @data ); # Overwrite an entry & check fetch it @@ -123,8 +126,7 @@ ok(24, $h[3] eq 'replaced' ); #PUSH my @push_data = qw(added to the end) ; -#my push (@h, @push_data) ; -$X->push(@push_data) ; +($FA ? push(@h, @push_data) : $X->push(@push_data)) ; push (@data, @push_data) ; ok(25, $h[++$i] eq 'added' ); ok(26, $h[++$i] eq 'to' ); @@ -133,27 +135,24 @@ ok(28, $h[++$i] eq 'end' ); # POP my $popped = pop (@data) ; -#my $value = pop(@h) ; -my $value = $X->pop ; +my $value = ($FA ? pop @h : $X->pop) ; ok(29, $value eq $popped) ; # SHIFT -#$value = shift @h -$value = $X->shift ; +$value = ($FA ? shift @h : $X->shift) ; my $shifted = shift @data ; ok(30, $value eq $shifted ); # UNSHIFT # empty list -$X->unshift ; -ok(31, $X->length == @data ); +($FA ? unshift @h : $X->unshift) ; +ok(31, ($FA ? @h == @data : $X->length == @data )); my @new_data = qw(add this to the start of the array) ; -#unshift @h, @new_data ; -$X->unshift (@new_data) ; +$FA ? unshift (@h, @new_data) : $X->unshift (@new_data) ; unshift (@data, @new_data) ; -ok(32, $X->length == @data ); +ok(32, $FA ? @h == @data : $X->length == @data ); ok(33, $h[0] eq "add") ; ok(34, $h[1] eq "this") ; ok(35, $h[2] eq "to") ; @@ -180,15 +179,15 @@ ok(42, $ok ); # get the last element of the array ok(43, $h[-1] eq $data[-1] ); -ok(44, $h[-1] eq $h[$X->length -1] ); +ok(44, $h[-1] eq $h[ ($FA ? @h : $X->length) -1] ); # get the first element using a negative subscript -eval '$h[ - ( $X->length)] = "abcd"' ; +eval '$h[ - ( $FA ? @h : $X->length)] = "abcd"' ; ok(45, $@ eq "" ); ok(46, $h[0] eq "abcd" ); # now try to read before the start of the array -eval '$h[ - (1 + $X->length)] = 1234' ; +eval '$h[ - (1 + ($FA ? @h : $X->length))] = 1234' ; ok(47, $@ =~ '^Modification of non-creatable array value attempted' ); # IMPORTANT - $X must be undefined before the untie otherwise the @@ -350,7 +349,7 @@ EOM close FILE ; - BEGIN { push @INC, '.'; } + BEGIN { push @INC, '.'; } eval 'use SubDB ; '; main::ok(57, $@ eq "") ; my @h ; @@ -384,4 +383,61 @@ EOM } +{ + + # test $# + my $self ; + unlink $Dfile; + ok(67, $self = tie @h, 'DB_File', $Dfile, O_RDWR|O_CREAT, 0640, $DB_RECNO ) ; + $h[0] = "abc" ; + $h[1] = "def" ; + $h[2] = "ghi" ; + $h[3] = "jkl" ; + ok(68, $FA ? $#h == 3 : $self->length() == 4) ; + undef $self ; + untie @h ; + my $x = docat($Dfile) ; + ok(69, $x eq "abc\ndef\nghi\njkl\n") ; + + # $# sets array to same length + ok(70, $self = tie @h, 'DB_File', $Dfile, O_RDWR, 0640, $DB_RECNO ) ; + if ($FA) + { $#h = 3 } + else + { $self->STORESIZE(4) } + ok(71, $FA ? $#h == 3 : $self->length() == 4) ; + undef $self ; + untie @h ; + $x = docat($Dfile) ; + ok(72, $x eq "abc\ndef\nghi\njkl\n") ; + + # $# sets array to bigger + ok(73, $self = tie @h, 'DB_File', $Dfile, O_RDWR, 0640, $DB_RECNO ) ; + if ($FA) + { $#h = 6 } + else + { $self->STORESIZE(7) } + ok(74, $FA ? $#h == 6 : $self->length() == 7) ; + undef $self ; + untie @h ; + $x = docat($Dfile) ; + ok(75, $x eq "abc\ndef\nghi\njkl\n\n\n\n") ; + + # $# sets array smaller + ok(76, $self = tie @h, 'DB_File', $Dfile, O_RDWR, 0640, $DB_RECNO ) ; + if ($FA) + { $#h = 2 } + else + { $self->STORESIZE(3) } + ok(77, $FA ? $#h == 2 : $self->length() == 3) ; + undef $self ; + untie @h ; + $x = docat($Dfile) ; + ok(78, $x eq "abc\ndef\nghi\n") ; + + unlink $Dfile; + + +} + exit ; diff --git a/t/lib/filecopy.t b/t/lib/filecopy.t index b718215a1e..8a23fb6d7d 100755 --- a/t/lib/filecopy.t +++ b/t/lib/filecopy.t @@ -13,6 +13,7 @@ use File::Copy; # First we create a file open(F, ">file-$$") or die; +binmode F; # for DOSISH platforms, because test 3 copies to stdout print F "ok 3\n"; close F; diff --git a/t/op/misc.t b/t/op/misc.t index 7a7fc334d3..1ca45db039 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -357,3 +357,4 @@ begin <a> init <b> end <c> argv <> +######## diff --git a/t/op/pat.t b/t/op/pat.t index 5d8bf8ad78..5ea9bb44ae 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -2,7 +2,7 @@ # $RCSfile: pat.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:12 $ -print "1..101\n"; +print "1..104\n"; $x = "abc\ndef\n"; @@ -354,3 +354,28 @@ $x =~ /.a/g; print "not " unless f(pos($x)) == 4; print "ok $test\n"; $test++; + +sub must_warn_pat { + my $warn_pat = shift; + return sub { print "not " unless $_[0] =~ /$warn_pat/ } +} + +sub must_warn { + my ($warn_pat, $code) = @_; + local $^W; local %SIG; + eval 'BEGIN { $^W = 1; $SIG{__WARN__} = $warn_pat };' . $code; + print "ok $test\n"; + $test++; +} + + +sub make_must_warn { + my $warn_pat = shift; + return sub { must_warn(must_warn_pat($warn_pat)) } +} + +my $for_future = make_must_warn('reserved for future extensions'); + +&$for_future('q(a:[b]:) =~ /[x[:foo:]]/'); +&$for_future('q(a=[b]=) =~ /[x[=foo=]]/'); +&$for_future('q(a.[b].) =~ /[x[.foo.]]/'); diff --git a/t/op/re_tests b/t/op/re_tests index b688a167f2..9217fcca1f 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -322,9 +322,9 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce ^(a\1?){4}$ aaaaaaaaaa y $1 aaaa ^(a\1?){4}$ aaaaaaaaa n - - ^(a\1?){4}$ aaaaaaaaaaa n - - -^(a\1){4}$ aaaaaaaaaa y $1 aaaa -^(a\1){4}$ aaaaaaaaa n - - -^(a\1){4}$ aaaaaaaaaaa n - - +^(a(?(1)\1)){4}$ aaaaaaaaaa y $1 aaaa +^(a(?(1)\1)){4}$ aaaaaaaaa n - - +^(a(?(1)\1)){4}$ aaaaaaaaaaa n - - (?:(f)(o)(o)|(b)(a)(r))* foobar y $1:$2:$3:$4:$5:$6 f:o:o:b:a:r (?<=a)b ab y $& b (?<=a)b cb n - - @@ -431,6 +431,12 @@ $(?<=^(a)) a y $1 a (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a}) yaaxxaaaacd y $b 4 (>a+)ab aaab n - - (?>a+)b aaab y - - +([[:]+) a:[b]: y $1 :[ +([[=]+) a=[b]= y $1 =[ +([[.]+) a.[b]. y $1 .[ +[a[:xyz: - c - /[a[:xyz:/: unmatched [] in regexp +[a[:xyz:] - c - /[a[:xyz:]/: unmatched [] in regexp +([a[:xyz:]b]+) pbaq y $1 ba ((?>a+)b) aaab y $1 aaab (?>(a+))b aaab y $1 aaa ((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x diff --git a/t/pragma/locale.t b/t/pragma/locale.t index d068465fb3..8875f7caa6 100755 --- a/t/pragma/locale.t +++ b/t/pragma/locale.t @@ -291,14 +291,18 @@ locatelocale(\$Spanish, \@Spanish, ($Locale, @Locale) = ($Spanish, @Spanish) if (@Spanish > @Locale); -print "# Locale = $Locale\n"; -print "# Alnum_ = @Locale\n"; - { local $^W = 0; setlocale(&LC_ALL, $Locale); } +# Sort it now that LC_ALL has been set. + +@Locale = sort @Locale; + +print "# Locale = $Locale\n"; +print "# Alnum_ = @Locale\n"; + { my $i = 0; |