Update.
[glibc.git] / posix / wordexp.h
blob32c2a3fb8076329092e57b43bc87496de81616b8
1 /* Copyright (C) 1991, 1992, 1996, 1997, 1998 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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _WORDEXP_H
20 #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 #ifdef __USE_XOPEN
51 WRDE_NOSYS = -1, /* Never used since we support `wordexp'. */
52 #endif
53 WRDE_NOSPACE = 1, /* Ran out of memory. */
54 WRDE_BADCHAR, /* A metachar appears in the wrong place. */
55 WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */
56 WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */
57 WRDE_SYNTAX /* Shell syntax error. */
60 /* Do word expansion of WORDS into PWORDEXP. */
61 extern int wordexp __P ((__const char *__restrict __words,
62 wordexp_t *__restrict __pwordexp, int __flags));
64 /* Free the storage allocated by a `wordexp' call. */
65 extern void wordfree __P ((wordexp_t *__wordexp));
67 __END_DECLS
69 #endif /* wordexp.h */