alphasort
Purpose
Provides a comparison function for sorting alphabet-
ically.
Library
Berkeley Library (libbsd.a)
Syntax
#include <bsd/sys/types.h>
#include <bsd/sys/dir.h>
int alphasort (dir1, dir2)
struct direct **dir1, **dir2;
Description
The alphasort subroutine alphabetically compares the two
direct structures pointed to by the dir1 and dir2 parame-
ters. This subroutine can be passed as the compar param-
eter to either the scandir or qsort subroutine, or a
user-supplied subroutine can be used instead. (See
"qsort" and "scandir" for more information.)
Return Value
The alphasort subroutine returns the following values:
Less than 0 If the direct structure pointed to by
the dir1 parameter is lexically less
than the direct structure pointed to by
the dir2 parameter.
0 If the direct structures pointed to by
dir1 and dir2 are equal.
Greater than 0 If the direct structure pointed to by
the dir1 parameter is lexically greater
than the direct structure pointed to by
the dir2 parameter.
Related Information
In this book: "qsort" and "scandir."