home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
text
/
tex
/
pastex
/
rexx
/
namestruc
< prev
next >
Wrap
Text File
|
1993-09-11
|
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