]> git.ipfire.org Git - thirdparty/glibc.git/blame - posix/wordexp.h
initial import
[thirdparty/glibc.git] / posix / wordexp.h
CommitLineData
28f540f4
RM
1/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2This file is part of the GNU C Library.
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
19#ifndef _WORDEXP_H
20
21#define _WORDEXP_H 1
22#include <features.h>
23
24__BEGIN_DECLS
25
26/* Bits set in the FLAGS argument to `wordexp'. */
27enum
28 {
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),
37 };
38
39/* Structure describing a word-expansion run. */
40typedef struct
41 {
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;
46
47/* Possible nonzero return values from `wordexp'. */
48enum
49 {
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. */
55 };
56
57/* Do word expansion of WORDS into PWORDEXP. */
58extern int wordexp __P ((__const char *__words, wordexp_t * __pwordexp,
59 int __flags));
60
61/* Free the storage allocated by a `wordexp' call. */
62extern void wordfree __P ((wordexp_t *));
63
64__END_DECLS
65
66#endif /* wordexp.h */