home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
011.lha
/
tool_wrapper
/
mkpath.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-11-10
|
854b
|
40 lines
/* mkpath -- Makes a pathname from an AmigaDOS "lock".
M. Zellers & M. Abel, August 1986
*/
#include <libraries/dos.h>
#define MMOVE(from, to) { register char *fptr; \
for (fptr = from; (*to++ = *fptr++) ; ) ;--to; }
char *mkpath(lock, result)
LONG lock, ParentDir(), Examine();
void UnLock();
char *result;
{
struct FileInfoBlock myfib;
LONG parent;
if (Examine(lock, &myfib)) {
parent = ParentDir(lock);
if (parent == 0) {
MMOVE(myfib.fib_FileName, result);
*result++ = ':';
*result = '\0';
return(result);
} else {
result = mkpath(parent, result);
MMOVE(myfib.fib_FileName, result);
*result++ = '/';
*result = '\0';
UnLock(parent);
return(result);
}
} else exit(1);
}