Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

qsort

scandir



ALPHASORT(3,L)              AIX Technical Reference              ALPHASORT(3,L)



-------------------------------------------------------------------------------
alphasort



PURPOSE

Provides a comparison function for sorting alphabetically.

LIBRARY

Standard C Library (libc.a)

SYNTAX

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

int alphasort (dir1, dir2)
struct dirent **dir1, **dir2;

DESCRIPTION

The alphasort subroutine alphabetically compares the d_name members of the two
dirent structures pointed to by the dir1 and dir2 parameters.  This subroutine
can be passed as the compar parameter 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 d_name member pointed to by the dir1 parameter is
                  lexically less than the d_name member pointed to by the dir2
                  parameter.

0                 If the d_name members pointed to by dir1 and dir2 are equal.

Greater than 0    If the d_name member pointed to by the dir1 parameter is
                  lexically greater than the d_name member pointed to by the
                  dir2 parameter.

RELATED INFORMATION

In this book:  "qsort" and "scandir."









Processed November 7, 1990      ALPHASORT(3,L)                                1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026