File: glob.3

package info (click to toggle)
manpages-ja 0.5.0.0.20050315-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,620 kB
  • ctags: 4
  • sloc: sh: 12,675; perl: 157; makefile: 106
file content (263 lines) | stat: -rw-r--r-- 6,348 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" License.
.\" Modified Wed Jul 28 11:12:17 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Mon May 13 23:08:50 1996 by Martin Schulze (joey@linux.de)
.\" Modified 11 May 1998 by Joseph S. Myers (jsm28@cam.ac.uk)
.\" Modified 990912 by aeb
.\"
.\" Japanese Version Copyright (c) 1998 Ken Wakasa all rights reserved.
.\" Translated Wed Jun 24 1998 by Ken Wakasa <wakasa@iname.com>
.\" Updated Tue Jan  4 1999 by Kentaro Shirakata <argrath@yo.rim.or.jp>
.\"
.TH GLOB 3  "12 September 1999" "GNU" "Linux Programmer's Manual"
.SH ̾
glob, globfree \- ѥ˥ޥåѥ̾դ롣glob() ˤ
Ƴݤ줿ΰ롣
.SH 
.nf
.B #include <glob.h>
.sp
.BI "int glob(const char *" pattern ", int " flags ,
.nl
.BI "         int " errfunc "(const char *" epath ", int " eerrno ),
.nl
.BI "         glob_t *" pglob );
.nl
.BI "void globfree(glob_t *" pglob );
.fi
.SH 
.B glob()
ؿϥ뤬ѤƤ롼
.BR glob (7)
ȡˤ˴Ťƥѥ
.I pattern
˥ޥå뤹٤ƤΥѥ̾򸡺롣
 (~) Ÿѥ᡼ִϹԤʤԤ
.BR wordexp (3)
ȤȤ褤
.PP
.B globfree()
ؿ˸ƤФ줿
.BR glob()
ˤưŪ˳ݤ줿ΰ롣
.PP
.B glob()
η̤
.IR pglob
ݥȤ빽¤Τ֤롣
.IR pglob

.B glob_t
ι¤ΤǤ롣
.B glob_t

.B <glob.h>
ƤꡢʲǤޤǤ롣Ǥ POSIX.2 
Ƥʤ¿ǤĥȤäƤ뤫⤷ʤˡ
.PP
.br
.nf
.in 10
typedef struct
{
.in 14
    size_t gl_pathc;    /* ޤǤ˥ޥåѥο  */
    char **gl_pathv;    /* ޥåѥ̾Υꥹ  */
    size_t gl_offs;     /* `gl_pathv' ˳ݤ뤿Υå */
.in 10
} glob_t;
.fi
.PP
̤ưŪ˳ݤ줿ΰ롣
.PP
ѥ᡼
.I flags
ˤϰʲμΤꤷΤӥåȤȤ OR ͿʰĤ
ꤷʤƤ褤ˡˤä
.BR glob()
ưѹǤ롣
.TP
.B GLOB_ERR
ɤ߼ꥨ顼㤨Сǥ쥯ȥɤ߼°̵ʤɡ
˴ؿ롣
.TP
.B GLOB_MARK
ǥ쥯ȥ˰פơΥѥ˥åղä롣
.TP
.B GLOB_NOSORT
֤ѥ̾ΥȤԤʤʥǥեȡˡ
.TP
.B GLOB_DOOFFS
ʸꥹ
.IR pglob->pathv
Ƭ
.I pglob->gl_offs
ʬΰݤ롣
.TP
.B GLOB_NOCHECK
ޥåѥ̵СΥѥ֤
.TP
.B GLOB_APPEND
θƤӽФη̤ɲä롣ǽ
.BR glob()
θƤӽФκݤˤϤΥե饰ꤷƤϤʤ
.TP
.B GLOB_NOESCAPE
᥿饯ϥХååˤäƥȤʤ
.PP
ե饰ˤϰʲ˼ΤǤ롣 POSIX.2 ǤƤ
ʤ GNU dzĥ줿ΤǤ롣
.TP
.B GLOB_PERIOD
ƬΥԥꥪɤϥ᥿饯˥ޥå롣
.TP
.B GLOB_ALTDIRFUNC
ե륷ƥ˥ݤˡ̾Υ饤֥ؿ
.IR pglob->gl_closedir ,
.IR pglob->gl_readdir ,
.IR pglob->gl_opendir ,
.IR pglob->gl_lstat ",
.I pglob->gl_stat
Ѥ롣
.TP
.B GLOB_BRACE
.BR csh (1)
γɽ \fB{a,b}\fR Ÿ롣
.TP
.B GLOB_NOMAGIC
ѥ˥᥿饯ޤޤƤʤ硢Υѥ֤롣
.TP
.B GLOB_TILDE
 (~) ŸԤ롣
