root/replace/alphasort.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. alphasort

   1 /*
   2  *
   3  * alphasort - replacement for alphasort functions.
   4  * 
   5  * Matt Soffen
   6 
   7  * Copyright (C) 2001 Matt Soffen <matt@soffen.com>
   8  *
   9  * Taken from the FreeBSD file (with copyright notice)
  10  *      /usr/src/gnu/lib/libdialog/dir.c 
  11  ***************************************************************************
  12  *      Program:        dir.c
  13  *      Author:         Marc van Kempen
  14  *      desc:           Directory routines, sorting and reading
  15  *
  16  * Copyright (c) 1995, Marc van Kempen
  17  *
  18  * All rights reserved.
  19  *
  20  * This software may be used, modified, copied, distributed, and
  21  * sold, in both source and binary form provided that the above
  22  * copyright and these terms are retained, verbatim, as the first
  23  * lines of this file.  Under no circumstances is the author
  24  * responsible for the proper functioning of this software, nor does
  25  * the author assume any responsibility for damages incurred with
  26  * its use.
  27  *
  28  ***************************************************************************
  29  */
  30 
  31 #include <crm_internal.h>
  32 #include <sys/types.h>
  33 #include <sys/stat.h>
  34 
  35 #include <unistd.h>             /* XXX for _POSIX_VERSION ifdefs */
  36 
  37 #if HAVE_STRINGS_H
  38 #  include <strings.h>
  39 #endif
  40 
  41 #if !defined sgi && !defined _POSIX_VERSION
  42 #  include <sys/dir.h>
  43 #endif
  44 
  45 #include <sys/types.h>
  46 #include <dirent.h>
  47 #include <stdlib.h>
  48 #include <stddef.h>
  49 
  50 int
  51 alphasort(const void *dirent1, const void *dirent2)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53     return (strcmp((*(const struct dirent **)dirent1)->d_name,
  54                    (*(const struct dirent **)dirent2)->d_name));
  55 }

/* [previous][next][first][last][top][bottom][index][help] */