diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-03-10 20:49:25 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2019-03-10 20:49:25 +0000 |
commit | 7a5a47d67e40332e6adc28df84cadec89a6a4b76 (patch) | |
tree | 0e22dd823db7e6ce659e93d2b8da195f9f4bed6f /usr.bin/uuencode/uuencode.c | |
parent | 4dfacb4b3ba0bf4ddaa3e0f6a24a127fe0fec128 (diff) |
Delete useless calls to setlocale(3):
uudecode(1) and uuencode(1) do nothing locale-dependent.
While here, sort headers, make usage() static, return from main()
rather than exit(3), and drop two redundant case statements.
This is a minimally tweaked version of a patch from Jan Stary.
OK tedu@
Diffstat (limited to 'usr.bin/uuencode/uuencode.c')
-rw-r--r-- | usr.bin/uuencode/uuencode.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/uuencode/uuencode.c b/usr.bin/uuencode/uuencode.c index 8e1e48990d8..4bdd82d0975 100644 --- a/usr.bin/uuencode/uuencode.c +++ b/usr.bin/uuencode/uuencode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uuencode.c,v 1.14 2018/12/31 09:23:08 kn Exp $ */ +/* $OpenBSD: uuencode.c,v 1.15 2019/03/10 20:49:24 schwarze Exp $ */ /* $FreeBSD: uuencode.c,v 1.18 2004/01/22 07:23:35 grehan Exp $ */ /*- @@ -39,7 +39,6 @@ #include <netinet/in.h> #include <err.h> -#include <locale.h> #include <resolv.h> #include <stdio.h> #include <stdlib.h> @@ -48,7 +47,7 @@ void encode(void); void base64_encode(void); -static void usage(void); +static void __dead usage(void); FILE *output; int mode; @@ -80,7 +79,6 @@ main(int argc, char *argv[]) pmode = MODE_B64ENCODE; } - setlocale(LC_ALL, ""); while ((ch = getopt(argc, argv, optstr[pmode])) != -1) { switch (ch) { case 'm': @@ -89,7 +87,6 @@ main(int argc, char *argv[]) case 'o': outfile = optarg; break; - case '?': default: usage(); } @@ -117,7 +114,6 @@ main(int argc, char *argv[]) #define RW (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) mode = RW & ~umask(RW); break; - case 0: default: usage(); } @@ -136,7 +132,7 @@ main(int argc, char *argv[]) encode(); if (ferror(output)) errx(1, "write error"); - exit(0); + return 0; } /* ENC is the basic 1 character encoding function to make a char printing */ @@ -219,7 +215,7 @@ encode(void) (void)fprintf(output, "%c\nend\n", ENC('\0')); } -static void +static void __dead usage(void) { switch (pmode) { |