diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-21 00:46:14 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-21 00:46:14 +0000 |
commit | 2d5e9e5d1dfda924cd025894f9c8781ba03c3c8c (patch) | |
tree | 1a13ca1cdda52d63b3c96fa0314f77a006b95a58 /ext/File | |
parent | a83e3d3ce76b34dfbf0c18f74b132c113d546c4a (diff) | |
download | perl-2d5e9e5d1dfda924cd025894f9c8781ba03c3c8c.tar.gz |
Integrate changes #9262,9264,9265,9266 from maintperl to mainline.
revert the leak fix in change#9142 (problem needs a more experimental
fix unsuitable for 5.6.1)
do alphabetical sorting by default (for csh compatibility)
cut-n-paste goof in change#9264
VMS piping fixes (from Charles Lane)
p4raw-link: @9266 on //depot/maint-5.6/perl: 72d1c956969523b19a71b5ffb5af9479f09d0e6a
p4raw-link: @9265 on //depot/maint-5.6/perl: 8549c3fc2da30e970df00a46a796a39e843777aa
p4raw-link: @9264 on //depot/maint-5.6/perl: 1086ad2319c3ee3e3873c478e76309ea4f03453b
p4raw-link: @9262 on //depot/maint-5.6/perl: a89eb504d1201e0dad09aaf86db07d000904f216
p4raw-link: @9142 on //depot/maint-5.6/perl: 26972843796e21c404c9d13ec5ee86e7b952a2bd
p4raw-id: //depot/perl@9269
p4raw-integrated: from //depot/maint-5.6/perl@9268 'copy in'
ext/File/Glob/Changes ext/File/Glob/bsd_glob.c
ext/File/Glob/bsd_glob.h (@5902..) ext/File/Glob/Glob.pm
(@7770..) vms/vmspipe.com (@8636..) vms/vms.c (@8986..) 'edit
in' ext/File/Glob/Glob.xs (@9264..) 'merge in' scope.c
(@9142..)
Diffstat (limited to 'ext/File')
-rw-r--r-- | ext/File/Glob/Changes | 2 | ||||
-rw-r--r-- | ext/File/Glob/Glob.pm | 24 | ||||
-rw-r--r-- | ext/File/Glob/Glob.xs | 6 | ||||
-rw-r--r-- | ext/File/Glob/bsd_glob.c | 6 | ||||
-rw-r--r-- | ext/File/Glob/bsd_glob.h | 1 |
5 files changed, 36 insertions, 3 deletions
diff --git a/ext/File/Glob/Changes b/ext/File/Glob/Changes index e246c6d684..f46ec704e9 100644 --- a/ext/File/Glob/Changes +++ b/ext/File/Glob/Changes @@ -45,3 +45,5 @@ Revision history for Perl extension File::Glob - Add support for either \ or / as separators on DOSISH systems - Limit effect of \ as a quoting operator on DOSISH systems to when it precedes one of []{}-~\ (to minimise backslashitis). +0.992 Tue Mar 20 09:25:48 2001 + - Add alphabetic sorting for csh compatibility (GLOB_ALPHASORT) diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm index 57bfa0d1c1..76adbe7b3d 100644 --- a/ext/File/Glob/Glob.pm +++ b/ext/File/Glob/Glob.pm @@ -19,6 +19,7 @@ require AutoLoader; bsd_glob glob GLOB_ABEND + GLOB_ALPHASORT GLOB_ALTDIRFUNC GLOB_BRACE GLOB_CSH @@ -37,6 +38,7 @@ require AutoLoader; %EXPORT_TAGS = ( 'glob' => [ qw( GLOB_ABEND + GLOB_ALPHASORT GLOB_ALTDIRFUNC GLOB_BRACE GLOB_CSH @@ -104,7 +106,13 @@ sub GLOB_ERROR { return constant('GLOB_ERROR', 0); } -sub GLOB_CSH () { GLOB_BRACE() | GLOB_NOMAGIC() | GLOB_QUOTE() | GLOB_TILDE() } +sub GLOB_CSH () { + GLOB_BRACE() + | GLOB_NOMAGIC() + | GLOB_QUOTE() + | GLOB_TILDE() + | GLOB_ALPHASORT() +} $DEFAULT_FLAGS = GLOB_CSH(); if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos|MacOS)$/) { @@ -288,7 +296,7 @@ Expand patterns that start with '~' to user name home directories. =item C<GLOB_CSH> For convenience, C<GLOB_CSH> is a synonym for -C<GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE>. +C<GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE | GLOB_ALPHASORT>. =back @@ -297,6 +305,18 @@ extensions C<GLOB_ALTDIRFUNC>, and C<GLOB_MAGCHAR> flags have not been implemented in the Perl version because they involve more complex interaction with the underlying C structures. +The following flag has been added in the Perl implementation for +csh compatibility: + +=over 4 + +=item C<GLOB_ALPHASORT> + +If C<GLOB_NOSORT> is not in effect, sort filenames is alphabetical +order (case does not matter) rather than in ASCII order. + +=back + =head1 DIAGNOSTICS bsd_glob() returns a list of matching paths, possibly zero length. If an diff --git a/ext/File/Glob/Glob.xs b/ext/File/Glob/Glob.xs index a21fe84f35..ee8c0c9751 100644 --- a/ext/File/Glob/Glob.xs +++ b/ext/File/Glob/Glob.xs @@ -21,6 +21,12 @@ constant(char *name, int arg) #else goto not_there; #endif + if (strEQ(name, "GLOB_ALPHASORT")) +#ifdef GLOB_ALPHASORT + return GLOB_ALPHASORT; +#else + goto not_there; +#endif if (strEQ(name, "GLOB_ALTDIRFUNC")) #ifdef GLOB_ALTDIRFUNC return GLOB_ALTDIRFUNC; diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c index 62bfe4f80c..55f8312186 100644 --- a/ext/File/Glob/bsd_glob.c +++ b/ext/File/Glob/bsd_glob.c @@ -57,6 +57,9 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; * expand {1,2}{a,b} to 1a 1b 2a 2b * gl_matchc: * Number of matches in the current invocation of glob. + * GLOB_ALPHASORT: + * sort alphabetically like csh (case doesn't matter) instead of in ASCII + * order */ #include <EXTERN.h> @@ -531,7 +534,8 @@ glob0(const Char *pattern, glob_t *pglob) else if (!(pglob->gl_flags & GLOB_NOSORT)) qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), - (pglob->gl_flags & GLOB_NOCASE) ? ci_compare : compare); + (pglob->gl_flags & (GLOB_ALPHASORT|GLOB_NOCASE)) + ? ci_compare : compare); pglob->gl_flags = oldflags; return(0); } diff --git a/ext/File/Glob/bsd_glob.h b/ext/File/Glob/bsd_glob.h index 10d1de534c..5d04fff1c3 100644 --- a/ext/File/Glob/bsd_glob.h +++ b/ext/File/Glob/bsd_glob.h @@ -72,6 +72,7 @@ typedef struct { #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ #define GLOB_NOCASE 0x1000 /* Treat filenames without regard for case. */ +#define GLOB_ALPHASORT 0x2000 /* Alphabetic, not ASCII sort, like csh. */ #define GLOB_NOSPACE (-1) /* Malloc call failed. */ #define GLOB_ABEND (-2) /* Unignored error. */ |