diff options
Diffstat (limited to 'man3/scandir.3')
-rw-r--r-- | man3/scandir.3 | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/man3/scandir.3 b/man3/scandir.3 index f734e6ac7..1abda05b7 100644 --- a/man3/scandir.3 +++ b/man3/scandir.3 @@ -21,7 +21,7 @@ .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" -.TH scandir 3 2023-02-05 "Linux man-pages 6.03" +.TH scandir 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME scandir, scandirat, alphasort, versionsort \- scan a directory for matching entries @@ -180,43 +180,51 @@ The path in \fIdirp\fR is not a directory. is a relative pathname and .I dirfd is a file descriptor referring to a file other than a directory. -.SH VERSIONS -.BR versionsort () -was added in glibc 2.1. -.PP -.BR scandirat () -was added in glibc 2.15. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR scandir (), .BR scandirat () T} Thread safety MT-Safe T{ +.na +.nh .BR alphasort (), .BR versionsort () T} Thread safety MT-Safe locale .TE -.hy -.ad .sp 1 .SH STANDARDS -.BR alphasort (), -.BR scandir (): +.TP +.BR alphasort () +.TQ +.BR scandir () +POSIX.1-2008. +.TP +.BR versionsort () +.TQ +.BR scandirat () +GNU. +.SH HISTORY +.TP +.BR alphasort () +.TQ +.BR scandir () 4.3BSD, POSIX.1-2008. -.PP +.TP .BR versionsort () -and +glibc 2.1. +.TP .BR scandirat () -are GNU extensions. +glibc 2.15. .\" .LP .\" The functions .\" .BR scandir () @@ -267,25 +275,25 @@ in reverse order. #include <dirent.h> #include <stdio.h> #include <stdlib.h> - +\& int main(void) { struct dirent **namelist; int n; - +\& n = scandir(".", &namelist, NULL, alphasort); if (n == \-1) { perror("scandir"); exit(EXIT_FAILURE); } - +\& while (n\-\-) { printf("%s\en", namelist[n]\->d_name); free(namelist[n]); } free(namelist); - +\& exit(EXIT_SUCCESS); } .EE |