mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add alphasort(3).
This commit is contained in:
parent
7de9273bef
commit
9bd82e1d80
3 changed files with 33 additions and 0 deletions
|
@ -29,6 +29,7 @@ calloc.o \
|
|||
clearerr.o \
|
||||
c++.o \
|
||||
ctype.o \
|
||||
dirent/alphasort.o \
|
||||
dirent/dir.o \
|
||||
div.o \
|
||||
errno.o \
|
||||
|
|
31
libc/dirent/alphasort.cpp
Normal file
31
libc/dirent/alphasort.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
dirent/alphasort.cpp
|
||||
Compare directory entries alphabetically.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
extern "C" int alphasort(const struct dirent** a, const struct dirent** b)
|
||||
{
|
||||
return strcoll((*a)->d_name, (*b)->d_name);
|
||||
}
|
|
@ -40,6 +40,7 @@ struct dirent
|
|||
char d_name[0];
|
||||
};
|
||||
|
||||
int alphasort(const struct dirent**, const struct dirent**);
|
||||
int closedir(DIR* dir);
|
||||
int dirfd(DIR* dir);
|
||||
DIR* fdopendir(int fd);
|
||||
|
|
Loading…
Reference in a new issue