1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!./perl
use VMS::Filespec;
foreach (<DATA>) {
chomp;
s/\s*#.*//;
next if /^\s*$/;
push(@tests,$_);
}
print '1..',scalar(@tests)+3,"\n";
foreach $test (@tests) {
($arg,$func,$expect) = split(/\t+/,$test);
$idx++;
$rslt = eval "$func('$arg')";
if ($@) { print "not ok $idx : eval error: $@\n"; next; }
else {
if ($rslt ne $expect) {
print "not ok $idx : $func('$arg') expected |$expect|, got |$rslt|\n";
}
else { print "ok $idx\n"; }
}
}
print +(rmsexpand('[]') eq "\U$ENV{DEFAULT}" ? 'ok ' : 'not ok '),++$idx,"\n";
print +(rmsexpand('from.here') eq "\L$ENV{DEFAULT}from.here" ?
'ok ' : 'not ok '),++$idx,"\n";
print +(rmsexpand('from.here','cant:[get.there];2') eq
'cant:[get.there]from.here;2' ? 'ok ' : 'not ok '),++$idx,"\n";
__DATA__
# Basic VMS to Unix filespecs
some:[where.over]the.rainbow unixify /some/where/over/the.rainbow
[.some.where.over]the.rainbow unixify some/where/over/the.rainbow
[-.some.where.over]the.rainbow unixify ../some/where/over/the.rainbow
[.some.--.where.over]the.rainbow unixify some/../../where/over/the.rainbow
[.some...where.over]the.rainbow unixify some/.../where/over/the.rainbow
[...some.where.over]the.rainbow unixify .../some/where/over/the.rainbow
[.some.where.over...]the.rainbow unixify some/where/over/.../the.rainbow
[.some.where.over...] unixify some/where/over/.../
[.some.where.over.-] unixify some/where/over/../
[] unixify ./
[-] unixify ../
[--] unixify ../../
[...] unixify .../
# and back again
/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
some/where/... vmsify [.some.where...]
/where/... vmsify where:[...]
. vmsify []
.. vmsify [-]
../.. vmsify [--]
.../ vmsify [...]
# Fileifying directory specs
down:[the.garden.path] fileify down:[the.garden]path.dir;1
[.down.the.garden.path] fileify [.down.the.garden]path.dir;1
/down/the/garden/path fileify /down/the/garden/path.dir;1
/down/the/garden/path/ fileify /down/the/garden/path.dir;1
down/the/garden/path fileify down/the/garden/path.dir;1
down:[the.garden]path fileify down:[the.garden]path.dir;1
down:[the.garden]path. fileify # N.B. trailing . ==> null type
down:[the]garden.path fileify
/down/the/garden/path. fileify # N.B. trailing . ==> null type
/down/the/garden.path fileify
# and pathifying them
down:[the.garden]path.dir;1 pathify down:[the.garden.path]
[.down.the.garden]path.dir pathify [.down.the.garden.path]
/down/the/garden/path.dir pathify /down/the/garden/path/
down/the/garden/path.dir pathify down/the/garden/path/
down:[the.garden]path pathify down:[the.garden.path]
down:[the.garden]path. pathify # N.B. trailing . ==> null type
down:[the]garden.path pathify
/down/the/garden/path. pathify # N.B. trailing . ==> null type
/down/the/garden.path pathify
down:[the.garden]path.dir;2 pathify #N.B. ;2
path pathify path/
/down/the/garden/. pathify /down/the/garden/./
/down/the/garden/.. pathify /down/the/garden/../
/down/the/garden/... pathify /down/the/garden/.../
path.notdir pathify
# Both VMS/Unix and file/path conversions
down:[the.garden]path.dir;1 unixpath /down/the/garden/path/
/down/the/garden/path vmspath down:[the.garden.path]
down:[the.garden.path] unixpath /down/the/garden/path/
down:[the.garden.path...] unixpath /down/the/garden/path/.../
/down/the/garden/path.dir vmspath down:[the.garden.path]
[.down.the.garden]path.dir unixpath down/the/garden/path/
down/the/garden/path vmspath [.down.the.garden.path]
path vmspath [.path]
# Redundant characters in Unix paths
//some/where//over/../the.rainbow vmsify some:[where]the.rainbow
/some/where//over/./the.rainbow vmsify some:[where.over]the.rainbow
..//../ vmspath [--]
./././ vmspath []
./../. vmsify [-]
|