home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff384.lzh
/
NorthC
/
Example2.LZH
/
Script
/
dirs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-10
|
2KB
|
75 lines
/* (c) 1990 S.Hawtin.
Permission is granted to copy this file provided
1) It is not used for commercial gain
2) This notice is included in all copies
3) Altered copies are marked as such
No liability is accepted for the contents of the file.
*/
#include <stdio.h>
#include <libraries/dos.h>
typedef void *lockPtr;
extern lockPtr CurrentDir();
extern lockPtr Lock();
static struct FileInfoBlock mydata;
findDirs(dir,disk,length)
char *dir;
char *disk;
int length;
{/* Work out the name of the current directory */
lockPtr current;
lockPtr parent,wasparent;
int first;
*dir = '\0';
first = 1;
parent = Lock("/",ACCESS_READ);
while(parent!=NULL)
{
wasparent = CurrentDir(parent);
Examine(wasparent,&mydata);
strcpy(disk,dir);
strcpy(dir,mydata.fib_FileName);
strcat(dir,"/");
strcat(dir,disk);
if(first)
{current = wasparent;
first = 0;
}
else
{
UnLock(wasparent);
}
parent = Lock("/",ACCESS_READ);
}
/* We must be at the root of the disk */
if(first)
{/* We were at the root of the disk already! */
wasparent = Lock(":",ACCESS_READ);
}
else
wasparent = CurrentDir(current);
Examine(wasparent,&mydata);
strcpy(disk,dir);
strcpy(dir,mydata.fib_FileName);
strcat(dir,":");
strcat(dir,disk);
strcpy(disk,mydata.fib_FileName);
strcat(disk,":");
UnLock(wasparent);
}