home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
c_spec
/
execute
/
dir.h
< prev
next >
Wrap
Text File
|
1986-02-20
|
3KB
|
80 lines
/*
* DIR.H
* #defines and typedefs needed to talk to the routine dir().
* A pointer to the DIRECTORY structure is passed to dir().
* DIRECTORY structures are created by mk_dir() and deleted with
* del_dir().
*
* On entry:
* dirv is the first of an uninitialized array of character
* pointers.
* lastdir should be initialized to point at dirv.
* maxdirs is the size of the above
* nfiles
* ndirs
* nbytes is the total file count, the total directory count
* and the total byte count. These will be incremented
* as appropriate and are usually set to 0 before
* calling dir().
* width should be initialized to 0 before calling dir().
* vol_label is undefined on entry to dir().
* longf is 1 if entrys are to be printed in long format
* files is 1 if files are included in the list.
* dirs is 1 if directors are included in the list.
* graphics is 1 if directories are highlighted with boldface.
* hidden is 1 if hidden files are to be included in the list.
* path is 1 if the path name is to be included in the list.
* label is 1 if you want to get the volume label
* exp is 1 if you want the contents of a subdirectory to
* be listed rather than the directory name when. This
* is only looked at if no wild cards are present in
* the file spec.
* sort is 1 if you want the list sorted.
*
* all other fields are ignored. On exit the structure will have been
* updated as follows:
*
* lastdir will be incremented to point at the last entry added
* to the dirv table.
* maxdirs will be decremented to reflect the added entries.
* nfiles is the number of added entries which are files.
* ndirs is the number of added entries which are directories.
* Note that the equivalent of argc can be derrived by
* adding ndirs and nfiles together.
* nbytes will have the total size in bytes of all files added
* to dirv. This number is the number of bytes actually
* occupied by the file, ie. the size returned by DOS
* rounded up to the nearest multiple of the disk's
* cluster size.
* vol_label will hold the volume lable provided that "label" was
* set on entry.
* width will hold the length of the widest entry added to dirv
*
* all other fields will have the same values they had on entry.
*/
typedef struct
{
char **lastdir ; /* Most recent addition to dirv */
int maxdirs ; /* # of free slots in dirv */
int nfiles ; /* # of used slots that are files */
int ndirs ; /* # of used slots that are directories */
long nbytes ; /* byte count of files */
char vol_label[12]; /* volume lable if requested */
unsigned width : 7 ; /* Width of widest element in dirv */
/* Various flags control how dir works: */
unsigned longf : 1 ; /* Use long format for entries */
unsigned files : 1 ; /* Include files in list */
unsigned dirs : 1 ; /* Include directories in list */
unsigned graphics : 1 ; /* Use graphics around directory names */
unsigned hidden : 1 ; /* List hidden files */
unsigned path : 1 ; /* List complete path if given */
unsigned label : 1 ; /* Load vol_label with volume label */
unsigned exp : 1 ; /* Expand sub-directories */
unsigned sort : 1 ; /* Sort added entries */
char *dirv[1]; /* The first of the dirv entries */
}
DIRECTORY;