#ifndef _DIRUTIL_H
#define _DIRUTIL_H

#ifndef _GLOBAL_H
#include "global.h"
#endif

#ifdef UNIX
#include <time.h>

struct ffblk
{
    char ff_name[256];		/* current filename result */
    struct tm ff_ftime;		/* modify date/time */
    long ff_fsize;		/* file size */
    int ff_attrib;		/* DOS-style attributes (ugh) */
#ifdef GLOB_INTERNAL		/* ...only visible to internals... */
    char *ff_pfx;		/* prefix for found patterns */
    char *ff_pat;		/* pattern for the current level */
    DIR *ff_dir;		/* directory scan for the current level */
    struct dirent *ff_cur;	/* current path component */
    long ff_sattr;		/* selected attributes */
#else
    long youdontseethis[5];
#endif
};

#define FA_NORMAL	0	/* anything except the following: */
#define FA_SYSTEM	1	/* device node or unreadable file */
#define FA_HIDDEN	2	/* dot-files */
#define FA_DIREC	4	/* directory */
#define FA_RDONLY	8	/* read-only file */

extern int findfirst __ARGS((char *pat, struct ffblk *ff, int attr));
extern int findnext __ARGS((struct ffblk *ff));
extern void findlast __ARGS((struct ffblk *ff));

#endif

struct cur_dirs {
#if !defined(TNOS_68K) && !defined(UNIX)
           int drv;
           char * curdir[27];
#endif
           char * dir;                
} ;

/* In dirutil.c */
FILE *dir __ARGS((char *path,int full));
int filedir __ARGS((char *name,int times,char *ret_str));
int getdir __ARGS((char *path,int full,FILE *file));
void undosify __ARGS((char *s));
char * make_dir_path __ARGS((int count,char *arg,char* curdir));
char * make_fname __ARGS((char * curdir, char * fname));
char * init_dirs __ARGS((struct cur_dirs * dirs));
void free_dirs __ARGS((struct cur_dirs * dirs));
int dir_ok __ARGS((char * path,struct cur_dirs * dirs));
int dircmd __ARGS((int argc,char *argv[],void *p));


/* In pathname.c: */
char *pathname __ARGS((char *cd,char *path));

/* In pc.c: */
char *Tmpnam __ARGS((char *name));

/* In bmutil.c */
long fsize __ARGS((char *name));

#endif /* _DIRUTIL_H */


