home *** CD-ROM | disk | FTP | other *** search
- #include "stat.h"
- #include "dos.h"
- #include "time.h"
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <libraries/dos.h>
-
- #include <proto/exec.h>
- #include <proto/dos.h>
-
- int stat(char *name,struct stat *status)
- {
- BPTR lock;
- struct FileInfoBlock *fib;
- unsigned long t;
- struct tm *time;
- int retval = -1;
-
- fib = AllocMem(sizeof(struct FileInfoBlock), MEMF_PUBLIC);
- if (fib) {
- if(lock=Lock(name,ACCESS_READ)) {
- if(Examine(lock,fib)) {
- status->st_size=fib->fib_Size;
-
- t=(365*8+2)*24*3600;
- t+=fib->fib_Date.ds_Days*24*3600;
- t+=fib->fib_Date.ds_Minute*3600;
- t+=fib->fib_Date.ds_Tick/50;
-
- time=localtime(&t);
-
- status->st_atime=time->tm_mday;
- status->st_atime+=time->tm_mon*256l;
- status->st_atime+=time->tm_year*16384l;
-
- retval = 0;
- }
- UnLock(lock);
- }
- FreeMem(fib, sizeof(struct FileInfoBlock));
- }
-
- return retval;
- }
-
- /*-------------------------------------------------------------------------*/
- /* ID: 1.1@958 Last Changed: 16 Oct 1989 08:27:50 by max */
-