Update to 960810.
[glibc.git] / posix / wordexp.h
blob76e366d00160b3e1134be7bceff5065ad6091733
1 /* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 #ifndef _WORDEXP_H
21 #define _WORDEXP_H 1
22 #include <features.h>
24 __BEGIN_DECLS
26 /* Bits set in the FLAGS argument to `wordexp'. */
27 enum
29 WRDE_DOOFFS = (1 << 0), /* Insert PWORDEXP->we_offs NULLs. */
30 WRDE_APPEND = (1 << 1), /* Append to results of a previous call. */
31 WRDE_NOCMD = (1 << 2), /* Don't do command substitution. */
32 WRDE_REUSE = (1 << 3), /* Reuse storage in PWORDEXP. */
33 WRDE_SHOWERR = (1 << 4), /* Don't redirect stderr to /dev/null. */
34 WRDE_UNDEF = (1 << 5), /* Error for expanding undefined variables. */
35 __WRDE_FLAGS = (WRDE_DOOFFS | WRDE_APPEND | WRDE_NOCMD |
36 WRDE_REUSE | WRDE_SHOWERR | WRDE_UNDEF),
39 /* Structure describing a word-expansion run. */
40 typedef struct
42 int we_wordc; /* Count of words matched. */
43 char **we_wordv; /* List of expanded words. */
44 int we_offs; /* Slots to reserve in `we_wordv'. */
45 } wordexp_t;
47 /* Possible nonzero return values from `wordexp'. */
48 enum
50 WRDE_NOSPACE = 1, /* Ran out of memory. */
51 WRDE_BADCHAR, /* A metachar appears in the wrong place. */
52 WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */
53 WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */
54 WRDE_SYNTAX /* Shell syntax error. */
57 /* Do word expansion of WORDS into PWORDEXP. */
58 extern int wordexp __P ((__const char *__words, wordexp_t * __pwordexp,
59 int __flags));
61 /* Free the storage allocated by a `wordexp' call. */
62 extern void wordfree __P ((wordexp_t *));
64 __END_DECLS
66 #endif /* wordexp.h */