Hi,
uuencode(1) and uudecode(1) do nothing locale-related and i don't see
how they ever might.
So delete <locale.h> and setlocale(3).
While here, sort headers, make usage() static, return from main
rather than exit(3), and drop two redundant case statements.
This is also a minimally tweaked version of a patch from Jan Stary.
OK?
Ingo
Index: uudecode/uudecode.c
===================================================================
RCS file: /cvs/src/usr.bin/uudecode/uudecode.c,v
retrieving revision 1.23
diff -u -p -r1.23 uudecode.c
--- uudecode/uudecode.c 3 Jan 2016 14:43:20 -0000 1.23
+++ uudecode/uudecode.c 28 Oct 2016 08:34:42 -0000
@@ -43,20 +43,19 @@
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <locale.h>
+#include <limits.h>
#include <pwd.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <limits.h>
static const char *infile, *outfile;
static FILE *infp, *outfp;
static int base64, cflag, iflag, oflag, pflag, rflag, sflag;
-static void usage(void);
+static void __dead usage(void);
static int decode(void);
static int decode2(void);
static int uu_decode(void);
@@ -83,7 +82,6 @@ main(int argc, char *argv[])
pmode = MODE_B64DECODE;
}
- setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, optstr[pmode])) != -1) {
switch(ch) {
case 'c':
@@ -154,7 +152,7 @@ main(int argc, char *argv[])
infp = stdin;
rval = decode();
}
- exit(rval);
+ return (rval);
}
static int
@@ -442,7 +440,7 @@ base64_decode(void)
"error decoding base64 input stream"));
}
-static void
+static void __dead
usage(void)
{
switch (pmode) {
Index: uuencode/uuencode.c
===================================================================
RCS file: /cvs/src/usr.bin/uuencode/uuencode.c,v
retrieving revision 1.13
diff -u -p -r1.13 uuencode.c
--- uuencode/uuencode.c 9 Oct 2015 01:37:09 -0000 1.13
+++ uuencode/uuencode.c 28 Oct 2016 08:34:42 -0000
@@ -40,7 +40,6 @@
#include <netinet/in.h>
#include <err.h>
-#include <locale.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
@@ -49,7 +48,7 @@
void encode(void);
void base64_encode(void);
-static void usage(void);
+static void __dead usage(void);
FILE *output;
int mode;
@@ -81,7 +80,6 @@ main(int argc, char *argv[])
pmode = MODE_B64ENCODE;
}
- setlocale(LC_ALL, "");
while ((ch = getopt(argc, argv, optstr[pmode])) != -1) {
switch (ch) {
case 'm':
@@ -90,7 +88,6 @@ main(int argc, char *argv[])
case 'o':
outfile = optarg;
break;
- case '?':
default:
usage();
}
@@ -118,7 +115,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();
}
@@ -137,7 +133,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 */
@@ -220,7 +216,7 @@ encode(void)
(void)fprintf(output, "%c\nend\n", ENC('\0'));
}
-static void
+static void __dead
usage(void)
{
switch (pmode) {