From: Charles Bailey Date: Thu, 2 Mar 2000 03:50:53 +0000 (+0000) Subject: Make File::Glob more VMS-friendly (Charles Lane) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eed98e348d85043d0e6183a2db5c1a77d998d259;p=p5sagit%2Fp5-mst-13.2.git Make File::Glob more VMS-friendly (Charles Lane) p4raw-id: //depot/vmsperl@5419 --- diff --git a/ext/File/Glob/Glob.pm b/ext/File/Glob/Glob.pm index f703a0b..a8e0262 100644 --- a/ext/File/Glob/Glob.pm +++ b/ext/File/Glob/Glob.pm @@ -109,7 +109,12 @@ if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos|MacOS)$/) { # Autoload methods go after =cut, and are processed by the autosplit program. sub glob { - return doglob(@_); + my $pat = shift; + my $flags = shift; + if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos|MacOS)$/) { + $flags |= GLOB_NOCASE(); + } + return doglob($pat,$flags); } ## borrowed heavily from gsar's File::DosGlob diff --git a/ext/File/Glob/bsd_glob.c b/ext/File/Glob/bsd_glob.c index c422d60..c64d72b 100644 --- a/ext/File/Glob/bsd_glob.c +++ b/ext/File/Glob/bsd_glob.c @@ -658,6 +658,19 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, *pathend = BG_EOS; errno = 0; +#ifdef VMS + { + Char *q = pathend; + if (q - pathbuf > 5) { + q -= 5; + if (q[0] == '.' && tolower(q[1]) == 'd' && tolower(q[2]) == 'i' && tolower(q[3]) == 'r' && q[4] == '/') { + q[0] = '/'; + q[1] = BG_EOS; + pathend = q+1; + } + } + } +#endif if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { /* TODO: don't call for ENOENT or ENOTDIR? */ if (pglob->gl_errfunc) { diff --git a/t/lib/glob-basic.t b/t/lib/glob-basic.t index ac3abf5..2336fc0 100755 --- a/t/lib/glob-basic.t +++ b/t/lib/glob-basic.t @@ -38,7 +38,7 @@ print "ok 2\n"; # look up the user's home directory # should return a list with one item, and not set ERROR -if ($^O ne 'MSWin32') { +if ($^O ne 'MSWin32' || $^O ne 'VMS') { eval { ($name, $home) = (getpwuid($>))[0,7]; 1; @@ -72,7 +72,7 @@ print "ok 5\n"; # check bad protections # should return an empty list, and set ERROR -if ($^O eq 'mpeix' or $^O eq 'MSWin32' or $^O eq 'os2' or not $>) { +if ($^O eq 'mpeix' or $^O eq 'MSWin32' or $^O eq 'os2' or $^O eq 'VMS' or not $>) { print "ok 6 # skipped\n"; } else { @@ -99,7 +99,7 @@ print "ok 7\n"; GLOB_BRACE | GLOB_NOMAGIC ); unless (@a == 3 - and $a[0] eq 'TEST' + and $a[0] eq ($^O eq 'VMS'? 'test.' : 'TEST') and $a[1] eq 'a' and $a[2] eq 'b') {