6a00dc5ed2
Submitted by: Yuko Sasaki <yuko@veltec.co.jp>
109 lines
3.7 KiB
Groff
109 lines
3.7 KiB
Groff
.\" Copyright (c) 1983, 1991, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)scandir.3 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/gen/scandir.3,v 1.3.2.4 2001/12/14 18:33:51 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt SCANDIR 3
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm scandir ,
|
|
.Nm alphasort
|
|
.Nd ¥Ç¥£¥ì¥¯¥È¥ê¤òÁöºº¤¹¤ë
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In sys/types.h
|
|
.In dirent.h
|
|
.Ft int
|
|
.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \\*(lp*select\\*(rp\\*(lpstruct dirent *\\*(rp" "int \\*(lp*compar\\*(rp\\*(lpconst void *, const void *\\*(rp"
|
|
.Ft int
|
|
.Fn alphasort "const void *d1" "const void *d2"
|
|
.Sh ²òÀâ
|
|
.Fn scandir
|
|
´Ø¿ô¤Ï¥Ç¥£¥ì¥¯¥È¥ê
|
|
.Fa dirname
|
|
¤òÆɤ߼è¤ê¡¢
|
|
.Xr malloc 3
|
|
¤ò»ÈÍѤ·¤Æ¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤ÎÇÛÎó¤òºîÀ®¤·¤Þ¤¹¡£
|
|
¤½¤·¤ÆÇÛÎóÆâ¤Î¥¨¥ó¥È¥ê¤Î¿ô¤òÊÖ¤·¤Þ¤¹¡£
|
|
¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ÎÇÛÎó¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ï¡¢
|
|
.Fa namelist
|
|
¤¬»²¾È¤¹¤ë°ÌÃÖ¤ËÊݸ¤µ¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
.Fa select
|
|
¥Ñ¥é¥á¡¼¥¿¤Ï¡¢¤É¤Î¥¨¥ó¥È¥ê¤òÇÛÎó¤ËÆþ¤ì¤ë¤«¤òÁªÂò¤¹¤ë¤¿¤á¤Ë
|
|
.Fn scandir
|
|
¤Ë¤è¤Ã¤Æ¸Æ¤Ó½Ð¤µ¤ì¤ë¡¢¥æ¡¼¥¶ÄêµÁ¥µ¥Ö¥ë¡¼¥Á¥ó¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¹¡£
|
|
ÁªÂò¥ë¡¼¥Á¥ó¤Ë¤Ï¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤¬ÅϤµ¤ì¤Þ¤¹¡£
|
|
¤Þ¤¿¡¢¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òÇÛÎó¤ËÆþ¤ì¤ë¾ì¹ç¤ÏÈó
|
|
0 ¤ÎÃͤòÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤ê¤Þ¤»¤ó¡£
|
|
.Fa select
|
|
¤¬
|
|
NULL
|
|
¤Î¾ì¹ç¡¢¤¹¤Ù¤Æ¤Î¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤¬ÁȤßÆþ¤ì¤é¤ì¤Þ¤¹¡£
|
|
.Pp
|
|
.Fa compar
|
|
¥Ñ¥é¥á¡¼¥¿¤Ï¡¢¥æ¡¼¥¶ÄêµÁ¥µ¥Ö¥ë¡¼¥Á¥ó¤ò»Ø¤¹¥Ý¥¤¥ó¥¿¤Ç¤¢¤ê¡¢
|
|
¤³¤Î¥µ¥Ö¥ë¡¼¥Á¥ó¤Ï´°À®¤·¤¿ÇÛÎó¤ò¥½¡¼¥È¤¹¤ë¤¿¤á¤Ë
|
|
.Xr qsort 3
|
|
¤ËÅϤµ¤ì¤Þ¤¹¡£¤³¤Î¥Ý¥¤¥ó¥¿¤¬
|
|
NULL
|
|
¤Î¾ì¹ç¡¢ÇÛÎó¤Ï¥½¡¼¥È¤µ¤ì¤Þ¤»¤ó¡£
|
|
.Pp
|
|
.Fn alphasort
|
|
´Ø¿ô¤Ï¡¢
|
|
.Fa compar
|
|
¥Ñ¥é¥á¡¼¥¿¤Ë»ÈÍѤǤ¤ë¥ë¡¼¥Á¥ó¤Ç¡¢ÇÛÎó¤ò¥¢¥ë¥Õ¥¡¥Ù¥Ã¥È½ç¤Ë¥½¡¼¥È¤·¤Þ¤¹¡£
|
|
.Pp
|
|
ÇÛÎóÍѤ˳äÅö¤Æ¤é¤ì¤¿¥á¥â¥ê¤ò
|
|
.Xr free 3
|
|
¤Ç³äÅö¤Æ²ò½ü¤Ç¤¤Þ¤¹¡£¤½¤Î¾ì¹ç¡¢
|
|
ÇÛÎóÆâ¤Î³Æ¥Ý¥¤¥ó¥¿¤ò²òÊü¤·¤Æ¤«¤é¡¢ÇÛÎó¼«ÂΤò²òÊü¤·¤Æ¤¯¤À¤µ¤¤¡£
|
|
.Sh ¿ÇÃÇ
|
|
¥Ç¥£¥ì¥¯¥È¥ê¤¬Æɤ߼è¤êÍѤ˳«¤±¤Ê¤¤¾ì¹ç¡¢¤Þ¤¿¤Ï
|
|
.Xr malloc 3
|
|
¤¬¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿¹½Â¤¤òÊÝ»ý¤¹¤ë¤Î¤Ë½½Ê¬¤Ê¥á¥â¥ê¤ò³ä¤êÅö¤Æ¤Ç¤¤Ê¤¤¾ì¹ç¤Ï
|
|
\-1 ¤òÊÖ¤·¤Þ¤¹¡£
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr directory 3 ,
|
|
.Xr malloc 3 ,
|
|
.Xr qsort 3 ,
|
|
.Xr dir 5
|
|
.Sh Îò»Ë
|
|
.Fn scandir
|
|
¤È
|
|
.Fn alphasort
|
|
´Ø¿ô¤Ï
|
|
.Bx 4.2
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|