diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-15 16:37:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-15 16:37:09 +0300 |
commit | 20899f652a904b510b2c7d3507b75d1399416485 (patch) | |
tree | 44f221b132d16f229fb991a03451d7039fb5f726 /include/wordsplit.h | |
parent | 7dbea4b03426d8a81dbc6563b96aa760e719f5a8 (diff) | |
download | grecs-20899f652a904b510b2c7d3507b75d1399416485.tar.gz grecs-20899f652a904b510b2c7d3507b75d1399416485.tar.bz2 |
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/wordsplit.at: Reflect changes.
Diffstat (limited to 'include/wordsplit.h')
-rw-r--r-- | include/wordsplit.h | 6 |
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 */ |