Hi,

Martijn van Duren wrote on Wed, Nov 10, 2021 at 02:03:51PM +0100:

> I see no reason to keep it.
> OK martijn@ if anyone wants to commit this.

Done.

> On Wed, 2021-11-10 at 13:37 +0100, Jan Stary wrote:

>> Why does who(1) need to setlocale()?

On some systems, setlocale(LC_TIME) influences strftime(3).
But who(1) uses ctime(3) instead, and

  https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctime.html

explicitly mentions that ctime(3) does not support localized date and
time formats.

Anyway, we clearly do not want localization in such a place,
neither now nor in the future.

Yours,
  Ingo


>> Index: who.c
>> ===================================================================
>> RCS file: /cvs/src/usr.bin/who/who.c,v
>> retrieving revision 1.30
>> diff -u -p -r1.30 who.c
>> --- who.c    12 Jul 2021 15:09:20 -0000      1.30
>> +++ who.c    10 Nov 2021 12:37:05 -0000
>> @@ -44,7 +44,6 @@
>>  #include <unistd.h>
>>  #include <time.h>
>>  #include <err.h>
>> -#include <locale.h>
>>  
>>  void  output(struct utmp *);
>>  void  output_labels(void);
>> @@ -71,8 +70,6 @@ main(int argc, char *argv[])
>>      FILE *ufp;
>>      char *t;
>>      int c;
>> -
>> -    setlocale(LC_ALL, "");
>>  
>>      if (pledge("stdio unveil rpath getpw", NULL) == -1)
>>              err(1, "pledge");

Reply via email to