From: Craig A. Berry Date: Sat, 31 Mar 2007 19:40:43 +0000 (+0000) Subject: Make Perl_vms_start_glob return the input pattern when there are X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=990cad080381a986101694ccc088bbec763448c6;p=p5sagit%2Fp5-mst-13.2.git Make Perl_vms_start_glob return the input pattern when there are no matches. p4raw-id: //depot/perl@30813 --- diff --git a/vms/vms.c b/vms/vms.c index f8f79f1..650db58 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -11961,6 +11961,7 @@ Perl_vms_start_glob } } if ((tmpfp = PerlIO_tmpfile()) != NULL) { + int found = 0; Stat_t st; int stat_sts; stat_sts = PerlLIO_stat(SvPVX_const(tmpglob),&st); @@ -11991,6 +11992,8 @@ Perl_vms_start_glob if (!$VMS_STATUS_SUCCESS(sts)) break; + found++; + /* with varying string, 1st word of buffer contains result length */ rstr[rslt->length] = '\0'; @@ -12038,6 +12041,14 @@ Perl_vms_start_glob 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 */ + begin = SvPVX(tmpglob); + strcat(begin,"\n"); + ok = (PerlIO_puts(tmpfp,begin) != EOF); + } + if (ok && sts != RMS$_NMF && sts != RMS$_DNF && sts != RMS_FNF) ok = 0; if (!ok) {