Annotation of cci/usr/src/man/man3/scandir.3, revision 1.1

1.1     ! root        1: .TH SCANDIR 3  "19 January 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: scandir \- scan a directory
        !             5: .SH SYNOPSIS
        !             6: .nf
        !             7: .B #include <sys/types.h>
        !             8: .B #include <sys/dir.h>
        !             9: .PP
        !            10: .B scandir(dirname, namelist, select, compar)
        !            11: .B char *dirname;
        !            12: .B struct direct *(*namelist[]);
        !            13: .B int (*select)();
        !            14: .B int (*compar)();
        !            15: .PP
        !            16: .B alphasort(d1, d2)
        !            17: .B struct direct **d1, **d2;
        !            18: .fi
        !            19: .SH DESCRIPTION
        !            20: .I Scandir
        !            21: reads the directory
        !            22: .I dirname
        !            23: and builds an array of pointers to directory
        !            24: entries using
        !            25: .IR malloc (3).
        !            26: It returns the number of entries in the array and a pointer to the
        !            27: array through
        !            28: .IR namelist .
        !            29: .PP
        !            30: The
        !            31: .I select
        !            32: parameter is a pointer to a user supplied subroutine which is called by
        !            33: .I scandir
        !            34: to select which entries are to be included in the array.
        !            35: The select routine is passed a
        !            36: pointer to a directory entry and should return a non-zero
        !            37: value if the directory entry is to be included in the array.
        !            38: If
        !            39: .I select
        !            40: is null, then all the directory entries will be included.
        !            41: .PP
        !            42: The
        !            43: .I compar
        !            44: parameter is a pointer to a user supplied subroutine which is passed to
        !            45: .IR qsort (3)
        !            46: to sort the completed array. If this pointer is null, the array is not sorted.
        !            47: .I Alphasort
        !            48: is a routine which can be used for the
        !            49: .I compar
        !            50: parameter to sort the array alphabetically.
        !            51: .PP
        !            52: The memory allocated for the array can be deallocated with
        !            53: .I free
        !            54: (see
        !            55: .IR malloc (3))
        !            56: by freeing each pointer in the array and the array itself.
        !            57: .SH "SEE ALSO"
        !            58: directory(3),
        !            59: malloc(3),
        !            60: qsort(3),
        !            61: dir(5)
        !            62: .SH DIAGNOSTICS
        !            63: Returns \-1 if the directory cannot be opened for reading or if
        !            64: .IR malloc (3)
        !            65: cannot allocate enough memory to hold all the data structures.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.