]>
Commit | Line | Data |
---|---|---|
688903eb | 1 | /* Copyright (C) 1991-2018 Free Software Foundation, Inc. |
54d79e99 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
54d79e99 | 4 | The GNU C Library is free software; you can redistribute it and/or |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
28f540f4 | 8 | |
54d79e99 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
28f540f4 RM |
17 | |
18 | #ifndef _WORDEXP_H | |
28f540f4 | 19 | #define _WORDEXP_H 1 |
5107cf1d | 20 | |
28f540f4 | 21 | #include <features.h> |
8a6c2217 UD |
22 | #define __need_size_t |
23 | #include <stddef.h> | |
28f540f4 RM |
24 | |
25 | __BEGIN_DECLS | |
26 | ||
27 | /* Bits set in the FLAGS argument to `wordexp'. */ | |
28 | enum | |
29 | { | |
30 | WRDE_DOOFFS = (1 << 0), /* Insert PWORDEXP->we_offs NULLs. */ | |
31 | WRDE_APPEND = (1 << 1), /* Append to results of a previous call. */ | |
32 | WRDE_NOCMD = (1 << 2), /* Don't do command substitution. */ | |
33 | WRDE_REUSE = (1 << 3), /* Reuse storage in PWORDEXP. */ | |
34 | WRDE_SHOWERR = (1 << 4), /* Don't redirect stderr to /dev/null. */ | |
35 | WRDE_UNDEF = (1 << 5), /* Error for expanding undefined variables. */ | |
36 | __WRDE_FLAGS = (WRDE_DOOFFS | WRDE_APPEND | WRDE_NOCMD | | |
24f25de6 | 37 | WRDE_REUSE | WRDE_SHOWERR | WRDE_UNDEF) |
28f540f4 RM |
38 | }; |
39 | ||
40 | /* Structure describing a word-expansion run. */ | |
41 | typedef struct | |
42 | { | |
8a6c2217 | 43 | size_t we_wordc; /* Count of words matched. */ |
28f540f4 | 44 | char **we_wordv; /* List of expanded words. */ |
8a6c2217 | 45 | size_t we_offs; /* Slots to reserve in `we_wordv'. */ |
28f540f4 RM |
46 | } wordexp_t; |
47 | ||
48 | /* Possible nonzero return values from `wordexp'. */ | |
49 | enum | |
50 | { | |
e918a7fe | 51 | #ifdef __USE_XOPEN |
9756dfe1 UD |
52 | WRDE_NOSYS = -1, /* Never used since we support `wordexp'. */ |
53 | #endif | |
28f540f4 RM |
54 | WRDE_NOSPACE = 1, /* Ran out of memory. */ |
55 | WRDE_BADCHAR, /* A metachar appears in the wrong place. */ | |
56 | WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */ | |
57 | WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */ | |
58 | WRDE_SYNTAX /* Shell syntax error. */ | |
59 | }; | |
60 | ||
61 | /* Do word expansion of WORDS into PWORDEXP. */ | |
a784e502 | 62 | extern int wordexp (const char *__restrict __words, |
f1c30c98 | 63 | wordexp_t *__restrict __pwordexp, int __flags); |
28f540f4 RM |
64 | |
65 | /* Free the storage allocated by a `wordexp' call. */ | |
c1422e5b | 66 | extern void wordfree (wordexp_t *__wordexp) __THROW; |
28f540f4 RM |
67 | |
68 | __END_DECLS | |
69 | ||
70 | #endif /* wordexp.h */ |