Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: base64 routines [was: Re: CVS commit: src/usr.bin]
"Darrin B.Jewell" <dbj%netbsd.org@localhost> writes:
> 1. disable the base64 support in uudecode with a HOST_CPPFLAGS+= -DNO_BASE64
The following patch implments this option:
Index: src/tools/uudecode/Makefile
===================================================================
RCS file: /cvsroot/src/tools/uudecode/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- src/tools/uudecode/Makefile 8 Dec 2002 20:20:06 -0000 1.2
+++ src/tools/uudecode/Makefile 24 Sep 2006 19:42:10 -0000
@@ -3,4 +3,6 @@
HOSTPROGNAME= ${_TOOL_PREFIX}uudecode
HOST_SRCDIR= usr.bin/uudecode
+HOST_CPPFLAGS= -DNO_BASE64
+
.include "${.CURDIR}/../Makefile.host"
Index: src/usr.bin/uudecode/uudecode.c
===================================================================
RCS file: /cvsroot/src/usr.bin/uudecode/uudecode.c,v
retrieving revision 1.21
diff -u -r1.21 uudecode.c
--- src/usr.bin/uudecode/uudecode.c 24 Sep 2006 15:32:48 -0000 1.21
+++ src/usr.bin/uudecode/uudecode.c 24 Sep 2006 19:42:10 -0000
@@ -51,19 +51,22 @@
*/
#include <sys/param.h>
#include <sys/stat.h>
-#include <netinet/in.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <locale.h>
-#include <resolv.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#ifndef NO_BASE64
+#include <netinet/in.h>
+#include <resolv.h>
+#endif
+
static int decode(void);
static void usage(void);
static int checkend(const char *, const char *, const char *);
@@ -268,7 +271,12 @@
warnx("%s: short file.", filename);
return (1);
}
+#ifdef NO_BASE64
+ warnx("%s: base64 decoding is not supported\n", filename);
+ return (1);
+#else
n = b64_pton(inbuf, outbuf, sizeof(outbuf));
+#endif
if (n < 0)
break;
fwrite(outbuf, 1, n, stdout);
Home |
Main Index |
Thread Index |
Old Index