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
|
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
.\"
.\" This is free documentation; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License as
.\" published by the Free Software Foundation; either version 2 of
.\" the License, or (at your option) any later version.
.\"
.\" The GNU General Public License's references to "object code"
.\" and "executables" are to be interpreted as the output of any
.\" document formatting or typesetting system, including
.\" intermediate and printed output.
.\"
.\" This manual is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, write to the Free
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
.\" USA.
.\"
.\" Japanese Version Copyright (c) 2004 Yuichi SATO
.\" all rights reserved.
.\" Translated Sun Sep 12 05:05:19 JST 2004
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.TH WORDEXP 3 2008-07-14 "" "Linux Programmer's Manual"
.SH ̾
wordexp, wordfree \- posix Τ褦ñŸԤ
.SH
.B "#include <wordexp.h>"
.sp
.BI "int wordexp(const char *" s ", wordexp_t *" p ", int " flags );
.sp
.BI "void wordfree(wordexp_t *" p );
.sp
.in -4n
glibc εǽޥ
.RB ( feature_test_macros (7)
):
.in
.sp
.BR wordexp (),
.BR wordfree ():
_XOPEN_SOURCE
.SH
ؿ
.BR wordexp ()
ϥΤ褦ʸ
.I s
Ÿ
.I p
ǻؤ¤Τ˷̤֤
ǡ
.I wordexp_t
ϾʤȤե
.IR we_wordc ,
.IR we_wordv ,
.I we_offs
ŤΤǤ롣
ե
.I we_wordc
.I size_t
Ǥꡢ
.I s
Ÿ̤ñ줬Ĥ뤫ɽ
ե
.I we_wordv
.I char **
ǤꡢĤäñؤ
.I size_t
Υե
.I we_offs
ϡ
.I we_wordv
ˤǤΤĤ
NULL ٤ɽΤ˻Ȥ줿ꤹ
.RI ( flags
ˤꤵ롣ȡ)
.LP
ؿ
.BR wordfree ()
ϳƤٲ롣
ΤˤȡδؿϤΰΤǤϤʤ
.I we_wordv
Ȥ줬ؤʸ롣
.SS "ʸ"
Ÿϥˤ륳ޥɤΥѥŸ
.RB ( sh (1)
) ƱǤΤǡʸ
.I s
ϥ륳ޥɥѥȤʸޤǤϤʤʤ
ä˥פƤʤԡ|, &, ;, <, >, (, ), {, } ʸ
ޥִѥִξ̰ʳ˴ޤƤϤʤʤ
.LP
.I s
˥ȤƤʤʸ # ǻϤޤñ줬ޤޤƤˤϡ
ñȤʹߤñ줬̵뤵뤫
Ȥ # ʸȤưʤϡꤵƤʤ
.SS "Ÿ"
¹ԤŸϡʲʳǹ:
Ÿ (~user user Υۡǥ쥯ȥ֤)
ѿŸ ($FOO Ķѿ FOO ֤ͤ)
ޥŸ ($(command) ޤ \`command\` command νϤ֤)
Ÿեʬ䡢磻ɥŸȤν
.LP
üʥѥ ($@, $*, $#, $?, $\-, $$, $!, $0)
Ÿ̤ϵꤵƤʤ
.LP
եʬϴĶѿ $IFS ѤƹԤ롣
δĶѿꤵƤʤ硢
եɶڤʸϥڡ֡ԤǤ롣
.SS "Ϥ"
.I we_wordv
ϸĤäñޤߡǸ NULL ³
.SS "flags "
.I flags
ϰʲͤΥӥåŪ OR Ǥ:
.TP
.B WRDE_APPEND
ĤäñθƤӽФ̤ɲä롣
.TP
.B WRDE_DOOFFS
֤Ǥ
.I we_offs
Ĥ NULL
.I we_wordv
(֤
.I we_wordc
ˤϥȤʤ)
.TP
.B WRDE_NOCMD
ޥִԤʤ
.TP
.B WRDE_REUSE
.I p
.BR wordexp ()
θƤӽФ̤Ǥꡢ
.BR wordfree ()
(ޤ) ƤӽФʤ
Ƥ줿ΰѤ롣
.TP
.B WRDE_SHOWERR
̾ϥޥִΤȤ
.I stderr
.I /dev/null
˥쥯Ȥ롣
Υե饰
.I stderr
쥯Ȥʤ褦˻ꤹ롣
.TP
.B WRDE_UNDEF
̤ΥѿŸ褦Ȥˡ顼Ȥư
.SH ֤
0 ֤롣
顼ξϰʲ 5 ĤͤΤ 1 Ĥ֤롣
.TP
.B WRDE_BADCHAR
Ԥޤ |, &, ;, <, >, (, ), {, } Τ 1 Ĥ˽и
.TP
.B WRDE_BADVAL
̤ΥѿȤ졢
.B WRDE_UNDEF
ե饰Ǥ顼Ȥư褦˻ؼƤ롣
.TP
.B WRDE_CMDSUB
ޥִꡢ
.B WRDE_NOCMD
ե饰Ǥ顼Ȥư褦˻ؼƤ롣
.TP
.B WRDE_NOSPACE
꤬ʤ
.TP
.B WRDE_SYNTAX
б̤ʤȤפʤȤä
ν顼
.SH С
.BR wordexp ()
.BR wordfree ()
ϡС 2.1 ʹߤ glibc Ƥ롣
.SH
POSIX.1-2001.
.SH
ʲΥץץνϤϤ "ls [a-c]*.c" Ʊˤʤ롣
.LP
.nf
#include <stdio.h>
#include <stdlib.h>
#include <wordexp.h>
int
main(int argc, char **argv)
{
wordexp_t p;
char **w;
int i;
wordexp("[a-c]*.c", &p, 0);
w = p.we_wordv;
for (i = 0; i < p.we_wordc; i++)
printf("%s\en", w[i]);
wordfree(&p);
exit(EXIT_SUCCESS);
}
.fi
.SH Ϣ
.BR fnmatch (3),
.BR glob (3)
|