.TP
.B GLOB_ONLYDIR
ǥ쥯ȥΤߤޥå롣
.PP
.I errfunc

.BR NULL
ǤʤС
顼äˤϴؿ
.I errfunc
ƤӽФ롣ؿΰˤϡԤѥ̾
.IR epath

.IR errno

.BR opendir() ", " readdir() ", " stat()
Τ줫ˤäƥåȤ줿͡ˤͿ롣
.I errfunc
 0 ʳ֤ͤ⤷
.B GLOB_ERR
åȤ줿
.B glob()

.IR errfunc
θƤӽФ˽λ롣
.PP
ƤӽФä
.I pglob->gl_pathc
ˤϥޥåѥ̾ޤޤ졢
.I pglob->gl_pathv
ϥޥåѥ̾ΥꥹȤؤΥݥ󥿤Ȥʤ롣ǸΥѥ̾θκǽ
ݥ󥿤
.BR NULL
Ǥ롣
.PP
.B glob()
٤³ƸƤӽФȤǤ롣κ2ܰʹߤθƤӽФǤ
.B GLOB_APPEND
ե饰
.I flags
ꤵƤʤФʤʤ
.PP
GNU γĥȤơ
.I pglob->gl_flags
ˤϻꤷե饰åȤ롣⤷ĤǤ᥿饯դ
Υե饰
.B GLOB_MAGCHAR
Ȥ \fBOR\fR ä̤åȤ롣
.SH ֤
ƤӽФƴλ
.B glob()
 0 ֤
ʳ֤ͤϰʲ̤:
.TP
.B GLOB_NOSPACE
Ȥ̤
.TP
.B GLOB_ABORTED
ɤ߼ꥨ顼
.TP
.B GLOB_NOMATCH
Ĥޥåʤä
.SH 
ˡΰʲ˼ʲϥ
.nl
.B ls -l *.c ../*.c
.nl
򥿥פ򥷥ߥ졼ȤƤ롣
.nf
.in 10

glob_t globbuf;

globbuf.gl_offs = 2;
glob("*.c", GLOB_DOOFFS, NULL, &globbuf);
glob("../*.c", GLOB_DOOFFS | GLOB_APPEND, NULL, &globbuf);
globbuf.gl_pathv[0] = "ls";
globbuf.gl_pathv[1] = "-l";
execvp("ls", &globbuf.gl_pathv[0]);
.fi
.SH 
POSIX.2
.SH Х
.B glob()
ؿϤǸƤӽФƤ
.BR malloc() "  " opendir()
ʤɤδؿθƤӽФǼԤȼԤ롣
ˤ
.IR errno
ˤΥ顼ɤ롣
.SH 
glibc 2.1 Ǥϡ
.I gl_pathc

.I gl_offs
 POSIX.2 ǻꤵƤ褦
.BR size_t
ȤƤ롣
libc4, libc5, glibc 2.0 Ǥϡ
.BR int
ȤƤ롣
.SH Ϣ
.BR ls (1),
.BR sh (1),
.BR stat (2),
.BR exec (3),
.BR fnmatch (3),
.BR malloc (3),
.BR opendir (3),
.BR readdir (3),
.BR wordexp (3),
.BR glob (7)