1 | Netters,
|
---|
2 |
|
---|
3 | Here are some directory routines I put together awhile back for MS-DOS
|
---|
4 | which provide the same functionality as the 4.2 BSD directory routines.
|
---|
5 | In this kit you will find scandir(), opendir(), readdir(), seekdir(),
|
---|
6 | telldir(), closedir(), etc. They behave like the 4.2 routines with some
|
---|
7 | minor exceptions: The actual directory structure is different since
|
---|
8 | MS-DOS keeps the equivilent of directory entry and inode in its directory,
|
---|
9 | and a picture of the directory is read in during an opendir() call, so if
|
---|
10 | something changes in the directory it will not show up in readdir() calls,
|
---|
11 | unless you do another opendir().
|
---|
12 |
|
---|
13 | These routines were written for Microsoft C, though the only special
|
---|
14 | functions I used were realloc() and intdos(), which most 'modern' C
|
---|
15 | compilers have.
|
---|
16 |
|
---|
17 | I have also compiled these under all memory models with no problems.
|
---|
18 | Microsoft C automatically provides a #define for use in detecting
|
---|
19 | which memory model is in use. I use this in scandir() to set up the
|
---|
20 | pointers correctly. I also use the FP_SEG and FP_OFF macro's too.
|
---|
21 | Other C compilers will have to have this section changed to handle
|
---|
22 | their method of splitting far pointers into segments and offsets.
|
---|
23 |
|
---|
24 | Also included in this kit (Don't send your money now, there's more!)
|
---|
25 | are two simple test programs, test1.c and test2.c. These programs
|
---|
26 | show how to do a simple directory search, with test1.c using opendir(),
|
---|
27 | and test2.c using scandir(). Test2.c also uses another function
|
---|
28 | called fmatch(), which I found on the net many months ago in a slightly
|
---|
29 | different form. To compile the test programs, use:
|
---|
30 |
|
---|
31 | cl test1.c dir.obj scandir.obj
|
---|
32 | cl test2.c fmatch.obj scandir.obj
|
---|
33 |
|
---|
34 | after compiling dir.c, scandir.c, and fmatch.c.
|
---|
35 |
|
---|
36 | If you have any comments or bug reports, send them to:
|
---|
37 |
|
---|
38 | Bill Marsh, Naval Ocean Systems Center, San Diego, CA
|
---|
39 | {arpa,mil}net: bmarsh@nosc
|
---|
40 | uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!noscvax!bmarsh
|
---|
41 | |
---|