90 |
{ 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 }, |
{ 0, VSTRFIXED|VTEXTFIXED, "PS2=> ", 0 }, |
91 |
{ 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 }, |
{ 0, VSTRFIXED|VTEXTFIXED, "PS4=+ ", 0 }, |
92 |
{ 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset }, |
{ 0, VSTRFIXED|VTEXTFIXED, "OPTIND=1", getoptsreset }, |
93 |
|
{ 0, VSTRFIXED|VTEXTFIXED, "LINENO=1", 0 }, |
94 |
#ifndef SMALL |
#ifndef SMALL |
95 |
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "TERM\0", 0 }, |
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "TERM\0", 0 }, |
96 |
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE\0", sethistsize }, |
{ 0, VSTRFIXED|VTEXTFIXED|VUNSET, "HISTSIZE\0", sethistsize }, |
169 |
} |
} |
170 |
|
|
171 |
/* |
/* |
|
* Safe version of setvar, returns 1 on success 0 on failure. |
|
|
*/ |
|
|
|
|
|
int |
|
|
setvarsafe(const char *name, const char *val, int flags) |
|
|
{ |
|
|
int err; |
|
|
volatile int saveint; |
|
|
struct jmploc *volatile savehandler = handler; |
|
|
struct jmploc jmploc; |
|
|
|
|
|
SAVEINT(saveint); |
|
|
if (setjmp(jmploc.loc)) |
|
|
err = 1; |
|
|
else { |
|
|
handler = &jmploc; |
|
|
setvar(name, val, flags); |
|
|
err = 0; |
|
|
} |
|
|
handler = savehandler; |
|
|
RESTOREINT(saveint); |
|
|
return err; |
|
|
} |
|
|
|
|
|
/* |
|
172 |
* Set the value of a variable. The flags argument is ored with the |
* Set the value of a variable. The flags argument is ored with the |
173 |
* flags of the variable. If val is NULL, the variable is unset. |
* flags of the variable. If val is NULL, the variable is unset. |
174 |
*/ |
*/ |
203 |
INTON; |
INTON; |
204 |
} |
} |
205 |
|
|
206 |
|
/* |
207 |
|
* Set the given integer as the value of a variable. The flags argument is |
208 |
|
* ored with the flags of the variable. |
209 |
|
*/ |
210 |
|
|
211 |
|
intmax_t setvarint(const char *name, intmax_t val, int flags) |
212 |
|
{ |
213 |
|
int len = max_int_length(sizeof(val)); |
214 |
|
char buf[len]; |
215 |
|
|
216 |
|
fmtstr(buf, len, "%jd", val); |
217 |
|
setvar(name, buf, flags); |
218 |
|
return val; |
219 |
|
} |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
/* |
/* |
309 |
return NULL; |
return NULL; |
310 |
} |
} |
311 |
|
|
312 |
|
intmax_t lookupvarint(const char *name) |
313 |
|
{ |
314 |
|
return atomax(lookupvar(name) ?: nullstr, 0); |
315 |
|
} |
316 |
|
|
317 |
|
|
318 |
|
|
319 |
/* |
/* |