[Previous] [Contents] [Next]

alphasort()

Sort directory entries

Synopsis:

#include <sys/types.h>
#include <sys/dir.h>

struct direct {
    unsigned long d_fileno;
    unsigned short d_reclen;
    unsigned short d_namlen;
    char d_name[1];
};

int alphasort( struct direct **d1,
               struct direct **d2);

Library:

libc

Description:

The alphasort() function sorts an array of directory entries alphabetically. It can be used for the compar parameter to scandir().

Returns:

< 0
The d1 entry precedes the d2 entry alphabetically.
0
The entries are equivalent.
> 0
The d1 entry follows the d2 entry alphabetically.

Classification:

Legacy Unix

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

closedir(), opendir(), readdir(), rewinddir(), scandir()


[Previous] [Contents] [Next]