summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/uuencode/uuencode.c73
1 files changed, 6 insertions, 67 deletions
diff --git a/usr.bin/uuencode/uuencode.c b/usr.bin/uuencode/uuencode.c
index 50b7051..ac104cd 100644
--- a/usr.bin/uuencode/uuencode.c
+++ b/usr.bin/uuencode/uuencode.c
@@ -29,20 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-__COPYRIGHT("@(#) Copyright (c) 1983, 1993\
- The Regents of the University of California. All rights reserved.");
-#endif /* not lint */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)uuencode.c 8.2 (Berkeley) 4/2/94";
-#else
-__RCSID("$NetBSD: uuencode.c,v 1.16 2014/09/06 18:58:35 dholland Exp $");
-#endif
-#endif /* not lint */
-
/*
* uuencode [input] output
*
@@ -56,13 +42,12 @@ __RCSID("$NetBSD: uuencode.c,v 1.16 2014/09/06 18:58:35 dholland Exp $");
#include <locale.h>
#include <resolv.h>
#include <stdio.h>
-#include <stdlib.h>
+#include <bsd/stdlib.h>
#include <string.h>
#include <unistd.h>
static void encode(void);
-static void base64_encode(void);
-__dead static void usage(void);
+static void usage(void);
int
main(int argc, char *argv[])
@@ -75,18 +60,6 @@ main(int argc, char *argv[])
setlocale(LC_ALL, "");
setprogname(argv[0]);
- while ((ch = getopt(argc, argv, "m")) != -1) {
- switch(ch) {
- case 'm':
- base64 = 1;
- break;
- default:
- usage();
- }
- }
- argv += optind;
- argc -= optind;
-
switch(argc) {
case 2: /* optional first argument is input file */
if (!freopen(*argv, "r", stdin) || fstat(fileno(stdin), &sb))
@@ -104,15 +77,9 @@ main(int argc, char *argv[])
usage();
}
- if (base64) {
- (void)printf("begin-base64 %o %s\n", mode, *argv);
- base64_encode();
- (void)printf("====\n");
- } else {
- (void)printf("begin %o %s\n", mode, *argv);
- encode();
- (void)printf("end\n");
- }
+ (void)printf("begin %o %s\n", mode, *argv);
+ encode();
+ (void)printf("end\n");
if (ferror(stdout))
err(1, "write error");
@@ -123,34 +90,6 @@ main(int argc, char *argv[])
#define ENC(c) ((c) ? ((c) & 077) + ' ': '`')
/*
- * copy from in to out, encoding in base64 as you go along.
- */
-static void
-base64_encode(void)
-{
- /*
- * Output must fit into 80 columns, chunks come in 4, leave 1.
- */
-#define GROUPS ((70 / 4) - 1)
- unsigned char buf[3];
- char buf2[sizeof(buf) * 2 + 1];
- size_t n;
- int rv, sequence;
-
- sequence = 0;
-
- while ((n = fread(buf, 1, sizeof(buf), stdin))) {
- ++sequence;
- rv = b64_ntop(buf, n, buf2, (sizeof(buf2) / sizeof(buf2[0])));
- if (rv == -1)
- errx(1, "b64_ntop: error encoding base64");
- printf("%s%s", buf2, (sequence % GROUPS) ? "" : "\n");
- }
- if (sequence % GROUPS)
- printf("\n");
-}
-
-/*
* copy from in to out, encoding as you go along.
*/
static void
@@ -196,7 +135,7 @@ static void
usage(void)
{
(void)fprintf(stderr,
- "usage: %s [-m] [inputfile] headername > encodedfile\n",
+ "usage: %s [inputfile] headername > encodedfile\n",
getprogname());
exit(1);
}