File mpack-1.6.diff of Package mpack
diff -urN mpack-1.6/common.h mpack-1.6-patch/common.h
--- mpack-1.6/common.h 2003-07-22 02:49:06.000000000 +0300
+++ mpack-1.6-patch/common.h 2024-10-21 11:52:47.652029885 +0300
@@ -39,6 +39,13 @@
#define FILE_BINARY 0x1 /* File should be opened in binary mode */
#define FILE_INAPPLEDOUBLE 0x2 /* File was inside multipart/appledouble */
+extern void os_perror(char *file);
+extern void os_closetypedfile(FILE *outfile);
+extern void os_donewithdir(char *dir);
+extern void os_warnMD5mismatch(void);
+extern int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile, char *subject, char *headers, long int maxsize, char *typeoverride, char *outfname);
+extern int to64(FILE *infile, FILE *outfile, long int limit);
+extern void chat(char *s);
#ifndef HAVE_STRCHR
#define strchr index
diff -urN mpack-1.6/decode.c mpack-1.6-patch/decode.c
--- mpack-1.6/decode.c 2003-07-21 23:47:54.000000000 +0300
+++ mpack-1.6-patch/decode.c 2024-10-21 11:46:17.900999369 +0300
@@ -25,13 +25,17 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE. */
+#include <err.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
+#include <unistd.h>
#include "xmalloc.h"
#include "common.h"
#include "part.h"
#include "md5.h"
+#include "common.h"
extern char *os_idtodir(char *id);
extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);
@@ -49,6 +53,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);
+int ignoreMessage(struct part *inpart);
+int handleText(struct part *inpart, enum encoding contentEncoding);
+int saveToFile(struct part *inpart, int inAppleDouble, char *contentType, params contentParams, enum encoding contentEncoding, char *contentDisposition, char *contentMD5);
+int handlePartial(struct part *inpart, char *headers, params contentParams, int extractText);
+int handleMultipart(struct part *inpart, char *contentType, params contentParams, int extractText);
+
/*
* Read and handle an RFC 822 message from the body-part 'inpart'.
*/
diff -urN mpack-1.6/encode.c mpack-1.6-patch/encode.c
--- mpack-1.6/encode.c 2003-07-21 23:35:31.000000000 +0300
+++ mpack-1.6-patch/encode.c 2024-10-21 11:19:11.576849821 +0300
@@ -22,8 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include "common.h"
extern char *magic_look(FILE *infile);
extern char *os_genid(void);
diff -urN mpack-1.6/magic.c mpack-1.6-patch/magic.c
--- mpack-1.6/magic.c 2003-07-21 23:35:31.000000000 +0300
+++ mpack-1.6-patch/magic.c 2024-10-21 11:04:36.784441474 +0300
@@ -23,6 +23,7 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <string.h>
/* Description of the various file formats and their magic numbers */
struct magic {
diff -urN mpack-1.6/Makefile.am mpack-1.6-patch/Makefile.am
--- mpack-1.6/Makefile.am 2003-07-22 02:39:28.000000000 +0300
+++ mpack-1.6-patch/Makefile.am 2024-10-21 11:24:40.897222592 +0300
@@ -5,12 +5,12 @@
mpack_SOURCES=unixpk.c encode.c codes.c magic.c unixos.c xmalloc.c \
md5c.c
-mpack_LDADD=@LIBOBJS@ @LIB_SOCKET@
+mpack_LDADD=@LIBOBJS@
munpack_SOURCES=unixunpk.c decode.c uudecode.c codes.c unixos.c \
part.c xmalloc.c md5c.c
-munpack_LDADD=@LIBOBJS@ @LIB_SOCKET@
+munpack_LDADD=@LIBOBJS@
noinst_HEADERS=common.h md5.h part.h version.h xmalloc.h
man_MANS=mpack.1 munpack.1
diff -urN mpack-1.6/part.c mpack-1.6-patch/part.c
--- mpack-1.6/part.c 2003-07-21 23:35:31.000000000 +0300
+++ mpack-1.6-patch/part.c 2024-10-21 11:04:36.784441474 +0300
@@ -26,6 +26,7 @@
* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
diff -urN mpack-1.6/part.h mpack-1.6-patch/part.h
--- mpack-1.6/part.h 2003-07-21 23:35:31.000000000 +0300
+++ mpack-1.6-patch/part.h 2024-10-21 11:52:56.685536497 +0300
@@ -57,3 +57,13 @@
extern struct part *part_init(FILE *infile);
extern char *part_gets(char *s, int n, struct part *part);
+extern int part_addboundary(struct part *part, char *boundary);
+extern int part_readboundary(struct part *part);
+extern int part_close(struct part *part);
+extern int part_ungets(char *s, struct part *part);
+extern int part_depth(struct part *part);
+
+extern int handleMessage(struct part *inpart, char *defaultContentType, int inAppleDouble, int extractText);
+extern int handleUuencode(struct part *inpart, char *subject, int extractText);
+extern int part_fill(struct part *part);
+extern int os_binhex(struct part *inpart, int part, int nparts);
diff -urN mpack-1.6/unixos.c mpack-1.6-patch/unixos.c
--- mpack-1.6/unixos.c 2003-07-21 23:54:05.000000000 +0300
+++ mpack-1.6-patch/unixos.c 2024-10-21 11:09:21.184039648 +0300
@@ -22,10 +22,15 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
+#include <err.h>
+#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
+#include <time.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <netdb.h>
@@ -38,9 +43,11 @@
#define MAXHOSTNAMELEN 64
#endif
+/*
extern int errno;
extern char *malloc();
extern char *getenv();
+*/
int overwrite_files = 0;
int didchat;
diff -urN mpack-1.6/unixpk.c mpack-1.6-patch/unixpk.c
--- mpack-1.6/unixpk.c 2003-07-21 23:50:41.000000000 +0300
+++ mpack-1.6-patch/unixpk.c 2024-10-21 11:18:25.575866520 +0300
@@ -22,16 +22,19 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <sys/wait.h>
#include "common.h"
+#include <unistd.h>
#include "version.h"
#include "xmalloc.h"
#define MAXADDRESS 100
-extern char *getenv();
+/* extern char *getenv(); */
extern int errno;
extern int optind;
@@ -167,7 +170,7 @@
strcpy(fnamebuf, "/usr/tmp");
}
strcat(fnamebuf, "/mpackXXXXXX");
- mktemp(fnamebuf);
+ mkstemp(fnamebuf);
outfname = strsave(fnamebuf);
}
diff -urN mpack-1.6/unixunpk.c mpack-1.6-patch/unixunpk.c
--- mpack-1.6/unixunpk.c 2003-07-21 23:51:55.000000000 +0300
+++ mpack-1.6-patch/unixunpk.c 2024-10-21 11:28:41.885707211 +0300
@@ -22,9 +22,12 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
#include "version.h"
#include "part.h"
+#include "common.h"
extern int optind;
extern char *optarg;
diff -urN mpack-1.6/uudecode.c mpack-1.6-patch/uudecode.c
--- mpack-1.6/uudecode.c 2003-07-21 23:46:37.000000000 +0300
+++ mpack-1.6-patch/uudecode.c 2024-10-21 11:53:48.216524953 +0300
@@ -25,6 +25,8 @@
#include <stdio.h>
#include <ctype.h>
#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "xmalloc.h"
#include "common.h"
#include "part.h"
@@ -34,7 +36,11 @@
extern FILE *os_createnewfile(char *fname);
static FILE *startDescFile(char *fname);
-
+int uudecodeline(char *line, FILE *outfile);
+int descEnd(char *line);
+int parseSubject(char *subject, char **fnamep, int *partp, int *npartsp);
+int saveUuFile(struct part *inpart, char *fname, int part, int nparts, char *firstline);
+int uudecodefiles(char *dir, int nparts);
/* Length of a normal uuencoded line, including newline */
#define UULENGTH 62
@@ -845,7 +851,7 @@
}
line += 4;
}
- return;
+ return 0;
}
diff -urN mpack-1.6/xmalloc.c mpack-1.6-patch/xmalloc.c
--- mpack-1.6/xmalloc.c 2003-07-21 23:35:31.000000000 +0300
+++ mpack-1.6-patch/xmalloc.c 2024-10-21 11:04:36.784441474 +0300
@@ -22,9 +22,10 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-extern char *malloc(), *realloc();
+/* extern char *malloc(), *realloc(); */
char *xmalloc (int size)
{