aboutsummaryrefslogtreecommitdiff
path: root/include/wordsplit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/wordsplit.h')
-rw-r--r--include/wordsplit.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/include/wordsplit.h b/include/wordsplit.h
index d7eb26f..d4975b3 100644
--- a/include/wordsplit.h
+++ b/include/wordsplit.h
@@ -30,16 +30,16 @@ typedef struct wordsplit wordsplit_t;
30 must be set (or unset, if starting with !) in ws_flags (if starting with 30 must be set (or unset, if starting with !) in ws_flags (if starting with
31 WRDSF_) or ws_options (if starting with WRDSO_) to initialize or use the 31 WRDSF_) or ws_options (if starting with WRDSO_) to initialize or use the
32 given member. 32 given member.
33 33
34 If not redefined explicitly, most of them are set to some reasonable 34 If not redefined explicitly, most of them are set to some reasonable
35 default value upon entry to wordsplit(). */ 35 default value upon entry to wordsplit(). */
36struct wordsplit 36struct wordsplit
37{ 37{
38 size_t ws_wordc; /* [Output] Number of words in ws_wordv. */ 38 size_t ws_wordc; /* [Output] Number of words in ws_wordv. */
39 char **ws_wordv; /* [Output] Array of parsed out words. */ 39 char **ws_wordv; /* [Output] Array of parsed out words. */
40 size_t ws_offs; /* [Input] (WRDSF_DOOFFS) Number of initial 40 size_t ws_offs; /* [Input] (WRDSF_DOOFFS) Number of initial
41 elements in ws_wordv to fill with NULLs. */ 41 elements in ws_wordv to fill with NULLs. */
42 size_t ws_wordn; /* Number of elements ws_wordv can accomodate. */ 42 size_t ws_wordn; /* Number of elements ws_wordv can accomodate. */
43 int ws_flags; /* [Input] Flags passed to wordsplit. */ 43 int ws_flags; /* [Input] Flags passed to wordsplit. */
44 int ws_options; /* [Input] (WRDSF_OPTIONS) 44 int ws_options; /* [Input] (WRDSF_OPTIONS)
45 Additional options. */ 45 Additional options. */
@@ -53,15 +53,15 @@ struct wordsplit
53 const char *ws_escape[2]; /* [Input] (WRDSF_ESCAPE) Characters to be escaped 53 const char *ws_escape[2]; /* [Input] (WRDSF_ESCAPE) Characters to be escaped
54 with backslash. */ 54 with backslash. */
55 void (*ws_alloc_die) (wordsplit_t *wsp); 55 void (*ws_alloc_die) (wordsplit_t *wsp);
56 /* [Input] (WRDSF_ALLOC_DIE) Function called when 56 /* [Input] (WRDSF_ALLOC_DIE) Function called when
57 out of memory. Must not return. */ 57 out of memory. Must not return. */
58 void (*ws_error) (const char *, ...) 58 void (*ws_error) (const char *, ...)
59 __attribute__ ((__format__ (__printf__, 1, 2))); 59 __attribute__ ((__format__ (__printf__, 1, 2)));
60 /* [Input] (WRDSF_ERROR) Function used for error 60 /* [Input] (WRDSF_ERROR) Function used for error
61 reporting */ 61 reporting */
62 void (*ws_debug) (const char *, ...) 62 void (*ws_debug) (const char *, ...)
63 __attribute__ ((__format__ (__printf__, 1, 2))); 63 __attribute__ ((__format__ (__printf__, 1, 2)));
64 /* [Input] (WRDSF_DEBUG) Function used for debug 64 /* [Input] (WRDSF_DEBUG) Function used for debug
65 output. */ 65 output. */
66 const char **ws_env; /* [Input] (WRDSF_ENV, !WRDSF_NOVAR) Array of 66 const char **ws_env; /* [Input] (WRDSF_ENV, !WRDSF_NOVAR) Array of
67 environment variables. */ 67 environment variables. */
@@ -80,14 +80,14 @@ struct wordsplit
80 parameters */ 80 parameters */
81 size_t ws_paramc; /* Number of positional parameters */ 81 size_t ws_paramc; /* Number of positional parameters */
82 82
83 /* Temporary storage for parameters. Works similarly to ws_enbuf. 83 /* Temporary storage for parameters. Works similarly to ws_enbuf.
84 */ 84 */
85 char **ws_parambuf; 85 char **ws_parambuf;
86 size_t ws_paramidx; 86 size_t ws_paramidx;
87 size_t ws_paramsiz; 87 size_t ws_paramsiz;
88 88
89 int (*ws_getvar) (char **ret, const char *var, size_t len, void *clos); 89 int (*ws_getvar) (char **ret, const char *var, size_t len, void *clos);
90 /* [Input] (WRDSF_GETVAR, !WRDSF_NOVAR) Looks up 90 /* [Input] (WRDSF_GETVAR, !WRDSF_NOVAR) Looks up
91 the name VAR (LEN bytes long) in the table of 91 the name VAR (LEN bytes long) in the table of
92 variables and if found returns in memory 92 variables and if found returns in memory
93 location pointed to by RET the value of that 93 location pointed to by RET the value of that
@@ -96,13 +96,13 @@ struct wordsplit
96 on error. User-specific errors can be returned 96 on error. User-specific errors can be returned
97 by storing the error diagnostic string in RET 97 by storing the error diagnostic string in RET
98 and returning WRDSE_USERERR. 98 and returning WRDSE_USERERR.
99 Whatever is stored in RET, it must be allocated 99 Whatever is stored in RET, it must be allocated
100 using malloc(3). */ 100 using malloc(3). */
101 void *ws_closure; /* [Input] (WRDSF_CLOSURE) Passed as the CLOS 101 void *ws_closure; /* [Input] (WRDSF_CLOSURE) Passed as the CLOS
102 argument to ws_getvar and ws_command. */ 102 argument to ws_getvar and ws_command. */
103 int (*ws_command) (char **ret, const char *cmd, size_t len, char **argv, 103 int (*ws_command) (char **ret, const char *cmd, size_t len, char **argv,
104 void *clos); 104 void *clos);
105 /* [Input] (!WRDSF_NOCMD) Returns in the memory 105 /* [Input] (!WRDSF_NOCMD) Returns in the memory
106 location pointed to by RET the expansion of 106 location pointed to by RET the expansion of
107 the command CMD (LEN bytes long). On input, 107 the command CMD (LEN bytes long). On input,
108 ARGV contains CMD split out to words. 108 ARGV contains CMD split out to words.
@@ -110,7 +110,7 @@ struct wordsplit
110 See ws_getvar for a discussion of possible 110 See ws_getvar for a discussion of possible
111 return values. */ 111 return values. */
112 112
113 const char *ws_input; /* Input string (the S argument to wordsplit. */ 113 const char *ws_input; /* Input string (the S argument to wordsplit. */
114 size_t ws_len; /* Length of ws_input. */ 114 size_t ws_len; /* Length of ws_input. */
115 size_t ws_endp; /* Points past the last processed byte in 115 size_t ws_endp; /* Points past the last processed byte in
116 ws_input. */ 116 ws_input. */
@@ -119,7 +119,7 @@ struct wordsplit
119 the error, if ws_errno is WRDSE_USERERR. Must 119 the error, if ws_errno is WRDSE_USERERR. Must
120 be allocated with malloc(3). */ 120 be allocated with malloc(3). */
121 struct wordsplit_node *ws_head, *ws_tail; 121 struct wordsplit_node *ws_head, *ws_tail;
122 /* Doubly-linked list of parsed out nodes. */ 122 /* Doubly-linked list of parsed out nodes. */
123 int ws_lvl; /* Invocation nesting level. */ 123 int ws_lvl; /* Invocation nesting level. */
124}; 124};
125 125
@@ -242,9 +242,9 @@ struct wordsplit
242 parameter) */ 242 parameter) */
243#define WRDSO_PARAM_NEGIDX 0x00008000 243#define WRDSO_PARAM_NEGIDX 0x00008000
244 244
245#define WRDSO_BSKEEP WRDSO_BSKEEP_WORD 245#define WRDSO_BSKEEP WRDSO_BSKEEP_WORD
246#define WRDSO_OESC WRDSO_OESC_WORD 246#define WRDSO_OESC WRDSO_OESC_WORD
247#define WRDSO_XESC WRDSO_XESC_WORD 247#define WRDSO_XESC WRDSO_XESC_WORD
248 248
249/* Indices into ws_escape */ 249/* Indices into ws_escape */
250#define WRDSX_WORD 0 250#define WRDSX_WORD 0

Return to:

Send suggestions and report system problems to the System administrator.