You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.5KB

  1. /* Copyright (C) 2002, 2010 by Red Hat, Incorporated. All rights reserved.
  2. *
  3. * Permission to use, copy, modify, and distribute this software
  4. * is freely granted, provided that this notice is preserved.
  5. */
  6. #ifndef _WORDEXP_H_
  7. #define _WORDEXP_H_
  8. #include <sys/types.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. struct _wordexp_t
  13. {
  14. size_t we_wordc; /* Count of words matched by words. */
  15. char **we_wordv; /* Pointer to list of expanded words. */
  16. size_t we_offs; /* Slots to reserve at the beginning of we_wordv. */
  17. };
  18. typedef struct _wordexp_t wordexp_t;
  19. #define WRDE_DOOFFS 0x0001 /* Use we_offs. */
  20. #define WRDE_APPEND 0x0002 /* Append to output from previous call. */
  21. #define WRDE_NOCMD 0x0004 /* Don't perform command substitution. */
  22. #define WRDE_REUSE 0x0008 /* pwordexp points to a wordexp_t struct returned from
  23. a previous successful call to wordexp. */
  24. #define WRDE_SHOWERR 0x0010 /* Print error messages to stderr. */
  25. #define WRDE_UNDEF 0x0020 /* Report attempt to expand undefined shell variable. */
  26. enum {
  27. WRDE_SUCCESS,
  28. WRDE_NOSPACE,
  29. WRDE_BADCHAR,
  30. WRDE_BADVAL,
  31. WRDE_CMDSUB,
  32. WRDE_SYNTAX,
  33. WRDE_NOSYS
  34. };
  35. /* Note: This implementation of wordexp requires a version of bash
  36. that supports the --wordexp and --protected arguments to be present
  37. on the system. It does not support the WRDE_UNDEF flag. */
  38. int wordexp(const char *__restrict, wordexp_t *__restrict, int);
  39. void wordfree(wordexp_t *);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* _WORDEXP_H_ */