path: root/include
authorSergey Poznyakoff <>2019-05-15 13:37:09 (GMT)
committer Sergey Poznyakoff <>2019-05-15 13:37:09 (GMT)
commit20899f652a904b510b2c7d3507b75d1399416485 (patch) (side-by-side diff)
tree44f221b132d16f229fb991a03451d7039fb5f726 /include
parent7dbea4b03426d8a81dbc6563b96aa760e719f5a8 (diff)
wordsplit: introduce error context
* include/wordsplit.h (wordsplit) <ws_errctx>: New field. * src/wordsplit.c (wordsplit_init): Initialize ws_errctx. (expvar,wordsplit_pathexpand): Save error context. (wordsplit_clearerr): Free error context. (wordsplit_perror): Use error context if available. * tests/ Reflect changes.
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
1 files changed, 5 insertions, 1 deletions
diff --git a/include/wordsplit.h b/include/wordsplit.h
index 2fac3c6..0d6eef3 100644
--- a/include/wordsplit.h
+++ b/include/wordsplit.h
@@ -110,7 +110,7 @@ struct wordsplit
See ws_getvar for a discussion of possible
return values. */
- const char *ws_input; /* Input string (the S argument to wordsplit. */
+ const char *ws_input; /* Input string (the S argument to wordsplit). */
size_t ws_len; /* Length of ws_input. */
size_t ws_endp; /* Points past the last processed byte in
ws_input. */
@@ -118,6 +118,10 @@ struct wordsplit
char *ws_usererr; /* Points to textual description of
the error, if ws_errno is WRDSE_USERERR. Must
be allocated with malloc(3). */
+ char *ws_errctx; /* Context in which the error occurred:
+ For WRDSE_UNDEF - name of the undefined variable,
+ For WRDSE_GLOBERR - pattern that caused error.
+ */
struct wordsplit_node *ws_head, *ws_tail;
/* Doubly-linked list of parsed out nodes. */
char ws_sep[2]; /* Temporary storage used during splitting */

Return to:

Send suggestions and report system problems to the System administrator.