|
Packit |
6c4009 |
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#ifndef _WORDEXP_H
|
|
Packit |
6c4009 |
#define _WORDEXP_H 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <features.h>
|
|
Packit |
6c4009 |
#define __need_size_t
|
|
Packit |
6c4009 |
#include <stddef.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__BEGIN_DECLS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Bits set in the FLAGS argument to `wordexp'. */
|
|
Packit |
6c4009 |
enum
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
WRDE_DOOFFS = (1 << 0), /* Insert PWORDEXP->we_offs NULLs. */
|
|
Packit |
6c4009 |
WRDE_APPEND = (1 << 1), /* Append to results of a previous call. */
|
|
Packit |
6c4009 |
WRDE_NOCMD = (1 << 2), /* Don't do command substitution. */
|
|
Packit |
6c4009 |
WRDE_REUSE = (1 << 3), /* Reuse storage in PWORDEXP. */
|
|
Packit |
6c4009 |
WRDE_SHOWERR = (1 << 4), /* Don't redirect stderr to /dev/null. */
|
|
Packit |
6c4009 |
WRDE_UNDEF = (1 << 5), /* Error for expanding undefined variables. */
|
|
Packit |
6c4009 |
__WRDE_FLAGS = (WRDE_DOOFFS | WRDE_APPEND | WRDE_NOCMD |
|
|
Packit |
6c4009 |
WRDE_REUSE | WRDE_SHOWERR | WRDE_UNDEF)
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Structure describing a word-expansion run. */
|
|
Packit |
6c4009 |
typedef struct
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
size_t we_wordc; /* Count of words matched. */
|
|
Packit |
6c4009 |
char **we_wordv; /* List of expanded words. */
|
|
Packit |
6c4009 |
size_t we_offs; /* Slots to reserve in `we_wordv'. */
|
|
Packit |
6c4009 |
} wordexp_t;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Possible nonzero return values from `wordexp'. */
|
|
Packit |
6c4009 |
enum
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
#ifdef __USE_XOPEN
|
|
Packit |
6c4009 |
WRDE_NOSYS = -1, /* Never used since we support `wordexp'. */
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
WRDE_NOSPACE = 1, /* Ran out of memory. */
|
|
Packit |
6c4009 |
WRDE_BADCHAR, /* A metachar appears in the wrong place. */
|
|
Packit |
6c4009 |
WRDE_BADVAL, /* Undefined var reference with WRDE_UNDEF. */
|
|
Packit |
6c4009 |
WRDE_CMDSUB, /* Command substitution with WRDE_NOCMD. */
|
|
Packit |
6c4009 |
WRDE_SYNTAX /* Shell syntax error. */
|
|
Packit |
6c4009 |
};
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Do word expansion of WORDS into PWORDEXP. */
|
|
Packit |
6c4009 |
extern int wordexp (const char *__restrict __words,
|
|
Packit |
6c4009 |
wordexp_t *__restrict __pwordexp, int __flags);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Free the storage allocated by a `wordexp' call. */
|
|
Packit |
6c4009 |
extern void wordfree (wordexp_t *__wordexp) __THROW;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
__END_DECLS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif /* wordexp.h */
|