Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../.././../../../usr/man/man3c/scandir.3c
Real path: /usr/share/man/man3c/scandir.3c
Zurück
'\" te .\" Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. .TH scandir 3C "09 May 2016" "Oracle Solaris 11.4" "Standard C Library Functions" .SH NAME scandir, alphasort \- scan a directory .SH SYNOPSIS .LP .nf #include <sys/types.h> #include <dirent.h> \fBint\fR \fBscandir\fR(\fBconst char *\fR\fIdirname\fR, \fBstruct dirent *\fR(*\fInamelist\fR[]), \fBint\fR (*\fIselect\fR)(const struct dirent *), \fBint\fR (*\fIdcomp\fR)(\fBconst struct dirent **\fR, \fBconst struct dirent **\fR)); .fi .LP .nf \fBint\fR \fBalphasort\fR(\fBconst struct dirent **\fR\fId1\fR, \fBconst struct dirent **\fR\fId2\fR); .fi .SH DESCRIPTION .sp .LP The \fBscandir()\fR function reads the directory \fIdirname\fR using \fBreaddir\fR(3C) and builds an array of pointers to directory entries using \fBmalloc\fR(3C). The \fInamelist\fR argument is a pointer to an array of structure pointers. The \fIselect\fR argument is a pointer to a routine that is called with a pointer to a directory entry and returns a non-zero value if the directory entry is included in the array. If this pointer is \fINULL\fR, then all the directory entries are included. The \fIdcomp\fR argument is a pointer to a routine that is passed to \fBqsort\fR(3C), which sorts the completed array. If this pointer is \fINULL\fR, the array is not sorted. .sp .LP The \fBalphasort()\fR function can be used as the \fIdcomp\fR() function parameter for the \fBscandir()\fR function to sort the directory entries into alphabetical order, as if by the \fBstrcoll\fR(3C) function. Its arguments are the two directory entries to compare. .SH RETURN VALUES .sp .LP The \fBscandir()\fR function returns the number of entries in the array and a pointer to the array through the \fInamelist\fR argument. When an error is encountered, \fBscandir()\fR returns -1 and \fBerrno\fR is set to indicate the error. .sp .LP The \fBalphasort()\fR function returns an integer greater than, equal to, or less than 0 if the directory entry name pointed to by \fId1\fR is greater than, equal to, or less than the directory entry name pointed to by \fId2\fR when both are interpreted as appropriate to the current locale. There is no return value reserved to indicate an error. .SH ERRORS .sp .LP The \fBscandir()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEACCES\fR\fR .ad .RS 16n .rt Search permission is denied for the component of the path prefix of \fBdir\fR or read permission is denied for \fBdir\fR. .RE .sp .ne 2 .mk .na \fB\fBELOOP\fR\fR .ad .RS 16n .rt A loop exists in the symbolic links encountered during resolving the \fBdir\fR argument. .RE .sp .ne 2 .mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n .rt The length of a component of a pathname is longer than {\fINAME_MAX\fR}. .RE .sp .ne 2 .mk .na \fB\fBENOENT\fR\fR .ad .RS 16n .rt A component of \fBdir\fR does not name an existing directory or \fBdir\fR is an empty string. .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 16n .rt Insufficient storage space. .RE .sp .ne 2 .mk .na \fB\fBENOTDIR\fR\fR .ad .RS 16n .rt A component of \fBdir\fR names an existing file that is neither a directory nor a symbolic link to a directory. .RE .sp .ne 2 .mk .na \fB\fBEOVERFLOW\fR\fR .ad .RS 16n .rt One of the values to be returned or passed to a callback function cannot be represented correctly. .RE .sp .LP The \fBscandir()\fR function may fail if: .sp .ne 2 .mk .na \fB\fBELOOP\fR\fR .ad .RS 16n .rt More than {\fISYMLOOP_MAX\fR} symbolic links were encountered during resolution of the \fBdir\fR argument. .RE .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 16n .rt All file descriptors available to the process are currently open. .RE .sp .ne 2 .mk .na \fB\fBENAMETOOLONG\fR\fR .ad .RS 16n .rt The length of a pathname exceeds {\fIPATH_MAX\fR}, or pathname resolution of a symbolic link produced an intermediate result with a length that exceeds {\fIPATH_MAX\fR}. .RE .sp .ne 2 .mk .na \fB\fBENFILE\fR\fR .ad .RS 16n .rt Too many files are currently open in the system. .RE .SH USAGE .sp .LP The \fBscandir()\fR and \fBalphasort()\fR functions have transitional interfaces for 64-bit file offsets. See \fBlf64\fR(7). .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level See below. .TE .sp .sp .LP The \fBscandir()\fR function is Unsafe. The \fBalphasort()\fR function is Safe. .SH SEE ALSO .sp .LP \fBmalloc\fR(3C), \fBqsort\fR(3C), \fBreaddir\fR(3C), \fBstrcoll\fR(3C), \fBattributes\fR(7), \fBlf64\fR(7)