Page MenuHomeFreeBSD

D32943.id104240.diff
No OneTemporary

D32943.id104240.diff

Index: usr.bin/Makefile
===================================================================
--- usr.bin/Makefile
+++ usr.bin/Makefile
@@ -171,7 +171,6 @@
unzip \
units \
unvis \
- uudecode \
uuencode \
vis \
vmstat \
Index: usr.bin/uudecode/Makefile
===================================================================
--- usr.bin/uudecode/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/6/93
-# $FreeBSD$
-
-.include <src.opts.mk>
-
-PROG= uudecode
-LINKS= ${BINDIR}/uudecode ${BINDIR}/b64decode
-MAN=
-
-HAS_TESTS=
-SUBDIR.${MK_TESTS}+= tests
-
-.include <bsd.prog.mk>
Index: usr.bin/uudecode/Makefile.depend
===================================================================
--- usr.bin/uudecode/Makefile.depend
+++ /dev/null
@@ -1,18 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
- gnu/lib/csu \
- include \
- include/arpa \
- include/xlocale \
- lib/${CSU_DIR} \
- lib/libc \
- lib/libcompiler_rt \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
Index: usr.bin/uudecode/tests/Makefile
===================================================================
--- usr.bin/uudecode/tests/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-# $FreeBSD$
-
-PACKAGE= tests
-
-TAP_TESTS_SH= legacy_test
-
-${PACKAGE}FILES+= regress.base64.in
-${PACKAGE}FILES+= regress.out
-${PACKAGE}FILES+= regress.sh
-${PACKAGE}FILES+= regress.traditional.in
-
-.include <bsd.test.mk>
Index: usr.bin/uudecode/tests/Makefile.depend
===================================================================
--- usr.bin/uudecode/tests/Makefile.depend
+++ /dev/null
@@ -1,11 +0,0 @@
-# $FreeBSD$
-# Autogenerated - do NOT edit!
-
-DIRDEPS = \
-
-
-.include <dirdeps.mk>
-
-.if ${DEP_RELDIR} == ${_DEP_RELDIR}
-# local dependencies - needed for -jN in clean tree
-.endif
Index: usr.bin/uudecode/tests/legacy_test.sh
===================================================================
--- usr.bin/uudecode/tests/legacy_test.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# $FreeBSD$
-
-SRCDIR="$(dirname "${0}")"; export SRCDIR
-
-m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
Index: usr.bin/uudecode/tests/regress.sh
===================================================================
--- usr.bin/uudecode/tests/regress.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-# $FreeBSD$
-
-echo 1..2
-
-REGRESSION_START($1)
-
-REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.traditional.in', `traditional')
-REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.base64.in', `base64')
-
-REGRESSION_END()
Index: usr.bin/uuencode/Makefile
===================================================================
--- usr.bin/uuencode/Makefile
+++ usr.bin/uuencode/Makefile
@@ -3,9 +3,13 @@
.include <src.opts.mk>
-PROG= uuencode
+PROG= bin2text2bin
+SRCS= bin2text2bin.c uuencode.c uudecode.c
MAN= uuencode.1 uuencode.format.5
-LINKS= ${BINDIR}/uuencode ${BINDIR}/b64encode
+LINKS+= ${BINDIR}/bin2text2bin ${BINDIR}/uuencode
+LINKS+= ${BINDIR}/bin2text2bin ${BINDIR}/b64encode
+LINKS+= ${BINDIR}/bin2text2bin ${BINDIR}/uudecode
+LINKS+= ${BINDIR}/bin2text2bin ${BINDIR}/b64decode
MLINKS= uuencode.1 uudecode.1 \
uuencode.format.5 uuencode.5 \
uuencode.1 b64encode.1 \
Index: usr.bin/uuencode/bin2text2bin.c
===================================================================
--- /dev/null
+++ usr.bin/uuencode/bin2text2bin.c
@@ -0,0 +1,87 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2021 The FreeBSD Foundation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <libgen.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern int main_decode(int, char *[]);
+extern int main_encode(int, char *[]);
+
+static int search(const char *const);
+
+enum coders {
+ uuencode, uudecode, b64encode, b64decode
+};
+
+int
+main(int argc, char *argv[])
+{
+ const char *const progname = basename(argv[0]);
+ int coder = search(progname);
+
+ if (coder == -1 && argc > 1) {
+ argc--;
+ argv++;
+ coder = search(basename(argv[0]));
+ }
+ switch (coder) {
+ case uuencode:
+ case b64encode:
+ main_encode(argc, argv);
+ break;
+ case uudecode:
+ case b64decode:
+ main_decode(argc, argv);
+ break;
+ default:
+ (void)fprintf(stderr,
+ "usage: %s <uuencode | uudecode> ...\n"
+ " %s <b64encode | b64decode> ...\n",
+ progname, progname);
+ exit(EXIT_FAILURE);
+ }
+}
+
+static int
+search(const char *const progname)
+{
+#define DESIGNATE(item) [item] = #item
+ const char *const known[] = {
+ DESIGNATE(uuencode),
+ DESIGNATE(uudecode),
+ DESIGNATE(b64encode),
+ DESIGNATE(b64decode)
+ };
+
+ for (size_t i = 0; i < nitems(known); i++)
+ if (strcmp(progname, known[i]) == 0)
+ return ((int)i);
+ return (-1);
+}
Index: usr.bin/uuencode/tests/regress.sh
===================================================================
--- usr.bin/uuencode/tests/regress.sh
+++ usr.bin/uuencode/tests/regress.sh
@@ -6,6 +6,8 @@
REGRESSION_TEST(`traditional', `uuencode regress.in <${SRCDIR}/regress.in')
REGRESSION_TEST(`base64', `uuencode -m regress.in <${SRCDIR}/regress.in')
+REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.traditional.in', `traditional')
+REGRESSION_TEST_ONE(`uudecode -p <${SRCDIR}/regress.base64.in', `base64')
# was uudecode: stdin: /dev/null: character out of range: [33-96]
REGRESSION_TEST(`153276', `uudecode -o /dev/null < regress.153276.in 2>&1')
Index: usr.bin/uuencode/uudecode.c
===================================================================
--- usr.bin/uuencode/uudecode.c
+++ usr.bin/uuencode/uudecode.c
@@ -67,6 +67,8 @@
#include <string.h>
#include <unistd.h>
+extern int main_decode(int, char *[]);
+
static const char *infile, *outfile;
static FILE *infp, *outfp;
static int base64, cflag, iflag, oflag, pflag, rflag, sflag;
@@ -78,7 +80,7 @@
static int base64_decode(void);
int
-main(int argc, char *argv[])
+main_decode(int argc, char *argv[])
{
int rval, ch;
Index: usr.bin/uuencode/uuencode.c
===================================================================
--- usr.bin/uuencode/uuencode.c
+++ usr.bin/uuencode/uuencode.c
@@ -63,6 +63,8 @@
#include <string.h>
#include <unistd.h>
+extern int main_encode(int, char *[]);
+
static void encode(void);
static void base64_encode(void);
static void usage(void);
@@ -73,7 +75,7 @@
static char **av;
int
-main(int argc, char *argv[])
+main_encode(int argc, char *argv[])
{
struct stat sb;
int base64;

File Metadata

Mime Type
text/plain
Expires
Wed, Jan 14, 3:59 AM (4 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27633991
Default Alt Text
D32943.id104240.diff (7 KB)

Event Timeline