summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorCharles Bailey <bailey@newman.upenn.edu>2000-03-13 02:22:24 +0000
committerbailey <bailey@newman.upenn.edu>2000-03-13 02:22:24 +0000
commitfd7385b97d6c0b537b272f194ad6f88a70d3dd39 (patch)
tree4e33f10565631f91810eef7fab55ac92a9eff57b /vms
parent8b164fe9e6e17b9edd1002c0e27f58b222c9eb43 (diff)
downloadperl-fd7385b97d6c0b537b272f194ad6f88a70d3dd39.tar.gz
Update File::Spec::VMS and tests
Since reduce_ricochet has been removed from File::Spec, revert changes to VMS::Filespec::vmsify made to accomodate it. p4raw-id: //depot/vmsperl@5689
Diffstat (limited to 'vms')
-rw-r--r--vms/ext/filespec.t4
-rw-r--r--vms/vms.c30
2 files changed, 26 insertions, 8 deletions
diff --git a/vms/ext/filespec.t b/vms/ext/filespec.t
index 31c476a8e6..779396be73 100644
--- a/vms/ext/filespec.t
+++ b/vms/ext/filespec.t
@@ -86,7 +86,7 @@ some:[where.over]the.rainbow unixify /some/where/over/the.rainbow
/some/where/over/the.rainbow vmsify some:[where.over]the.rainbow
some/where/over/the.rainbow vmsify [.some.where.over]the.rainbow
../some/where/over/the.rainbow vmsify [-.some.where.over]the.rainbow
-some/../../where/over/the.rainbow vmsify [.some.--.where.over]the.rainbow
+some/../../where/over/the.rainbow vmsify [-.where.over]the.rainbow
.../some/where/over/the.rainbow vmsify [...some.where.over]the.rainbow
some/.../where/over/the.rainbow vmsify [.some...where.over]the.rainbow
/some/.../where/over/the.rainbow vmsify some:[...where.over]the.rainbow
@@ -139,7 +139,7 @@ path vmspath [.path]
/ vmspath sys$disk:[000000]
# Redundant characters in Unix paths
-//some/where//over/../the.rainbow vmsify some:[where.over.-]the.rainbow
+//some/where//over/../the.rainbow vmsify some:[where]the.rainbow
/some/where//over/./the.rainbow vmsify some:[where.over]the.rainbow
..//../ vmspath [--]
./././ vmspath []
diff --git a/vms/vms.c b/vms/vms.c
index e465bfc710..f7edca7df0 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -103,7 +103,7 @@ int
vmstrnenv(const char *lnm, char *eqv, unsigned long int idx,
struct dsc$descriptor_s **tabvec, unsigned long int flags)
{
- char uplnm[LNM$C_NAMLENGTH], *cp1, *cp2;
+ char uplnm[LNM$C_NAMLENGTH+1], *cp1, *cp2;
unsigned short int eqvlen, curtab, ivlnm = 0, ivsym = 0, ivenv = 0, secure;
unsigned long int retsts, attr = LNM$M_CASE_BLIND;
unsigned char acmode;
@@ -138,6 +138,7 @@ vmstrnenv(const char *lnm, char *eqv, unsigned long int idx,
}
lnmdsc.dsc$w_length = cp1 - lnm;
lnmdsc.dsc$a_pointer = uplnm;
+ uplnm[lnmdsc.dsc$w_length] = '\0';
secure = flags & PERL__TRNENV_SECURE;
acmode = secure ? PSL$C_EXEC : PSL$C_USER;
if (!tabvec || !*tabvec) tabvec = env_tables;
@@ -207,6 +208,19 @@ vmstrnenv(const char *lnm, char *eqv, unsigned long int idx,
retsts = sys$trnlnm(&attr,tabvec[curtab],&lnmdsc,&acmode,lnmlst);
if (retsts == SS$_IVLOGNAM) { ivlnm = 1; continue; }
if (retsts == SS$_NOLOGNAM) continue;
+ /* PPFs have a prefix */
+ if (
+#if INTSIZE == 4
+ *((int *)uplnm) == *((int *)"SYS$") &&
+#endif
+ eqvlen >= 4 && eqv[0] == 0x1b && eqv[1] == 0x00 &&
+ ( (uplnm[4] == 'O' && !strcmp(uplnm,"SYS$OUTPUT")) ||
+ (uplnm[4] == 'I' && !strcmp(uplnm,"SYS$INPUT")) ||
+ (uplnm[4] == 'E' && !strcmp(uplnm,"SYS$ERROR")) ||
+ (uplnm[4] == 'C' && !strcmp(uplnm,"SYS$COMMAND")) ) ) {
+ memcpy(eqv,eqv+4,eqvlen-4);
+ eqvlen -= 4;
+ }
break;
}
}
@@ -2160,12 +2174,16 @@ static char *do_tovmsspec(char *path, char *buf, int ts) {
else if (!infront && *cp2 == '.') {
if (cp2+1 == dirend || *(cp2+1) == '\0') { cp2++; break; }
else if (*(cp2+1) == '/') cp2++; /* skip over "./" - it's redundant */
- else if (*(cp2+1) == '.' && (*(cp2+2) == '/' || *(cp2+2) == '\0')) { /* handle "../" */
- if (*(cp1-1) == '-' || *(cp1-1) == '[') *(cp1++) = '-';
+ else if (*(cp2+1) == '.' && (*(cp2+2) == '/' || *(cp2+2) == '\0')) {
+ if (*(cp1-1) == '-' || *(cp1-1) == '[') *(cp1++) = '-'; /* handle "../" */
else if (*(cp1-2) == '[') *(cp1-1) = '-';
- else {
-/* if (*(cp1-1) != '.') *(cp1++) = '.'; */
- *(cp1++) = '-';
+ else { /* back up over previous directory name */
+ cp1--;
+ while (*(cp1-1) != '.' && *(cp1-1) != '[') cp1--;
+ if (*(cp1-1) == '[') {
+ memcpy(cp1,"000000.",7);
+ cp1 += 7;
+ }
}
cp2 += 2;
if (cp2 == dirend) break;