summaryrefslogtreecommitdiffabout
path: root/include/wordsplit.h
Side-by-side diff
Diffstat (limited to 'include/wordsplit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--include/wordsplit.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/wordsplit.h b/include/wordsplit.h
index 1a047f7..3a7ab25 100644
--- a/include/wordsplit.h
+++ b/include/wordsplit.h
@@ -1,5 +1,5 @@
/* wordsplit - a word splitter
- Copyright (C) 2009-2018 Sergey Poznyakoff
+ Copyright (C) 2009-2019 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -66,9 +66,15 @@ struct wordsplit
const char **ws_env; /* [Input] (WRDSF_ENV, !WRDSF_NOVAR) Array of
environment variables. */
- char **ws_envbuf;
- size_t ws_envidx;
- size_t ws_envsiz;
+ /* Temporary storage for environment variables. It is initialized
+ upon first assignment which occurs during the parsing process
+ (e.g. ${x:=2}). When this happens, all variables from ws_env are
+ moved to ws_envbuf first, and the ws_envbuf address is assigned
+ to ws_env. From this moment on, all variable expansions are served
+ from ws_envbuf. */
+ char **ws_envbuf; /* Storage for variables */
+ size_t ws_envidx; /* Index of first free slot */
+ size_t ws_envsiz; /* Size of the ws_envbuf array */
int (*ws_getvar) (char **ret, const char *var, size_t len, void *clos);
/* [Input] (WRDSF_GETVAR, !WRDSF_NOVAR) Looks up
@@ -197,8 +203,8 @@ struct wordsplit
#define WRDSO_DOTGLOB 0x00000004
#if 0 /* Unused value */
#define WRDSO_ARGV 0x00000008
-/* Keep backslash in unrecognized escape sequences in words */
#endif
+/* Keep backslash in unrecognized escape sequences in words */
#define WRDSO_BSKEEP_WORD 0x00000010
/* Handle octal escapes in words */
#define WRDSO_OESC_WORD 0x00000020

Return to:

Send suggestions and report system problems to the System administrator.