summaryrefslogtreecommitdiffstats
path: root/include/dirent.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-01-04 15:40:17 +0000
committerkib <kib@FreeBSD.org>2010-01-04 15:40:17 +0000
commitd061de008ac2d14466eefecb47b69b59e5e79408 (patch)
treeb365b59af8b0b68bad0041e490012bdb8c25eace /include/dirent.h
parent16db58ba54bd23cade57dc720cf9bd57f5487f3e (diff)
downloadFreeBSD-src-d061de008ac2d14466eefecb47b69b59e5e79408.zip
FreeBSD-src-d061de008ac2d14466eefecb47b69b59e5e79408.tar.gz
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
Diffstat (limited to 'include/dirent.h')
-rw-r--r--include/dirent.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/dirent.h b/include/dirent.h
index 63626b5..8d7e5c1 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);
OpenPOWER on IntegriCloud