summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-10-13 11:51:03 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-10-13 11:51:03 +0000
commit85da768cfccb598b5c16c21df5bb9ba34d347b8d (patch)
treeed2a9b2cfd9225fcc16a3e260c3683ed94054d0f /usr.bin
parentd5e5e0ec0e74911979785a1a99ba4660b9f649cc (diff)
delete useless call to setlocale(3); while here, polish style:
sort headers, static __dead usage(), return from main etc... based on a more intrusive diff by tedu@, reminded by Jan Stary <hans at stare dot cz>, using feedback from millert@; OK tedu@, deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/logname/logname.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/usr.bin/logname/logname.c b/usr.bin/logname/logname.c
index 618a2d34843..ae137594b8e 100644
--- a/usr.bin/logname/logname.c
+++ b/usr.bin/logname/logname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logname.c,v 1.9 2015/10/09 01:37:08 deraadt Exp $ */
+/* $OpenBSD: logname.c,v 1.10 2016/10/13 11:51:02 schwarze Exp $ */
/* $NetBSD: logname.c,v 1.6 1994/12/22 06:39:32 jtc Exp $ */
/*-
@@ -30,13 +30,17 @@
* SUCH DAMAGE.
*/
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
-#include <locale.h>
#include <unistd.h>
-#include <err.h>
-void usage(void);
+static void __dead
+usage(void)
+{
+ (void)fprintf(stderr, "usage: logname\n");
+ exit(1);
+}
int
main(int argc, char *argv[])
@@ -44,33 +48,21 @@ main(int argc, char *argv[])
int ch;
char *p;
- setlocale(LC_ALL, "");
-
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
- case '?':
default:
usage();
- /* NOTREACHED */
}
- if (argc != optind) {
+ if (argc != optind)
usage();
- /* NOTREACHED */
- }
if ((p = getlogin()) == NULL)
err(1, NULL);
- (void)printf("%s\n", p);
- exit(0);
-}
-void
-usage(void)
-{
- (void)fprintf(stderr, "usage: logname\n");
- exit(1);
+ (void)printf("%s\n", p);
+ return 0;
}