This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
consolidated VMS patches (from Craig A. Berry
[perl5.git] / ext / File / Glob / bsd_glob.c
index c422d60..62bfe4f 100644 (file)
@@ -658,6 +658,21 @@ 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) {