Change 33240 by [EMAIL PROTECTED] on 2008/02/06 03:21:15
VMS glob() fix-ups adapted for maint-5.8 from 30813 and 32329.
Affected files ...
... //depot/maint-5.8/perl/doio.c#116 edit
Differences ...
==== //depot/maint-5.8/perl/doio.c#116 (text) ====
Index: perl/doio.c
--- perl/doio.c#115~33217~ 2008-02-02 14:47:50.000000000 -0800
+++ perl/doio.c 2008-02-05 19:21:15.000000000 -0800
@@ -2331,6 +2331,7 @@
}
}
if ((tmpfp = PerlIO_tmpfile()) != NULL) {
+ int found = 0;
Stat_t st;
if (!PerlLIO_stat(SvPVX_const(tmpglob),&st) && S_ISDIR(st.st_mode))
ok = ((wilddsc.dsc$a_pointer = tovmspath((char
*)SvPVX_const(tmpglob),vmsspec)) != NULL);
@@ -2340,6 +2341,8 @@
if (*cp == '?') *cp = '%'; /* VMS style single-char wildcard */
while (ok && ((sts = lib$find_file(&wilddsc,&rsdsc,&cxt,
&dfltdsc,NULL,NULL,NULL))&1)) {
+
+ found++;
/* with varying string, 1st word of buffer contains result
length */
end = rstr + *((unsigned short int*)rslt);
if (!hasver) while (*end != ';' && end > rstr) end--;
@@ -2357,6 +2360,14 @@
ok = (PerlIO_puts(tmpfp,begin) != EOF);
}
if (cxt) (void)lib$find_file_end(&cxt);
+
+ if (!found) {
+ /* Be POSIXish: return the input pattern when no matches */
+ strcpy(rstr,SvPVX(tmpglob));
+ strcat(rstr,"\n");
+ ok = (PerlIO_puts(tmpfp,rstr) != EOF);
+ }
+
if (ok && sts != RMS$_NMF &&
sts != RMS$_DNF && sts != RMS_FNF) ok = 0;
if (!ok) {
End of Patch.