aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/wordsplit.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/wordsplit.h b/include/wordsplit.h
index a175275..d7eb26f 100644
--- a/include/wordsplit.h
+++ b/include/wordsplit.h
@@ -76,6 +76,16 @@ struct wordsplit
size_t ws_envidx; /* Index of first free slot */
size_t ws_envsiz; /* Size of the ws_envbuf array */
+ char const **ws_paramv; /* [WRDSO_PARAMV] User-supplied positional
+ parameters */
+ size_t ws_paramc; /* Number of positional parameters */
+
+ /* Temporary storage for parameters. Works similarly to ws_enbuf.
+ */
+ char **ws_parambuf;
+ size_t ws_paramidx;
+ size_t ws_paramsiz;
+
int (*ws_getvar) (char **ret, const char *var, size_t len, void *clos);
/* [Input] (WRDSF_GETVAR, !WRDSF_NOVAR) Looks up
the name VAR (LEN bytes long) in the table of
@@ -226,6 +236,12 @@ struct wordsplit
$(echo foo bar) */
#define WRDSO_NOCMDSPLIT 0x00002000
+/* Enable positional parameters */
+#define WRDSO_PARAMV 0x00004000
+/* Enable negative positional indices (${-1} is the last positional
+ parameter) */
+#define WRDSO_PARAM_NEGIDX 0x00008000
+
#define WRDSO_BSKEEP WRDSO_BSKEEP_WORD
#define WRDSO_OESC WRDSO_OESC_WORD
#define WRDSO_XESC WRDSO_XESC_WORD
@@ -250,12 +266,14 @@ struct wordsplit
#define WRDSE_PAREN 7
#define WRDSE_GLOBERR 8
#define WRDSE_USERERR 9
+#define WRDSE_BADPARAM 10
int wordsplit (const char *s, wordsplit_t *ws, int flags);
int wordsplit_len (const char *s, size_t len, wordsplit_t *ws, int flags);
void wordsplit_free (wordsplit_t *ws);
void wordsplit_free_words (wordsplit_t *ws);
void wordsplit_free_envbuf (wordsplit_t *ws);
+void wordsplit_free_parambuf (struct wordsplit *ws);
int wordsplit_get_words (wordsplit_t *ws, size_t *wordc, char ***wordv);
static inline void wordsplit_getwords (wordsplit_t *ws, size_t *wordc, char ***wordv)

Return to:

Send suggestions and report system problems to the System administrator.