Merge commit '508de9f313d4260d23954085ed866e727901964c'
[unleashed/lotheac.git] / include / wordexp.h
bloba5513c3986b9d09989cdcd8fa461339da9e461b8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
25 * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
26 * Use is subject to license terms.
30 * Copyright 1985, 1992 by Mortice Kern Systems Inc. All rights reserved.
33 #ifndef _WORDEXP_H
34 #define _WORDEXP_H
36 #include <sys/feature_tests.h>
37 #include <sys/types.h>
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
43 typedef struct wordexp_t {
44 size_t we_wordc; /* Count of paths matched by pattern */
45 char **we_wordv; /* List of matched pathnames */
46 size_t we_offs; /* # of slots reserved in we_pathv */
47 /* following are internal to the implementation */
48 char **we_wordp; /* we_pathv + we_offs */
49 int we_wordn; /* # of elements allocated */
50 } wordexp_t;
53 * wordexp flags.
55 #define WRDE_APPEND 0x0001 /* append to existing wordexp_t */
56 #define WRDE_DOOFFS 0x0002 /* use we_offs */
57 #define WRDE_NOCMD 0x0004 /* don't allow $() */
58 #define WRDE_REUSE 0x0008
59 #define WRDE_SHOWERR 0x0010 /* don't 2>/dev/null */
60 #define WRDE_UNDEF 0x0020 /* set -u */
63 * wordexp errors.
65 #define WRDE_ERRNO (2) /* error in "errno" */
66 #define WRDE_BADCHAR (3) /* shell syntax character */
67 #define WRDE_BADVAL (4) /* undefined variable expanded */
68 #define WRDE_CMDSUB (5) /* prohibited $() */
69 #define WRDE_NOSPACE (6) /* no memory */
70 #define WRDE_SYNTAX (7) /* bad syntax */
71 #define WRDE_NOSYS (8) /* function not supported (XPG4) */
73 extern int wordexp(const char *_RESTRICT_KYWD, wordexp_t *_RESTRICT_KYWD, int);
74 extern void wordfree(wordexp_t *);
76 #ifdef __cplusplus
78 #endif
80 #endif /* _WORDEXP_H */