aboutsummaryrefslogtreecommitdiff
path: root/cbs.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-07-02 00:34:12 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-07-02 00:34:12 +0200
commitf05c9eddc9f4dff41016b5363925e59c2de671e2 (patch)
treef5c9bcaf2ed1def2f5f63b45192b093ae7413637 /cbs.h
parent82c4e29648e972de9eb0836cf3e9f89fc8cee7d8 (diff)
Completely rework how types are handled
Diffstat (limited to 'cbs.h')
-rw-r--r--cbs.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/cbs.h b/cbs.h
index 0295bbf..6618636 100644
--- a/cbs.h
+++ b/cbs.h
@@ -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