Don't let the home-grown readdir() on VMS return results with
Craig A. Berry [Fri, 15 Jun 2007 03:19:46 +0000 (03:19 +0000)]
ODS-5 escapes (i.e., report foo.tar.gz, not foo^.tar.gz).

p4raw-id: //depot/perl@31385

vms/vms.c

index f9aa9a3..aaaa869 100644 (file)
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -8759,9 +8759,6 @@ Perl_opendir(pTHX_ const char *name)
     DIR *dd;
     char *dir;
     Stat_t sb;
-    int unix_flag = 0;
-
-    unix_flag = is_unix_filespec(name);
 
     Newx(dir, VMS_MAXRSS, char);
     if (do_tovmspath(name,dir,0,NULL) == NULL) {
@@ -8792,8 +8789,12 @@ Perl_opendir(pTHX_ const char *name)
     dd->context = 0;
     dd->count = 0;
     dd->flags = 0;
-    if (unix_flag)
-       dd->flags = PERL_VMSDIR_M_UNIXSPECS;
+    /* By saying we always want the result of readdir() in unix format, we 
+     * are really saying we want all the escapes removed.  Otherwise the caller,
+     * having no way to know whether it's already in VMS format, might send it
+     * through tovmsspec again, thus double escaping.
+     */
+    dd->flags = PERL_VMSDIR_M_UNIXSPECS;
     dd->pat.dsc$a_pointer = dd->pattern;
     dd->pat.dsc$w_length = strlen(dd->pattern);
     dd->pat.dsc$b_dtype = DSC$K_DTYPE_T;