Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

remove locale from logname(1)

0 views
Skip to first unread message

Jan Stary

unread,
Oct 12, 2016, 4:36:42 AM10/12/16
to te...@openbsd.org
Why does logname(1) need to setlocale?

Jan

Index: logname.c
===================================================================
RCS file: /cvs/src/usr.bin/logname/logname.c,v
retrieving revision 1.9
diff -u -p -r1.9 logname.c
--- logname.c 9 Oct 2015 01:37:08 -0000 1.9
+++ logname.c 12 Oct 2016 08:35:11 -0000
@@ -32,7 +32,6 @@

#include <stdio.h>
#include <stdlib.h>
-#include <locale.h>
#include <unistd.h>
#include <err.h>

@@ -43,8 +42,6 @@ main(int argc, char *argv[])
{
int ch;
char *p;
-
- setlocale(LC_ALL, "");

if (pledge("stdio", NULL) == -1)
err(1, "pledge");

Ingo Schwarze

unread,
Oct 13, 2016, 8:01:52 AM10/13/16
to Jan Stary, te...@openbsd.org
Hi,

Jan Stary wrote on Wed, Oct 12, 2016 at 10:36:12AM +0200:

> Why does logname(1) need to setlocale?

Because at some point in history, people thought doing as much work
as you can, even when it has no effect, brings you closer to
perfection (some may still labour in that vein).

Anyway, i just committed a cleanup diff based on earlier
work by tedu@ - a bit less intrusive than tedu@'s turd
polishing, a bit larger than this minimal diff.

Thanks for the reminder,
Ingo
0 new messages