aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-05-19 18:49:02 +0200
committerDuncaen <mail@duncano.de>2017-05-19 18:49:02 +0200
commitf7fb0e0302ad61b386c5303b0b66b01a353047c8 (patch)
tree8ef6a74382824f6f0b0d90130b68b36727713303
parent4ff42884df002ccd1728e87d5b4ee7cbddb93cdd (diff)
downloadlobase-f7fb0e0302ad61b386c5303b0b66b01a353047c8.tar.gz
usr.bin/logname: update to OPENBSD_6_1
-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 618a2d3..ae13759 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;
}