dhodovsk / source-git / pacemaker

Forked from source-git/pacemaker 3 years ago
Clone

Blame replace/alphasort.c

rpm-build 3ee90c
/*
rpm-build 3ee90c
 *
rpm-build 3ee90c
 * alphasort - replacement for alphasort functions.
rpm-build 3ee90c
 * 
rpm-build 3ee90c
 * Matt Soffen
rpm-build 3ee90c
rpm-build 3ee90c
 * Copyright (C) 2001 Matt Soffen <matt@soffen.com>
rpm-build 3ee90c
 *
rpm-build 3ee90c
 * Taken from the FreeBSD file (with copyright notice)
rpm-build 3ee90c
 *	/usr/src/gnu/lib/libdialog/dir.c 
rpm-build 3ee90c
 ***************************************************************************
rpm-build 3ee90c
 *	Program:	dir.c
rpm-build 3ee90c
 *	Author:		Marc van Kempen
rpm-build 3ee90c
 *	desc:		Directory routines, sorting and reading
rpm-build 3ee90c
 *
rpm-build 3ee90c
 * Copyright (c) 1995, Marc van Kempen
rpm-build 3ee90c
 *
rpm-build 3ee90c
 * All rights reserved.
rpm-build 3ee90c
 *
rpm-build 3ee90c
 * This software may be used, modified, copied, distributed, and
rpm-build 3ee90c
 * sold, in both source and binary form provided that the above
rpm-build 3ee90c
 * copyright and these terms are retained, verbatim, as the first
rpm-build 3ee90c
 * lines of this file.  Under no circumstances is the author
rpm-build 3ee90c
 * responsible for the proper functioning of this software, nor does
rpm-build 3ee90c
 * the author assume any responsibility for damages incurred with
rpm-build 3ee90c
 * its use.
rpm-build 3ee90c
 *
rpm-build 3ee90c
 ***************************************************************************
rpm-build 3ee90c
 */
rpm-build 3ee90c
rpm-build 3ee90c
#include <crm_internal.h>
rpm-build 3ee90c
#include <sys/types.h>
rpm-build 3ee90c
#include <sys/stat.h>
rpm-build 3ee90c
rpm-build 3ee90c
#include <unistd.h>             /* XXX for _POSIX_VERSION ifdefs */
rpm-build 3ee90c
rpm-build 3ee90c
#if HAVE_STRINGS_H
rpm-build 3ee90c
#  include <strings.h>
rpm-build 3ee90c
#endif
rpm-build 3ee90c
rpm-build 3ee90c
#if !defined sgi && !defined _POSIX_VERSION
rpm-build 3ee90c
#  include <sys/dir.h>
rpm-build 3ee90c
#endif
rpm-build 3ee90c
rpm-build 3ee90c
#include <sys/types.h>
rpm-build 3ee90c
#include <dirent.h>
rpm-build 3ee90c
#include <stdlib.h>
rpm-build 3ee90c
#include <stddef.h>
rpm-build 3ee90c
rpm-build 3ee90c
int
rpm-build 3ee90c
alphasort(const void *dirent1, const void *dirent2)
rpm-build 3ee90c
{
rpm-build 3ee90c
    return (strcmp((*(const struct dirent **)dirent1)->d_name,
rpm-build 3ee90c
                   (*(const struct dirent **)dirent2)->d_name));
rpm-build 3ee90c
}