version 1.17, 2016/06/07 14:11:16 |
version 1.18, 2016/06/07 16:49:23 |
|
|
$$.envlist = $2.envlist; |
$$.envlist = $2.envlist; |
} |
} |
} ; |
} ; |
|
|
option: TNOPASS { |
option: TNOPASS { |
$$.options = NOPASS; |
$$.options = NOPASS; |
} | TKEEPENV { |
} | TKEEPENV { |
|
|
errx(1, "can't allocate envlist"); |
errx(1, "can't allocate envlist"); |
$$.envlist[nenv] = $2.str; |
$$.envlist[nenv] = $2.str; |
$$.envlist[nenv + 1] = NULL; |
$$.envlist[nenv + 1] = NULL; |
} | envlist TSTRING '=' TSTRING { |
|
int nenv = arraylen($1.envlist); |
|
char *cp = NULL; |
|
|
|
if (*$2.str == '\0' || strchr($2.str, '=') != NULL) { |
|
yyerror("invalid setenv expression"); |
|
YYERROR; |
|
} |
|
if (!($$.envlist = reallocarray($1.envlist, |
|
nenv + 2, sizeof(char *)))) |
|
errx(1, "can't allocate envlist"); |
|
$$.envlist[nenv] = NULL; |
|
if (asprintf(&cp, "%s=%s", $2.str, $4.str) <= 0 || |
|
cp == NULL) |
|
errx(1,"asprintf failed"); |
|
$$.envlist[nenv] = cp; |
|
$$.envlist[nenv + 1] = NULL; |
|
} |
} |
|
|
|
|
ident: TSTRING { |
ident: TSTRING { |
$$.str = $1.str; |
$$.str = $1.str; |
} ; |
} ; |
|
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case '{': |
case '{': |
case '}': |
case '}': |
case '=': |
|
return c; |
return c; |
case '#': |
case '#': |
/* skip comments; NUL is allowed; no continuation */ |
/* skip comments; NUL is allowed; no continuation */ |
|
|
case '#': |
case '#': |
case ' ': |
case ' ': |
case '\t': |
case '\t': |
case '=': |
|
if (!escape && !quotes) |
if (!escape && !quotes) |
goto eow; |
goto eow; |
break; |
break; |