From 597bb61f960ea2fd31b68e71d1a7ef36cd375164 Mon Sep 17 00:00:00 2001 From: Wayne Cuddy Date: Sat, 15 Sep 2018 15:00:47 +0100 Subject: system/mpack: Added (mime/uuencode utilities). Signed-off-by: David Spencer --- system/mpack/README | 5 + system/mpack/mpack.SlackBuild | 100 +++++++++++++ system/mpack/mpack.diff | 323 ++++++++++++++++++++++++++++++++++++++++++ system/mpack/mpack.info | 10 ++ system/mpack/slack-desc | 19 +++ 5 files changed, 457 insertions(+) create mode 100644 system/mpack/README create mode 100644 system/mpack/mpack.SlackBuild create mode 100644 system/mpack/mpack.diff create mode 100644 system/mpack/mpack.info create mode 100644 system/mpack/slack-desc (limited to 'system') diff --git a/system/mpack/README b/system/mpack/README new file mode 100644 index 0000000000..63ae10f932 --- /dev/null +++ b/system/mpack/README @@ -0,0 +1,5 @@ +Mpack and munpack are utilities for encoding and decoding +(respectively) binary files in MIME (Multipurpose Internet Mail +Extensions) format mail messages. For compatibility with older forms +of transferring binary files, the munpack program can also decode +messages in split-uuencoded format. diff --git a/system/mpack/mpack.SlackBuild b/system/mpack/mpack.SlackBuild new file mode 100644 index 0000000000..9bd52bc85f --- /dev/null +++ b/system/mpack/mpack.SlackBuild @@ -0,0 +1,100 @@ +#!/bin/sh + +# Slackware build script for mpack + +# Copyright 2018 Wayne Cuddy, Virginia, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "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 AUTHOR 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. + +PRGNAM=mpack +VERSION=${VERSION:-1.6} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +patch -p1 < $CWD/mpack.diff + +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README.unix Changes $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/system/mpack/mpack.diff b/system/mpack/mpack.diff new file mode 100644 index 0000000000..e00b92f25e --- /dev/null +++ b/system/mpack/mpack.diff @@ -0,0 +1,323 @@ +diff -ru mpack-1.6/common.h mpack-1.6.new/common.h +--- mpack-1.6/common.h 2003-07-21 19:49:06.000000000 -0400 ++++ mpack-1.6.new/common.h 2018-09-14 18:11:58.197469285 -0400 +@@ -43,4 +43,26 @@ + #ifndef HAVE_STRCHR + #define strchr index + #define strrchr rindex ++ ++#else ++#include "part.h" ++ ++void os_perror(char *); ++int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, char *subject, char *headers, long int maxsize, char *typeoverride, char *outfname); ++int to64(FILE *infile, FILE *outfile, long int limit); ++int handleMultipart(struct part *inpart, char *contentType, params contentParams, int extractText); ++int handleMessage(struct part *inpart, char *defaultContentType, int inAppleDouble, int extractText); ++int handleUuencode(struct part *inpart, char *subject, int extractText); ++void chat(char *str); ++ ++void os_donewithdir(char *dir); ++void os_warnMD5mismatch(void); ++void os_closetypedfile(FILE *outfile); ++int os_binhex(struct part *inpart, int part, int nparts); ++ ++int parseSubject(char *subject, char **fnamep, int *partp, int *npartsp); ++int saveUuFile(struct part *inpart, char *fname, int part, int nparts, char *firstline); ++int descEnd(char *line); ++int uudecodefiles(char *dir, int nparts); ++void uudecodeline(char *line, FILE *outfile); + #endif +diff -ru mpack-1.6/decode.c mpack-1.6.new/decode.c +--- mpack-1.6/decode.c 2003-07-21 16:47:54.000000000 -0400 ++++ mpack-1.6.new/decode.c 2018-09-14 18:01:42.518631805 -0400 +@@ -28,6 +28,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include "xmalloc.h" + #include "common.h" + #include "part.h" +@@ -49,6 +52,12 @@ + void from64(struct part *inpart, FILE *outfile, char **digestp, int suppressCR); + void fromqp(struct part *inpart, FILE *outfile, char **digestp); + void fromnone(struct part *inpart, FILE *outfile, char **digestp); ++ ++static int handlePartial(struct part *inpart, char *headers, params contentParams, int extractText); ++static int ignoreMessage(struct part *inpart); ++static int handleText(struct part *inpart, enum encoding contentEncoding); ++static int saveToFile(struct part *inpart, int inAppleDouble, char *contentType, params contentParams, enum encoding contentEncoding, char *contentDisposition, char *contentMD5); ++ + /* + * Read and handle an RFC 822 message from the body-part 'inpart'. + */ +diff -ru mpack-1.6/encode.c mpack-1.6.new/encode.c +--- mpack-1.6/encode.c 2003-07-21 16:35:31.000000000 -0400 ++++ mpack-1.6.new/encode.c 2018-09-14 17:41:08.054275377 -0400 +@@ -24,6 +24,9 @@ + */ + #include + #include ++#include ++#include ++#include "common.h" + + extern char *magic_look(FILE *infile); + extern char *os_genid(void); +diff -ru mpack-1.6/macmpack.c mpack-1.6.new/macmpack.c +--- mpack-1.6/macmpack.c 1995-02-16 16:39:45.000000000 -0500 ++++ mpack-1.6.new/macmpack.c 2018-09-14 17:59:49.099714204 -0400 +@@ -239,7 +239,7 @@ + + /* chat with user + */ +-chat(char *str) ++void chat(char *str) + { + PCstr tmpstr[257]; + +diff -ru mpack-1.6/macos.c mpack-1.6.new/macos.c +--- mpack-1.6/macos.c 2003-07-21 15:23:54.000000000 -0400 ++++ mpack-1.6.new/macos.c 2018-09-14 18:06:11.447748498 -0400 +@@ -204,8 +204,7 @@ + * We are done with the directory returned by os_idtodir() + * Remove it + */ +-os_donewithdir(dir) +-char *dir; ++void os_donewithdir(char dir) + { + PCstr buf[257]; + short uqid; +@@ -343,8 +342,7 @@ + /* + * Close a file opened by os_newTypedFile() + */ +-os_closetypedfile(outfile) +-FILE *outfile; ++void os_closetypedfile(FILE *outfile) + { + char buf[128]; + +@@ -365,7 +363,7 @@ + * Warn user that the MD5 digest of the last file created by os_newtypedfile() + * did not match that supplied in the Content-MD5: header. + */ +-os_warnMD5mismatch() ++void os_warnMD5mismatch(void) + { + char *warning; + +diff -ru mpack-1.6/magic.c mpack-1.6.new/magic.c +--- mpack-1.6/magic.c 2003-07-21 16:35:31.000000000 -0400 ++++ mpack-1.6.new/magic.c 2018-09-14 17:43:49.684313535 -0400 +@@ -23,6 +23,7 @@ + * SOFTWARE. + */ + #include ++#include + + /* Description of the various file formats and their magic numbers */ + struct magic { +Only in mpack-1.6.new: mpack.1 +Only in mpack-1.6.new: munpack.1 +diff -ru mpack-1.6/part.c mpack-1.6.new/part.c +--- mpack-1.6/part.c 2003-07-21 16:35:31.000000000 -0400 ++++ mpack-1.6.new/part.c 2018-09-14 18:12:33.772824677 -0400 +@@ -28,6 +28,7 @@ + + #include + #include ++#include + + #include "part.h" + #include "xmalloc.h" +diff -ru mpack-1.6/part.h mpack-1.6.new/part.h +--- mpack-1.6/part.h 2003-07-21 16:35:31.000000000 -0400 ++++ mpack-1.6.new/part.h 2018-09-14 18:05:08.812881992 -0400 +@@ -1,3 +1,5 @@ ++#ifndef __part_H__ ++#define __part_H__ + /* + * Read MIME body-part, stopping on boundaries. + */ +@@ -54,6 +56,13 @@ + + #define part_ungetc(c, s) ((s)->cnt++, ((s)->boundary_seen = (s)->boundary_num), (*--(s)->ptr = (c))) + +-extern struct part *part_init(FILE *infile); +-extern char *part_gets(char *s, int n, struct part *part); ++int part_fill(struct part *part); ++int part_ungets(char *s, struct part *part); ++struct part *part_init(FILE *infile); ++char *part_gets(char *s, int n, struct part *part); ++int part_depth(struct part *part); ++int part_close(struct part *part); ++int part_addboundary(struct part *part, char *boundary); ++int part_readboundary(struct part *part); + ++#endif /* __part_H__ */ +Only in mpack-1.6.new: root +Only in mpack-1.6.new: tags +diff -ru mpack-1.6/unixos.c mpack-1.6.new/unixos.c +--- mpack-1.6/unixos.c 2003-07-21 16:54:05.000000000 -0400 ++++ mpack-1.6.new/unixos.c 2018-09-14 17:29:24.583154415 -0400 +@@ -30,6 +30,11 @@ + #include + #include + #include ++#include ++#include ++#include ++#include ++#include + #include "xmalloc.h" + #include "common.h" + #include "part.h" +@@ -39,7 +44,6 @@ + #endif + + extern int errno; +-extern char *malloc(); + extern char *getenv(); + + int overwrite_files = 0; +@@ -49,7 +53,8 @@ + static char *output_fname = 0; + + /* Characters that shouldn't be in filenames */ +-#define BADCHARS "!$&*()|\'\";<>[]{}?/`\\ \t" ++#define BADCHARS "/" ++#define SUBSTCHAR '_' + + /* Generate a message-id */ + char *os_genid(void) +@@ -75,7 +80,7 @@ + } + } + +- result = malloc(25+strlen(hostname)); ++ result = xmalloc(25+strlen(hostname)); + sprintf(result, "%d.%d@%s", pid, curtime++, hostname); + return result; + } +@@ -166,12 +171,6 @@ + + if (!fname) fname = ""; + +- /* If absolute path name, chop to tail */ +- if (*fname == '/') { +- p = strrchr(fname, '/'); +- fname = p+1; +- } +- + /* Get rid of leading ~ or ~/ */ + while (*fname == '~' || *fname == '/') fname++; + +@@ -181,13 +180,13 @@ + for (p=fname; *p; p++) { + if (*p == '/') { + if (!strncmp(p, "/../", 4)) { +- p[1] = p[2] = 'X'; ++ p[1] = p[2] = SUBSTCHAR; + } + *p = '\0'; + (void) mkdir(fname, 0777); + *p = '/'; + } +- else if (!isprint(*p) || strchr(BADCHARS, *p)) *p = 'X'; ++ else if (!isprint(*p) || strchr(BADCHARS, *p)) *p = SUBSTCHAR; + } + + if (!fname[0]) { +diff -ru mpack-1.6/unixpk.c mpack-1.6.new/unixpk.c +--- mpack-1.6/unixpk.c 2003-07-21 16:50:41.000000000 -0400 ++++ mpack-1.6.new/unixpk.c 2018-09-14 17:43:07.581085162 -0400 +@@ -25,6 +25,10 @@ + #include + #include + #include ++#include ++#include ++#include ++#include + #include "common.h" + #include "version.h" + #include "xmalloc.h" +@@ -160,14 +164,25 @@ + } + + if (!outfname) { ++ int fd; ++ + if (getenv("TMPDIR")) { + strcpy(fnamebuf, getenv("TMPDIR")); + } + else { +- strcpy(fnamebuf, "/usr/tmp"); ++ strcpy(fnamebuf, "/tmp"); + } + strcat(fnamebuf, "/mpackXXXXXX"); +- mktemp(fnamebuf); ++ if ((fd = mkstemp(fnamebuf)) == -1) { ++ os_perror(fnamebuf); ++ exit(1); ++ } ++ /* ++ ** mkstemp() creates/opens the file for us but this case expects ++ ** paths to be passed around. So just close it here. outfname ++ ** will be used later. ++ */ ++ close (fd); + outfname = strsave(fnamebuf); + } + +diff -ru mpack-1.6/unixunpk.c mpack-1.6.new/unixunpk.c +--- mpack-1.6/unixunpk.c 2003-07-21 16:51:55.000000000 -0400 ++++ mpack-1.6.new/unixunpk.c 2018-09-14 17:55:15.622733776 -0400 +@@ -23,6 +23,9 @@ + * SOFTWARE. + */ + #include ++#include ++#include ++#include "common.h" + #include "version.h" + #include "part.h" + +diff -ru mpack-1.6/uudecode.c mpack-1.6.new/uudecode.c +--- mpack-1.6/uudecode.c 2003-07-21 16:46:37.000000000 -0400 ++++ mpack-1.6.new/uudecode.c 2018-09-14 18:11:31.387955015 -0400 +@@ -25,6 +25,8 @@ + #include + #include + #include ++#include ++#include + #include "xmalloc.h" + #include "common.h" + #include "part.h" +@@ -826,7 +828,7 @@ + /* + * Decode a uuencoded line to 'outfile' + */ +-int uudecodeline(char *line, FILE *outfile) ++void uudecodeline(char *line, FILE *outfile) + { + int c, len; + +diff -ru mpack-1.6/xmalloc.c mpack-1.6.new/xmalloc.c +--- mpack-1.6/xmalloc.c 2003-07-21 16:35:31.000000000 -0400 ++++ mpack-1.6.new/xmalloc.c 2018-09-14 13:17:28.574643725 -0400 +@@ -24,7 +24,7 @@ + */ + #include + #include +-extern char *malloc(), *realloc(); ++#include + + char *xmalloc (int size) + { diff --git a/system/mpack/mpack.info b/system/mpack/mpack.info new file mode 100644 index 0000000000..fd50ec744e --- /dev/null +++ b/system/mpack/mpack.info @@ -0,0 +1,10 @@ +PRGNAM="mpack" +VERSION="1.6" +HOMEPAGE="http://ftp.andrew.cmu.edu/pub/mpack" +DOWNLOAD="http://ftp.andrew.cmu.edu/pub/mpack/mpack-1.6.tar.gz" +MD5SUM="a70fa5afa76539a9afb70b9d81568fe8" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Wayne Cuddy" +EMAIL="wcuddy@gmail.com" diff --git a/system/mpack/slack-desc b/system/mpack/slack-desc new file mode 100644 index 0000000000..af0c196e09 --- /dev/null +++ b/system/mpack/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +mpack: mpack (mime/uuencode packing and unpacking command line utilities) +mpack: +mpack: This MIME implementation is intended to be as simple and portable as +mpack: possible. +mpack: +mpack: +mpack: +mpack: +mpack: +mpack: +mpack: -- cgit v1.2.3