home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
texmf
/
rexx
/
namestruc
< prev
next >
Wrap
Text File
|
1993-09-12
|
772b
|
27 lines
/*rx
*
* NAMESTRUC : part of PasTeX, *must* be in REXX:
*
This script accepts a filename and returns three lengthes (not
strings, to avoid problems with embedded spaces) corresponding to the
main parts of this filename.
Example: RAM:foo/bar/nasty.tar.Z
^ ^ ^
volume : 4 (RAM:)
subdirlen: 8 (foo/bar/) NOTE : The trailing slash is included.
baselen : 9 (nasty.tar) NOTE : if no extension, whole length.
*/
PARSE ARG fullname
/*fullname = strip(fullname,'L')*/
volume = INDEX(fullname,":")
subdirlen= LASTPOS("/",SUBSTR(fullname,1+volume))
fileonly = SUBSTR(fullname,volume+1+subdirlen)
baselen = LASTPOS(".",fileonly)
IF 0 = baselen THEN baselen = LENGTH(fileonly)
ELSE baselen = baselen -1
RETURN volume' 'subdirlen' 'baselen