- errx(1, "can't allocate envlist");
- $$.envlist[nenv] = $2.str;
- $$.envlist[nenv + 1] = NULL;
- }
-
-setenvlist: /* empty */ {
- if (!($$.setenvlist = calloc(1, sizeof(char *))))
- errx(1, "can't allocate setenvlist");
- } | setenvlist TSTRING '=' TSTRING {
- int nenv = arraylen($1.setenvlist);
- char *cp = NULL;
-
- if (*$2.str == '\0' || strchr($2.str, '=') != NULL) {
- yyerror("invalid setenv expression");
- YYERROR;
- }
- if (!($$.setenvlist = reallocarray($1.setenvlist,
- nenv + 2, sizeof(char *))))
- errx(1, "can't allocate envlist");
- $$.setenvlist[nenv] = NULL;
- if (asprintf(&cp, "%s=%s", $2.str, $4.str) <= 0 ||
- cp == NULL)
- errx(1,"asprintf failed");
- $$.setenvlist[nenv] = cp;
- $$.setenvlist[nenv + 1] = NULL;
- }
+ errx(1, "can't allocate strlist");
+ $$.strlist[nstr] = $2.str;
+ $$.strlist[nstr + 1] = NULL;
+ } ;