From: Jarkko Hietaniemi Date: Thu, 11 Nov 1999 19:41:56 +0000 (+0000) Subject: Try to do something if st_size, st_uid, st_gid are too big for an IV; X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=887d29384f0bc4b6197573ce19ff42abfe67fa51;p=p5sagit%2Fp5-mst-13.2.git Try to do something if st_size, st_uid, st_gid are too big for an IV; regen Configure. p4raw-id: //depot/cfgperl@4548 --- diff --git a/Configure b/Configure index 202fa98..ce7b9b8 100755 --- a/Configure +++ b/Configure @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Sun Nov 7 14:31:41 EET 1999 [metaconfig 3.0 PL70] +# Generated on Thu Nov 11 21:36:00 EET 1999 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.com) cat >/tmp/c1$$ <&4 +cat > try.c < +#include +int main() { + printf("%d\n", (int)sizeof($sizetype)); + exit(0); +} +EOCP +set try +if eval $compile_ok; then + yyy=`./try` + case "$yyy" in + '') sizesize=4 + echo "(I can't execute the test program--guessing $sizesize.)" >&4 + ;; + *) sizesize=$yyy + echo "Your $zzz size is $sizesize bytes." + ;; + esac +else + sizesize=4 + echo "(I can't compile the test program--guessing $sizesize.)" >&4 +fi + + : see what type is used for signed size_t set ssize_t ssizetype int stdio.h sys/types.h eval $typedef @@ -14679,6 +14711,7 @@ sitelib='$sitelib' sitelibexp='$sitelibexp' siteprefix='$siteprefix' siteprefixexp='$siteprefixexp' +sizesize='$sizesize' sizetype='$sizetype' sleep='$sleep' smail='$smail' diff --git a/Porting/Glossary b/Porting/Glossary index fe7d62a..3d29644 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -4,6 +4,33 @@ programs (e.g. I_UNISTD) are already described in config_h.SH. [`configpm' generates pod documentation for Config.pm from this file--please try to keep the formatting regular.] +CONFIGDOTSH (Oldsyms.U): + This is set to 'true' in config.sh so that a shell script + sourcing config.sh can tell if it has been sourced already. + +Mcc (Loc.U): + This variable is used internally by Configure to determine the + full pathname (if any) of the Mcc program. After Configure runs, + the value is reset to a plain "Mcc" and is not useful. + +PERL_APIVERSION (Oldsyms.U): + This value is manually set in patchlevel.h and is used + to set the Configure apiversion variable. + +PERL_REVISION (Oldsyms.U): + In a Perl version number such as 5.6.2, this is the 5. + This value is manually set in patchlevel.h + +PERL_SUBVERSION (Oldsyms.U): + In a Perl version number such as 5.6.2, this is the 2. + Values greater than 50 represent potentially unstable + development subversions. + This value is manually set in patchlevel.h + +PERL_VERSION (Oldsyms.U): + In a Perl version number such as 5.6.2, this is the 6. + This value is manually set in patchlevel.h + _a (Unix.U): This variable defines the extension used for ordinary libraries. For unix, it is '.a'. The '.' is included. Other possible @@ -206,10 +233,6 @@ compress (Loc.U): This variable is defined but not used by Configure. The value is a plain '' and is not useful. -CONFIGDOTSH (Oldsyms.U): - This is set to 'true' in config.sh so that a shell script - sourcing config.sh can tell if it has been sourced already. - contains (contains.U): This variable holds the command to do a grep with a proper return status. On most sane systems it is simply "grep". On insane systems @@ -289,6 +312,64 @@ csh (Loc.U): full pathname (if any) of the csh program. After Configure runs, the value is reset to a plain "csh" and is not useful. +d_Gconvert (d_gconvert.U): + This variable holds what Gconvert is defined as to convert + floating point numbers into strings. It could be 'gconvert' + or a more complex macro emulating gconvert with gcvt() or sprintf. + Possible values are: + d_Gconvert='gconvert((x),(n),(t),(b))' + d_Gconvert='gcvt((x),(n),(b))' + d_Gconvert='sprintf((b),"%.*g",(n),(x))' + +d_PRIEldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIFldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIGldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIX64 (quadfio.U): + This variable conditionally defines the PERL_PRIX64 symbol, which + indiciates that stdio has a symbol to print 64-bit hExADECimAl numbers. + +d_PRId64 (quadfio.U): + This variable conditionally defines the PERL_PRId64 symbol, which + indiciates that stdio has a symbol to print 64-bit decimal numbers. + +d_PRIeldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIfldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIgldbl (longdblfio.U): + This variable conditionally defines the PERL_PRIfldlbl symbol, which + indiciates that stdio has a symbol to print long doubles. + +d_PRIi64 (quadfio.U): + This variable conditionally defines the PERL_PRIi64 symbol, which + indiciates that stdio has a symbol to print 64-bit decimal numbers. + +d_PRIo64 (quadfio.U): + This variable conditionally defines the PERL_PRIo64 symbol, which + indiciates that stdio has a symbol to print 64-bit octal numbers. + +d_PRIu64 (quadfio.U): + This variable conditionally defines the PERL_PRIu64 symbol, which + indiciates that stdio has a symbol to print 64-bit unsigned decimal + numbers. + +d_PRIx64 (quadfio.U): + This variable conditionally defines the PERL_PRIx64 symbol, which + indiciates that stdio has a symbol to print 64-bit hexadecimal numbers. + d_access (d_access.U): This variable conditionally defines HAS_ACCESS if the access() system call is available to check for access permissions using real IDs. @@ -567,15 +648,6 @@ d_ftime (d_ftime.U): that the ftime() routine exists. The ftime() routine is basically a sub-second accuracy clock. -d_Gconvert (d_gconvert.U): - This variable holds what Gconvert is defined as to convert - floating point numbers into strings. It could be 'gconvert' - or a more complex macro emulating gconvert with gcvt() or sprintf. - Possible values are: - d_Gconvert='gconvert((x),(n),(t),(b))' - d_Gconvert='gcvt((x),(n),(b))' - d_Gconvert='sprintf((b),"%.*g",(n),(x))' - d_getgrent (d_getgrent.U): This variable conditionally defines the HAS_GETGRENT symbol, which indicates to the C program that the getgrent() routine is available @@ -962,55 +1034,6 @@ d_portable (d_portable.U): indicates to the C program that it should not assume that it is running on the machine it was compiled on. -d_PRId64 (quadfio.U): - This variable conditionally defines the PERL_PRId64 symbol, which - indiciates that stdio has a symbol to print 64-bit decimal numbers. - -d_PRIeldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIEldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIfldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIFldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIgldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIGldbl (longdblfio.U): - This variable conditionally defines the PERL_PRIfldlbl symbol, which - indiciates that stdio has a symbol to print long doubles. - -d_PRIi64 (quadfio.U): - This variable conditionally defines the PERL_PRIi64 symbol, which - indiciates that stdio has a symbol to print 64-bit decimal numbers. - -d_PRIo64 (quadfio.U): - This variable conditionally defines the PERL_PRIo64 symbol, which - indiciates that stdio has a symbol to print 64-bit octal numbers. - -d_PRIu64 (quadfio.U): - This variable conditionally defines the PERL_PRIu64 symbol, which - indiciates that stdio has a symbol to print 64-bit unsigned decimal - numbers. - -d_PRIx64 (quadfio.U): - This variable conditionally defines the PERL_PRIx64 symbol, which - indiciates that stdio has a symbol to print 64-bit hexadecimal numbers. - -d_PRIX64 (quadfio.U): - This variable conditionally defines the PERL_PRIX64 symbol, which - indiciates that stdio has a symbol to print 64-bit hExADECimAl numbers. - d_pthread_yield (d_pthread_y.U): This variable conditionally defines the HAS_PTHREAD_YIELD symbol if the pthread_yield routine is available to yield @@ -1611,6 +1634,10 @@ extensions (Extensions.U): and is typically used to test whether a particular extesion is available. +fflushNULL (fflushall.U): + This symbol, if defined, tells that fflush(NULL) does flush + all pending stdio output. + fflushall (fflushall.U): This symbol, if defined, tells that to flush all pending stdio output one must loop through all @@ -1618,10 +1645,6 @@ fflushall (fflushall.U): Note that if fflushNULL is defined, fflushall will not even be probed for and will be left undefined. -fflushNULL (fflushall.U): - This symbol, if defined, tells that fflush(NULL) does flush - all pending stdio output. - find (Loc.U): This variable is defined but not used by Configure. The value is a plain '' and is not useful. @@ -2390,11 +2413,6 @@ man3ext (man3dir.U): have: one of 'n', 'l', or '3'. The Makefile must supply the '.'. See man3dir. -Mcc (Loc.U): - This variable is used internally by Configure to determine the - full pathname (if any) of the Mcc program. After Configure runs, - the value is reset to a plain "Mcc" and is not useful. - medium (models.U): This variable contains a flag which will tell the C compiler and loader to produce a program running with a medium memory model. If the @@ -2578,24 +2596,6 @@ perl (Loc.U): This variable is defined but not used by Configure. The value is a plain '' and is not useful. -PERL_APIVERSION (Oldsyms.U): - This value is manually set in patchlevel.h and is used - to set the Configure apiversion variable. - -PERL_REVISION (Oldsyms.U): - In a Perl version number such as 5.6.2, this is the 5. - This value is manually set in patchlevel.h - -PERL_SUBVERSION (Oldsyms.U): - In a Perl version number such as 5.6.2, this is the 2. - Values greater than 50 represent potentially unstable - development subversions. - This value is manually set in patchlevel.h - -PERL_VERSION (Oldsyms.U): - In a Perl version number such as 5.6.2, this is the 6. - This value is manually set in patchlevel.h - perladmin (perladmin.U): Electronic mail address of the perl5 administrator. @@ -2722,6 +2722,54 @@ runnm (usenm.U): nm extraction should be performed or not, according to the value of usenm and the flags on the Configure command line. +sPRIEldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'E') for output. + +sPRIFldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'F') for output. + +sPRIGldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'G') for output. + +sPRIX64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit hExADECimAl numbers (format 'X') for output. + +sPRId64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit decimal numbers (format 'd') for output. + +sPRIeldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'e') for output. + +sPRIfldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'f') for output. + +sPRIgldbl (longdblfio.U): + This variable, if defined, contains the string used by stdio to + format long doubles (format 'g') for output. + +sPRIi64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit decimal numbers (format 'i') for output. + +sPRIo64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit octal numbers (format 'o') for output. + +sPRIu64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit unsigned decimal numbers (format 'u') for output. + +sPRIx64 (quadfio.U): + This variable, if defined, contains the string used by stdio to + format 64-bit hexadecimal numbers (format 'x') for output. + sched_yield (d_pthread_y.U): This variable defines the way to yield the execution of the current thread. @@ -2895,6 +2943,9 @@ siteprefixexp (siteprefix.U): This variable holds the full absolute path of the directory below which the user will install add-on packages. Derived from siteprefix. +sizesize (sizesize.U): + This variable contains the size of a sizetype in bytes. + sizetype (sizetype.U): This variable defines sizetype to be something like size_t, unsigned long, or whatever type is used to declare length @@ -2943,54 +2994,6 @@ split (models.U): machines that support separation of instruction and data space. It is up to the Makefile to use this. -sPRId64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit decimal numbers (format 'd') for output. - -sPRIeldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'e') for output. - -sPRIEldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'E') for output. - -sPRIfldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'f') for output. - -sPRIFldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'F') for output. - -sPRIgldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'g') for output. - -sPRIGldbl (longdblfio.U): - This variable, if defined, contains the string used by stdio to - format long doubles (format 'G') for output. - -sPRIi64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit decimal numbers (format 'i') for output. - -sPRIo64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit octal numbers (format 'o') for output. - -sPRIu64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit unsigned decimal numbers (format 'u') for output. - -sPRIx64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit hexadecimal numbers (format 'x') for output. - -sPRIX64 (quadfio.U): - This variable, if defined, contains the string used by stdio to - format 64-bit hExADECimAl numbers (format 'X') for output. - src (src.U): This variable holds the path to the package source. It is up to the Makefile to use this variable and set VPATH accordingly to diff --git a/Porting/config.sh b/Porting/config.sh index 0cc6182..b8ac069 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -8,7 +8,7 @@ # Package name : perl5 # Source directory : . -# Configuration time: Sat Oct 30 15:31:32 EET DST 1999 +# Configuration time: Thu Nov 11 21:42:49 EET 1999 # Configured by : jhi # Target system : osf1 alpha.hut.fi v4.0 878 alpha @@ -53,10 +53,10 @@ cc='cc' cccdlflags=' ' ccdlflags=' -Wl,-rpath,/opt/perl/lib/5.00563/alpha-dec_osf-thread/CORE' ccflags='-pthread -std -DLANGUAGE_C' -ccsymbols='__LANGUAGE_C__=1 _LONGLONG=1 LANGUAGE_C=1 SYSTYPE_BSD=1' +ccsymbols='LANGUAGE_C=1 SYSTYPE_BSD=1 _LONGLONG=1 __LANGUAGE_C__=1' cf_by='jhi' cf_email='yourname@yourhost.yourplace.com' -cf_time='Sat Oct 30 15:31:32 EET DST 1999' +cf_time='Thu Nov 11 21:42:49 EET 1999' charsize='1' chgrp='' chmod='' @@ -69,7 +69,7 @@ cp='cp' cpio='' cpp='cpp' cpp_stuff='42' -cppccsymbols='__alpha=1 __osf__=1 __unix__=1 _SYSTYPE_BSD=1 unix=1' +cppccsymbols='_SYSTYPE_BSD=1 __alpha=1 __osf__=1 __unix__=1 unix=1' cppflags='-pthread -std -DLANGUAGE_C' cpplast='' cppminus='' @@ -642,6 +642,7 @@ sitelib='/opt/perl/lib/site_perl' sitelibexp='/opt/perl/lib/site_perl' siteprefix='/opt/perl' siteprefixexp='/opt/perl' +sizesize='8' sizetype='size_t' sleep='' smail='' diff --git a/Porting/config_H b/Porting/config_H index d9881cc..d31265d 100644 --- a/Porting/config_H +++ b/Porting/config_H @@ -17,7 +17,7 @@ /* * Package name : perl5 * Source directory : . - * Configuration time: Sat Oct 30 15:31:32 EET DST 1999 + * Configuration time: Thu Nov 11 21:42:49 EET 1999 * Configured by : jhi * Target system : osf1 alpha.hut.fi v4.0 878 alpha */ @@ -2795,6 +2795,11 @@ */ #define Gid_t_f "u" /**/ +/* Gid_t_size: + * This symbol holds the size of a Gid_t in bytes. + */ +#define Gid_t_size 4 /* GID size */ + /* Gid_t: * This symbol holds the return type of getgid() and the type of * argument to setrgid() and related functions. Typically, @@ -2830,6 +2835,11 @@ */ #define Pid_t pid_t /* PID type */ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size 8 /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be @@ -2843,6 +2853,11 @@ */ #define Uid_t_f "u" /**/ +/* Uid_t_size: + * This symbol holds the size of a Uid_t in bytes. + */ +#define Uid_t_size 4 /* UID size */ + /* Uid_t: * This symbol holds the type used to declare user ids in the kernel. * It can be int, ushort, uid_t, etc... It may be necessary to include diff --git a/config_h.SH b/config_h.SH index 8e7115d..9d8deec 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2809,6 +2809,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Gid_t_f $gidformat /**/ +/* Gid_t_size: + * This symbol holds the size of a Gid_t in bytes. + */ +#define Gid_t_size $gidsize /* GID size */ + /* Gid_t: * This symbol holds the return type of getgid() and the type of * argument to setrgid() and related functions. Typically, @@ -2844,6 +2849,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Pid_t $pidtype /* PID type */ +/* Size_t_size: + * This symbol holds the size of a Size_t in bytes. + */ +#define Size_t_size $sizesize /* */ + /* Size_t: * This symbol holds the type used to declare length parameters * for string functions. It is usually size_t, but may be @@ -2857,6 +2867,11 @@ sed <config.h -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un- */ #define Uid_t_f $uidformat /**/ +/* Uid_t_size: + * This symbol holds the size of a Uid_t in bytes. + */ +#define Uid_t_size $uidsize /* UID size */ + /* Uid_t: * This symbol holds the type used to declare user ids in the kernel. * It can be int, ushort, uid_t, etc... It may be necessary to include diff --git a/pp_sys.c b/pp_sys.c index 267070e..d370a4c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -2463,14 +2463,26 @@ PP(pp_stat) PUSHs(sv_2mortal(newSViv(PL_statcache.st_ino))); PUSHs(sv_2mortal(newSViv(PL_statcache.st_mode))); PUSHs(sv_2mortal(newSViv(PL_statcache.st_nlink))); +#if Uid_t_size > IVSIZE + PUSHs(sv_2mortal(newSVnv(PL_statcache.st_uid))); +#else PUSHs(sv_2mortal(newSViv(PL_statcache.st_uid))); +#endif +#if Gid_t_size > IVSIZE + PUSHs(sv_2mortal(newSVnv(PL_statcache.st_gid))); +#else PUSHs(sv_2mortal(newSViv(PL_statcache.st_gid))); +#endif #ifdef USE_STAT_RDEV PUSHs(sv_2mortal(newSViv(PL_statcache.st_rdev))); #else PUSHs(sv_2mortal(newSVpvn("", 0))); #endif +#if Size_t_size > IVSIZE + PUSHs(sv_2mortal(newSVnv(PL_statcache.st_size))); +#else PUSHs(sv_2mortal(newSViv(PL_statcache.st_size))); +#endif #ifdef BIG_TIME PUSHs(sv_2mortal(newSVnv(PL_statcache.st_atime))); PUSHs(sv_2mortal(newSVnv(PL_statcache.st_mtime))); @@ -2673,7 +2685,8 @@ PP(pp_ftrowned) djSP; if (result < 0) RETPUSHUNDEF; - if (PL_statcache.st_uid == (PL_op->op_type == OP_FTEOWNED ? PL_euid : PL_uid) ) + if (PL_statcache.st_uid == (PL_op->op_type == OP_FTEOWNED ? + PL_euid : PL_uid) ) RETPUSHYES; RETPUSHNO; } @@ -2684,7 +2697,7 @@ PP(pp_ftzero) djSP; if (result < 0) RETPUSHUNDEF; - if (!PL_statcache.st_size) + if (PL_statcache.st_size == 0) RETPUSHYES; RETPUSHNO; } @@ -2695,7 +2708,11 @@ PP(pp_ftsize) djSP; dTARGET; if (result < 0) RETPUSHUNDEF; +#ifdef Size_t_size > IVSISE + PUSHn(PL_statcache.st_size); +#else PUSHi(PL_statcache.st_size); +#endif RETURN; } @@ -2896,6 +2913,7 @@ PP(pp_fttext) register SV *sv; GV *gv; STRLEN n_a; + PerlIO *fp; if (PL_op->op_flags & OPf_REF) gv = (GV*)cSVOP->op_sv; @@ -2960,21 +2978,19 @@ PP(pp_fttext) PL_statgv = Nullgv; PL_laststatval = -1; sv_setpv(PL_statname, SvPV(sv, n_a)); -#ifdef HAS_OPEN3 - i = PerlLIO_open3(SvPV(sv, n_a), O_RDONLY, 0); -#else - i = PerlLIO_open(SvPV(sv, n_a), 0); -#endif - if (i < 0) { + if (!(fp = PerlIO_open(SvPVX(PL_statname), "r"))) { if (ckWARN(WARN_NEWLINE) && strchr(SvPV(sv, n_a), '\n')) Perl_warner(aTHX_ WARN_NEWLINE, PL_warn_nl, "open"); RETPUSHUNDEF; } - PL_laststatval = PerlLIO_fstat(i, &PL_statcache); - if (PL_laststatval < 0) + PL_laststatval = PerlLIO_fstat(PerlIO_fileno(fp), &PL_statcache); + if (PL_laststatval < 0) { + (void)PerlIO_close(fp); RETPUSHUNDEF; - len = PerlLIO_read(i, tbuf, 512); - (void)PerlLIO_close(i); + } + do_binmode(fp, '<', TRUE); + len = PerlIO_read(fp, tbuf, sizeof(tbuf)); + (void)PerlIO_close(fp); if (len <= 0) { if (S_ISDIR(PL_statcache.st_mode) && PL_op->op_type == OP_FTTEXT) RETPUSHNO; /* special case NFS directories */ @@ -2986,6 +3002,12 @@ PP(pp_fttext) /* now scan s to look for textiness */ /* XXX ASCII dependent code */ +#if defined(DOSISH) || defined(USEMYBINMODE) + /* ignore trailing ^Z on short files */ + if (len && len < sizeof(tbuf) && tbuf[len-1] == 26) + --len; +#endif + for (i = 0; i < len; i++, s++) { if (!*s) { /* null never allowed in text */ odd += len; @@ -2995,8 +3017,12 @@ PP(pp_fttext) else if (!(isPRINT(*s) || isSPACE(*s))) odd++; #else - else if (*s & 128) - odd++; + else if (*s & 128) { +#ifdef USE_LOCALE + if (!(PL_op->op_private & OPpLOCALE) || !isALPHA_LC(*s)) +#endif + odd++; + } else if (*s < 32 && *s != '\n' && *s != '\r' && *s != '\b' && *s != '\t' && *s != '\f' && *s != 27)