diff options
Diffstat (limited to 'unixdir.c')
-rw-r--r-- | unixdir.c | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -19,17 +19,13 @@ #include "msdos.h" #include "stream.h" #include "mtools.h" -#include "fsP.h" #include "file.h" #include "htable.h" #include "mainloop.h" #include <dirent.h> typedef struct Dir_t { - Class_t *Class; - int refs; - Stream_t *Next; - Stream_t *Buffer; + struct Stream_t head; struct MT_STAT statbuf; char *pathname; @@ -41,15 +37,15 @@ typedef struct Dir_t { /*#define FCHDIR_MODE*/ -static int get_dir_data(Stream_t *Stream, time_t *date, mt_size_t *size, - int *type, int *address) +static int get_dir_data(Stream_t *Stream, time_t *date, mt_off_t *size, + int *type, unsigned int *address) { DeclareThis(Dir_t); if(date) *date = This->statbuf.st_mtime; if(size) - *size = (mt_size_t) This->statbuf.st_size; + *size = This->statbuf.st_size; if(type) *type = 1; if(address) @@ -66,9 +62,11 @@ static int dir_free(Stream_t *Stream) return 0; } -static Class_t DirClass = { +static Class_t DirClass = { 0, /* read */ 0, /* write */ + 0, /* pread */ + 0, /* pwrite */ 0, /* flush */ dir_free, /* free */ 0, /* get_geom */ @@ -82,8 +80,8 @@ static Class_t DirClass = { #define FCHDIR_MODE #endif -int unix_dir_loop(Stream_t *Stream, MainParam_t *mp); -int unix_loop(Stream_t *Stream, MainParam_t *mp, char *arg, +int unix_dir_loop(Stream_t *Stream, MainParam_t *mp); +int unix_loop(Stream_t *Stream, MainParam_t *mp, char *arg, int follow_dir_link); int unix_dir_loop(Stream_t *Stream, MainParam_t *mp) @@ -109,7 +107,7 @@ int unix_dir_loop(Stream_t *Stream, MainParam_t *mp) if(isSpecial(entry->d_name)) continue; #ifndef FCHDIR_MODE - newName = malloc(strlen(This->pathname) + 1 + + newName = malloc(strlen(This->pathname) + 1 + strlen(entry->d_name) + 1); if(!newName) { ret = ERROR_ONE; @@ -139,11 +137,7 @@ Stream_t *OpenDir(const char *filename) Dir_t *This; This = New(Dir_t); - - This->Class = &DirClass; - This->Next = 0; - This->refs = 1; - This->Buffer = 0; + init_head(&This->head, &DirClass, NULL); This->pathname = malloc(strlen(filename)+1); if(This->pathname == NULL) { Free(This); @@ -164,5 +158,5 @@ Stream_t *OpenDir(const char *filename) return NULL; } - return (Stream_t *) This; + return &This->head; } |