Directory handling library

Of course there has to be an easy way for the programmer to handle directories. We have provided some iterator routines for this. Each directory entry contains such information as directory, filename, file type, date,...

The routines to get a directory need a (NULL terminated) list of sieve routines. They can be used to make sure that only the routines with e.g. a certain length, file type or extension, or any combination are passed back. The sieve routines are also supplied with an extra parameter (e.g. the length, type, extensions requested). The sieves all have to be satisfied (AND). Or combinations have to be handled by the sieves themselves.

The names of subdirectories are not included in the directory list. Special (but similar) commands should be used for scanning the subdirectories.

directory scanning

DIROpen
Open a directory, for scanning through it
DIRDirectory
Get name of directory being scanned
DIRNext
Get next file in directory, conforming selection
DIRClose
End scanning

subdirectory scanning

DIRSubOpen
Open a directory, to scan for subdirectories
DIRSubDirectory
Get name of directory being scanned
DIRSubNext
Get next subdirectory
DIRSubClose
End scanning

standard sieves for scanning directories

DIRSieveLength
Only accept files with the length as given as parameter.
DIRSieveLengthLarger
Only accept files which are longer than parameter.
DIRSieveLengthSmaller
Only accept files which are shorter than parameter.
DIRSieveType
Only accept files with the given filetype.
DIRSieveExtension
Only accept files of which the name end in one of the extensions in the parameter. Several extensions can be passed by separating them by semicolons (;), for example "_c;_h" will only accept files ending in "_c" or int "_h". When the parameter is the empty string (""), then all files will be accepted.
DIRSievExtensionNot
Only accept files which do not end in one of the given extensions (see DIRSieveExtension).

PROGS, Professional & Graphical Software
last edited December 5, 1995