Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: set temporary environment variables for builtins
On 12/16/23, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> On Sat, Dec 16, 2023 at 9:28 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
>>
>> On Sat, Dec 16, 2023 at 12:22 PM Lawrence Velázquez <larryv@xxxxxxx>
>> wrote:
>> >
>> > It does work, in general.
>>
>> Well, no, it doesn't. It works for parameters that zsh separately
>> considers to be "special", which includes all the LC_* variants. TZ
>> is not special.
>
> In which sense is LC_TIME special for print but TZ is not?
Setting any of the LC_* parameters explicitly calls some locale stuff
(whether or not it is exported), apart from just setting the
parameters:
/**/
void
lcsetfn(Param pm, char *x)
{
char *x2;
struct localename *ln;
strsetfn(pm, x);
if ((x2 = getsparam("LC_ALL")) && *x2)
return;
queue_signals();
/* Treat empty LC_* the same as unset. */
if (!x || !*x)
x = getsparam("LANG");
/*
* If we've got no non-empty string at this
* point (after checking $LANG, too),
* we shouldn't bother setting anything.
*/
if (x && *x) {
for (ln = lc_names; ln->name; ln++)
if (!strcmp(ln->name, pm->node.nam))
setlocale(ln->category, unmeta(x));
}
unqueue_signals();
clear_mbstate(); /* LC_CTYPE may have changed */
inittyptab();
}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author