13
int pathexec_env(const char *s,const char *t)
16
if (!stralloc_copys(&tmp,s)) return 0;
18
if (!stralloc_cats(&tmp,"=")) return 0;
19
if (!stralloc_cats(&tmp,t)) return 0;
21
if (!stralloc_0(&tmp)) return 0;
22
return stralloc_cat(&plus,&tmp);
25
void pathexec(const char *const *argv)
34
if (!stralloc_cats(&plus,"")) return;
37
for (i = 0;environ[i];++i)
39
for (i = 0;i < plus.len;++i)
43
e = (const char **) alloc((elen + 1) * sizeof(char *));
47
for (i = 0;environ[i];++i)
48
e[elen++] = environ[i];
51
for (i = 0;i < plus.len;++i)
53
split = str_chr(plus.s + j,'=');
54
for (t = 0;t < elen;++t)
55
if (byte_equal(plus.s + j,split,e[t]))
56
if (e[t][split] == '=') {
61
if (plus.s[j + split])
62
e[elen++] = plus.s + j;
67
pathexec_run(*argv,argv,e);