diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-07-02 00:34:12 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-07-02 00:34:12 +0200 |
commit | f05c9eddc9f4dff41016b5363925e59c2de671e2 (patch) | |
tree | f5c9bcaf2ed1def2f5f63b45192b093ae7413637 /cbs.h | |
parent | 82c4e29648e972de9eb0836cf3e9f89fc8cee7d8 (diff) |
Completely rework how types are handled
Diffstat (limited to 'cbs.h')
-rw-r--r-- | cbs.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -195,10 +195,22 @@ strspushenv(struct strs *xs, const char *ev, char **ys, size_t n) { /* NOTE: Do your best to NOT modify any pushed envvar! */ char *p = getenv(ev); - if (p == NULL || *p == 0) + if (p == NULL || *p == 0) { strspush(xs, ys, n); - else - strspush(xs, &p, 1); + return; + } + + wordexp_t we; + assert(wordexp(p, &we, WRDE_NOCMD) == 0); + + /* TODO: Memory leak! */ + for (size_t i = 0; i < we.we_wordc; i++) { + char *w = strdup(we.we_wordv[i]); + assert(w != NULL); + strspushl(xs, w); + } + + wordfree(&we); } bool |