- Subject: Re: dircat vs. path_concat
- From: "Klaus Schmid" <klaus.schmid@xxxxxxx>
- Date: Fri, 17 Oct 2003 00:09:40 +0200
John E. Davis <davis@xxxxxxxxxxxxx> wrote:
> >Klaus Schmid <klaus.schmid@xxxxxxx> wrote:
> Also, one might want to concatenate
> x:a.dir + b
This should be possible with some additional effort;
as a more complete example:
! x is a logical name defined before
$ define x x1:[x2]
...
% split into directory (x:) and base (a.dir)
(d,b)= split_file( "x:a.dir");
% call system-function f$trnlnm, afair,
% one or more times to resolve to x1:[x2]
d= expand_logical_to_physical( d);
% get child-directory x1:[x2.a]
d= dir_down( d, b);
% dir+base == file
f= d +"b"
> >split_file( "a:[b]c.txt") --> "a:[b]", "c.txt"
> >dir_down( "a:[b]", "c.dir") --> "a:[b.c]"
> >dir_up( "a:[b.c]") --> "a:[b]", "c.dir"
>
> I think you mean split_file for the last example.
No, not really.
split_file finally just analyzes the string
without any potential failure.
dir_up tries to get the parent-directory and within
that the directory-file, which corresponds to the
input directory. It may fail more or less:
no parent: d=input b=""
parent, but no file: d=parent b=""
e.g.
dir_up("[000000]") --> "[000000]", ""
dir_up("x:") --> "x:", ""
dir_up("") --> "[-]", ""
As pointed out above, I would prefer pure string
operations for the basic path-functions;
some applications will provide many well-formed inputs,
e.g. directory lists, others can expand, translate or
check before.
> I think you can use [] to mean . on VMS, e.g., ./a == []a. Also,
> dev$device:[a.b.-] is equivalent to device$device:[a]. I forget what
> dev$device:[a.b...] means.
Ellipsis means current directory including all subdirectories,
e.g. search [a.b...]*.txt sometext.
> Also it is important to note that on Unix,
> "a/b/.." _may_ not be equivalent to "a".
Hmm. I think I know nothing about this.
Could you give me a hint?
> Finally, to make things even more interesting on the VMS side,
> dev$device does not have to represent a single device. Instead,
> dev$device could represent a search list, i.e., a set of directories
> to be tried in succession.
Never used or heard about the search list before.
Now I found it in a comprehensive documentation on hp-OpenVMS:
http://h71000.www7.hp.com/doc/72final/6489/6489pro.html
Thanks,
-- Klaus
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]