diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2010-01-04 15:40:17 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2010-01-04 15:40:17 +0000 |
commit | 4176dd52672fb6251873d81c1f904315118754c1 (patch) | |
tree | b365b59af8b0b68bad0041e490012bdb8c25eace /include/dirent.h | |
parent | ed127578734a47fd654df2300bd279c69e402b1a (diff) |
Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.
Remove requirement for "sys/types.h" include for functions from manpage.
POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.
Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.
PR: standards/142255
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=201512
Diffstat (limited to 'include/dirent.h')
-rw-r--r-- | include/dirent.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/dirent.h b/include/dirent.h index 63626b59bc72..8d7e5c10c67e 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -95,7 +95,7 @@ typedef void * DIR; __BEGIN_DECLS #if __BSD_VISIBLE DIR *__opendir2(const char *, int); -int alphasort(const void *, const void *); +int alphasort(const struct dirent **, const struct dirent **); int getdents(int, char *, int); int getdirentries(int, char *, int, long *); #endif @@ -109,7 +109,8 @@ int readdir_r(DIR *, struct dirent *, struct dirent **); void rewinddir(DIR *); #if __BSD_VISIBLE int scandir(const char *, struct dirent ***, - int (*)(struct dirent *), int (*)(const void *, const void *)); + int (*)(const struct dirent *), int (*)(const struct dirent **, + const struct dirent **)); #endif #if __XSI_VISIBLE void seekdir(DIR *, long); |