wrote:
In article <5ca9b844-3f81-4d71-8f7b-01c2122ad...@25g2000hsx.googlegroups.com>,From the link that you cut to SFL, we have this directory API that
user923005 *<dcor...@connx.comwrote:When you make a function call in C to any library function, you are
calling an API:
http://en.wikipedia.org/wiki/API
By what sort of magic do you expect to collect directory information
without using an API?
Original Unix filesystems, open the directory as a regular file and read
and interpret the byte-stream ?? There were convenient
fixed-width entries (14 characters, plus a two-byte inode number).
OS re-writing of entire directory blocks (e.g., compacting out
entries no longer used) was controversial, since doing so destroyed
assumptions that directories could be iterated through from begining
to end.
works on POSIX and Windows:
Directory access functions
Filename: sfldir.h
Package: Standard Function Library (SFL)
Written: 1996/04/02 iMatix SFL project team sf*@imatix.com
Revised: 2000/01/18
Copyright: Copyright (c) 1996-2000 iMatix Corporation
Synopsis
The directory access functions provide a portable interface to the
system's file directory structure. In general these functions are
modelled around the UNIX opendir and readdir functions, but they are
also similar to the DOS interface. These functions can fail on SVr4 if
the <dirent.hfile does not match the C library. Recompile with the
switch -D _USE_BSD_DIRENT and they should work a bit better. Tested
on: MS-DOS (Turbo-C), Windows (MSVC 4.0), UNIX (Linux, IBM AIX,
SunOS). OS/2 port was done by Ewen McNeill ew**@naos.co.nz. DJGPP and
DRDOS LFN by Rob Judd ju**@alphalink.com.au. Changes for Win32 by Will
Menninger wi****@netcom.com.
List of Functions
* Bool open dir
(DIRST *dir, const char *dir_name);
* Bool read dir
(DIRST *dir);
* Bool close dir
(DIRST *dir);
* char * format dir
(DIRST *dir, Bool full);
* int fix dir
(DIRST *dir);
* int free dir
(DIRST *dir);
* char * resolve path
(const char *path);
* char * locate path
(const char *root, const char *path);
* char * clean path
(const char *path);
* NODE * load dir list
(const char *dir_name, const char *sort);
* void sort dir list
(NODE *filelist, const char *sort);
* FILEINFO * add dir list
(NODE *filelist, const DIRST *dir);
* void free dir list
(NODE *filelist);
* char * get curdir
(void);
* int set curdir
(const char *path);
* Bool file matches
(const char *filename, const char *pattern);
* int make dir
(const char *path);
* int remove dir
(const char *path);
* qbyte dir usage
(const char *path, Bool recurse);
* qbyte dir files
(const char *path, Bool recurse);