mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
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@
This commit is contained in:
parent
a29693414a
commit
a0a3ab15d8
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: uudecode.c,v 1.25 2018/12/31 13:49:52 bluhm Exp $ */
|
||||
/* $OpenBSD: uudecode.c,v 1.26 2019/03/10 20:49:24 schwarze Exp $ */
|
||||
/* $FreeBSD: uudecode.c,v 1.49 2003/05/03 19:44:46 obrien Exp $ */
|
||||
|
||||
/*-
|
||||
@ -42,20 +42,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);
|
||||
@ -82,7 +81,6 @@ main(int argc, char *argv[])
|
||||
pmode = MODE_B64DECODE;
|
||||
}
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
while ((ch = getopt(argc, argv, optstr[pmode])) != -1) {
|
||||
switch(ch) {
|
||||
case 'c':
|
||||
@ -153,7 +151,7 @@ main(int argc, char *argv[])
|
||||
infp = stdin;
|
||||
rval = decode();
|
||||
}
|
||||
exit(rval);
|
||||
return (rval);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -448,7 +446,7 @@ base64_decode(void)
|
||||
"error decoding base64 input stream"));
|
||||
}
|
||||
|
||||
static void
|
||||
static void __dead
|
||||
usage(void)
|
||||
{
|
||||
switch (pmode) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user