mirror of
https://git.freebsd.org/ports.git
synced 2025-05-06 19:06:44 -04:00
- Change TMPDIR to /tmp. [1]
- Don't use O_EXCL. [1] - Rename touched patches to patch-<patched file> format. - Import some fixes from Debian. PR: ports/93967 [1] Submitted by: Paul Schmehl <pauls@utdallas.edu> [1]
This commit is contained in:
parent
3d91b279e0
commit
ae2643a80f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=158195
18 changed files with 505 additions and 62 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
PORTNAME= mpack
|
||||
PORTVERSION= 1.6
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= converters mail news
|
||||
MASTER_SITES= ftp://ftp.andrew.cmu.edu/pub/mpack/
|
||||
DISTNAME= ${PORTNAME}-${PORTVERSION}
|
||||
|
|
9
converters/mpack/files/patch-README.unix
Normal file
9
converters/mpack/files/patch-README.unix
Normal file
|
@ -0,0 +1,9 @@
|
|||
--- README.unix.orig Tue Feb 28 21:37:10 2006
|
||||
+++ README.unix Tue Feb 28 21:37:28 2006
|
||||
@@ -188,7 +188,7 @@
|
||||
|
||||
TMPDIR
|
||||
Root of directory to store partial messages awaiting
|
||||
- reassembly. Default is "/usr/tmp". Partial messages
|
||||
+ reassembly. Default is "/tmp". Partial messages
|
||||
are stored in subdirectories of $TMPDIR/m-prts-$USER/
|
|
@ -1,38 +0,0 @@
|
|||
*** unixpk.man.bak Fri Feb 17 00:39:50 1995
|
||||
--- unixpk.man Mon Nov 11 10:19:46 1996
|
||||
***************
|
||||
*** 136,142 ****
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
! Directory to store temporary files. Default is /usr/tmp.
|
||||
.TP
|
||||
.B SPLITSIZE
|
||||
Default value of the -m switch.
|
||||
--- 136,142 ----
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
! Directory to store temporary files. Default is /var/tmp.
|
||||
.TP
|
||||
.B SPLITSIZE
|
||||
Default value of the -m switch.
|
||||
*** unixunpk.man.bak Fri Feb 17 00:39:50 1995
|
||||
--- unixunpk.man Mon Nov 11 10:19:59 1996
|
||||
***************
|
||||
*** 107,113 ****
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
! Directory to store temporary files. Default is /usr/tmp.
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $TMPDIR/m-prts-$USER/
|
||||
--- 107,113 ----
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
! Directory to store temporary files. Default is /var/tmp.
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $TMPDIR/m-prts-$USER/
|
11
converters/mpack/files/patch-codes.c
Normal file
11
converters/mpack/files/patch-codes.c
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- codes.c
|
||||
+++ codes.c
|
||||
@@ -128,7 +128,7 @@
|
||||
int nbytes;
|
||||
|
||||
MD5Init(&context);
|
||||
- while (nbytes = fread(buf, 1, sizeof(buf), infile)) {
|
||||
+ while ((nbytes = fread(buf, 1, sizeof(buf), infile))) {
|
||||
length += nbytes;
|
||||
MD5Update(&context, buf, nbytes);
|
||||
}
|
69
converters/mpack/files/patch-decode.c
Normal file
69
converters/mpack/files/patch-decode.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
--- decode.c.orig Mon Jul 21 23:47:54 2003
|
||||
+++ decode.c Sun Mar 26 23:08:44 2006
|
||||
@@ -26,8 +26,10 @@
|
||||
* SOFTWARE. */
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#include <unistd.h>
|
||||
#include "xmalloc.h"
|
||||
#include "common.h"
|
||||
#include "part.h"
|
||||
@@ -37,6 +39,19 @@
|
||||
extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);
|
||||
extern FILE *os_createnewfile(char *fname);
|
||||
extern char *md5contextTo64(MD5_CTX *context);
|
||||
+extern void warn(char *s);
|
||||
+extern void os_perror(char *str);
|
||||
+extern void chat(char *s);
|
||||
+extern void os_donewithdir(char *dir);
|
||||
+extern void os_warnMD5mismatch(void);
|
||||
+extern void os_closetypedfile(FILE *outfile);
|
||||
+
|
||||
+extern int part_depth(struct part *part);
|
||||
+extern void part_ungets(char *s, struct part *part);
|
||||
+extern void part_close(struct part *part);
|
||||
+extern int part_fill(struct part *part);
|
||||
+extern void part_addboundary(struct part *part, char *boundary);
|
||||
+extern int part_readboundary(struct part *part);
|
||||
|
||||
/* The possible content transfer encodings */
|
||||
enum encoding { enc_none, enc_qp, enc_base64 };
|
||||
@@ -49,6 +64,17 @@
|
||||
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 handlePartial(struct part *inpart, char *headers, params contentParams,
|
||||
+ int extractText);
|
||||
+int ignoreMessage(struct part *inpart);
|
||||
+int handleMultipart(struct part *inpart, char *contentType,
|
||||
+ params contentParams, int extractText);
|
||||
+int handleUuencode(struct part *inpart, char *subject, int extractText);
|
||||
+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);
|
||||
+
|
||||
/*
|
||||
* Read and handle an RFC 822 message from the body-part 'inpart'.
|
||||
*/
|
||||
@@ -624,7 +650,7 @@
|
||||
}
|
||||
thispart = atoi(p);
|
||||
|
||||
- if (p = getParam(contentParams, "total")) {
|
||||
+ if ((p = getParam(contentParams, "total"))) {
|
||||
nparts = atoi(p);
|
||||
if (nparts <= 0) {
|
||||
warn("partial message has invalid number of parts");
|
||||
@@ -643,7 +669,7 @@
|
||||
else {
|
||||
/* Try to retrieve number of parts from reassembly directory */
|
||||
sprintf(buf, "%sCT", dir);
|
||||
- if (partfile = fopen(buf, "r")) {
|
||||
+ if ((partfile = fopen(buf, "r"))) {
|
||||
if (fgets(buf, sizeof(buf), partfile)) {
|
||||
nparts = atoi(buf);
|
||||
if (nparts < 0) nparts = 0;
|
41
converters/mpack/files/patch-encode.c
Normal file
41
converters/mpack/files/patch-encode.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
--- encode.c.orig Mon Jul 21 23:35:31 2003
|
||||
+++ encode.c Sun Mar 26 22:54:13 2006
|
||||
@@ -23,12 +23,15 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern char *magic_look(FILE *infile);
|
||||
extern char *os_genid(void);
|
||||
extern FILE *os_createnewfile(char *fname);
|
||||
extern char *md5digest(FILE *infile, long int *len);
|
||||
+extern void os_perror(char *str);
|
||||
+extern int to64(FILE *infile, FILE *outfile, long int limit);
|
||||
|
||||
#define NUMREFERENCES 4
|
||||
|
||||
@@ -43,7 +46,7 @@
|
||||
char *type;
|
||||
FILE *outfile;
|
||||
char *cleanfname, *p;
|
||||
- char *digest, *appledigest;
|
||||
+ char *digest, *appledigest = NULL;
|
||||
long filesize, l, written;
|
||||
int thispart, numparts = 1;
|
||||
int wrotefiletype = 0;
|
||||
@@ -59,10 +62,10 @@
|
||||
*/
|
||||
if (p = strrchr(cleanfname, '.')) cleanfname = p+1;
|
||||
#else
|
||||
- if (p = strrchr(cleanfname, '/')) cleanfname = p+1;
|
||||
- if (p = strrchr(cleanfname, '\\')) cleanfname = p+1;
|
||||
+ if ((p = strrchr(cleanfname, '/'))) cleanfname = p+1;
|
||||
+ if ((p = strrchr(cleanfname, '\\'))) cleanfname = p+1;
|
||||
#endif
|
||||
- if (p = strrchr(cleanfname, ':')) cleanfname = p+1;
|
||||
+ if ((p = strrchr(cleanfname, ':'))) cleanfname = p+1;
|
||||
|
||||
/* Find file type */
|
||||
if (typeoverride) {
|
10
converters/mpack/files/patch-magic.c
Normal file
10
converters/mpack/files/patch-magic.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- magic.c
|
||||
+++ magic.c
|
||||
@@ -23,6 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <string.h>
|
||||
|
||||
/* Description of the various file formats and their magic numbers */
|
||||
struct magic {
|
11
converters/mpack/files/patch-mkreadme.pl
Normal file
11
converters/mpack/files/patch-mkreadme.pl
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- mkreadme.pl.orig Tue Feb 28 21:37:42 2006
|
||||
+++ mkreadme.pl Tue Feb 28 21:38:32 2006
|
||||
@@ -413,7 +413,7 @@
|
||||
=unix
|
||||
TMPDIR
|
||||
Root of directory to store partial messages awaiting
|
||||
- reassembly. Default is "/usr/tmp". Partial messages
|
||||
+ reassembly. Default is "/tmp". Partial messages
|
||||
are stored in subdirectories of $TMPDIR/m-prts-$USER/
|
||||
|
||||
=pc os2
|
39
converters/mpack/files/patch-part.c
Normal file
39
converters/mpack/files/patch-part.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
--- part.c
|
||||
+++ part.c
|
||||
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "part.h"
|
||||
@@ -58,7 +59,7 @@
|
||||
/*
|
||||
* Close and free 'part'.
|
||||
*/
|
||||
-int part_close(struct part *part)
|
||||
+void part_close(struct part *part)
|
||||
{
|
||||
fclose(part->infile);
|
||||
if (part->buf) free(part->buf);
|
||||
@@ -77,8 +78,7 @@
|
||||
/*
|
||||
* Add to 'part' the multipart boundary 'boundary'.
|
||||
*/
|
||||
-int
|
||||
-part_addboundary(struct part *part, char *boundary)
|
||||
+void part_addboundary(struct part *part, char *boundary)
|
||||
{
|
||||
/* Grow boundary array if necessary */
|
||||
if (part->boundary_num == part->boundary_alloc) {
|
||||
@@ -165,8 +165,7 @@
|
||||
* Leaves room in the input buffer to push back an additional single
|
||||
* character using the prot_ungetc() macro.
|
||||
*/
|
||||
-int
|
||||
-part_ungets(char *s, struct part *part)
|
||||
+void part_ungets(char *s, struct part *part)
|
||||
{
|
||||
int len = strlen(s);
|
||||
int i;
|
92
converters/mpack/files/patch-unixos.c
Normal file
92
converters/mpack/files/patch-unixos.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
--- unixos.c.orig Mon Jul 21 23:54:05 2003
|
||||
+++ unixos.c Sun Mar 26 23:03:33 2006
|
||||
@@ -23,24 +23,30 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
+#include <time.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
#include "xmalloc.h"
|
||||
#include "common.h"
|
||||
#include "part.h"
|
||||
|
||||
+extern void warn(char *s);
|
||||
+
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#define MAXHOSTNAMELEN 64
|
||||
#endif
|
||||
|
||||
+#ifndef errno
|
||||
extern int errno;
|
||||
-extern char *malloc();
|
||||
-extern char *getenv();
|
||||
+#endif
|
||||
|
||||
int overwrite_files = 0;
|
||||
int didchat;
|
||||
@@ -76,7 +82,7 @@
|
||||
}
|
||||
|
||||
result = malloc(25+strlen(hostname));
|
||||
- sprintf(result, "%d.%d@%s", pid, curtime++, hostname);
|
||||
+ sprintf(result, "%d.%lu@%s", pid, (unsigned long) curtime++, hostname);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -90,7 +96,7 @@
|
||||
strcpy(buf, getenv("TMPDIR"));
|
||||
}
|
||||
else {
|
||||
- strcpy(buf, "/usr/tmp");
|
||||
+ strcpy(buf, "/tmp");
|
||||
}
|
||||
strcat(buf, "/m-prts-");
|
||||
p = getenv("USER");
|
||||
@@ -136,11 +142,7 @@
|
||||
int fd;
|
||||
FILE *ret;
|
||||
|
||||
-#ifdef O_EXCL
|
||||
- fd=open(fname, O_RDWR|O_CREAT|O_EXCL, 0644);
|
||||
-#else
|
||||
fd=open(fname, O_RDWR|O_CREAT|O_TRUNC, 0644);
|
||||
-#endif
|
||||
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
@@ -194,7 +196,7 @@
|
||||
do {
|
||||
if (outfile) fclose(outfile);
|
||||
sprintf(buf, "part%d", ++filesuffix);
|
||||
- } while (outfile = fopen(buf, "r"));
|
||||
+ } while ((outfile = fopen(buf, "r")));
|
||||
fname = buf;
|
||||
}
|
||||
else if (!overwrite_files && (outfile = fopen(fname, "r"))) {
|
||||
@@ -202,7 +204,7 @@
|
||||
fclose(outfile);
|
||||
sprintf(buf, "%s.%d", fname, ++filesuffix);
|
||||
|
||||
- } while (outfile = fopen(buf, "r"));
|
||||
+ } while ((outfile = fopen(buf, "r")));
|
||||
fname = buf;
|
||||
}
|
||||
|
||||
@@ -228,7 +230,7 @@
|
||||
|
||||
p = strchr(descfname, '/');
|
||||
if (!p) p = descfname;
|
||||
- if (p = strrchr(p, '.')) *p = '\0';
|
||||
+ if ((p = strrchr(p, '.'))) *p = '\0';
|
||||
|
||||
strcat(descfname, ".desc");
|
||||
(void) rename(TEMPFILENAME, descfname);
|
56
converters/mpack/files/patch-unixpk.c
Normal file
56
converters/mpack/files/patch-unixpk.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
--- unixpk.c.orig Mon Jul 21 23:50:41 2003
|
||||
+++ unixpk.c Sun Mar 26 23:35:56 2006
|
||||
@@ -23,23 +23,25 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/wait.h>
|
||||
+#include <unistd.h>
|
||||
#include "common.h"
|
||||
#include "version.h"
|
||||
#include "xmalloc.h"
|
||||
|
||||
#define MAXADDRESS 100
|
||||
|
||||
-extern char *getenv();
|
||||
-
|
||||
-extern int errno;
|
||||
-extern int optind;
|
||||
-extern char *optarg;
|
||||
-
|
||||
void usage(void);
|
||||
void sendmail(FILE *infile, char **addr, int start);
|
||||
void inews(FILE *infile);
|
||||
+void os_perror(char *str);
|
||||
+int encode(FILE *infile, FILE *applefile, char *fname, FILE *descfile,
|
||||
+ char *subject, char *headers, long int maxsize,
|
||||
+ char *typeoverride, char *outfname);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -155,7 +157,7 @@
|
||||
fprintf(stderr, "A subject is required\n");
|
||||
usage();
|
||||
}
|
||||
- if (p = strchr(sbuf, '\n')) *p = '\0';
|
||||
+ if ((p = strchr(sbuf, '\n'))) *p = '\0';
|
||||
subject = sbuf;
|
||||
}
|
||||
|
||||
@@ -164,10 +166,10 @@
|
||||
strcpy(fnamebuf, getenv("TMPDIR"));
|
||||
}
|
||||
else {
|
||||
- strcpy(fnamebuf, "/usr/tmp");
|
||||
+ strcpy(fnamebuf, "/tmp");
|
||||
}
|
||||
strcat(fnamebuf, "/mpackXXXXXX");
|
||||
- mktemp(fnamebuf);
|
||||
+ close(mkstemp(fnamebuf));
|
||||
outfname = strsave(fnamebuf);
|
||||
}
|
||||
|
11
converters/mpack/files/patch-unixpk.man
Normal file
11
converters/mpack/files/patch-unixpk.man
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- unixpk.man.orig Tue Feb 28 21:38:44 2006
|
||||
+++ unixpk.man Tue Feb 28 21:39:33 2006
|
||||
@@ -136,7 +136,7 @@
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
-Directory to store temporary files. Default is /usr/tmp.
|
||||
+Directory to store temporary files. Default is /tmp.
|
||||
.TP
|
||||
.B SPLITSIZE
|
||||
Default value of the -m switch.
|
|
@ -1,12 +0,0 @@
|
|||
$OpenBSD: patch-unixpk_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- unixpk.c.orig Thu Feb 16 22:39:50 1995
|
||||
+++ unixpk.c Mon Aug 5 12:30:30 2002
|
||||
@@ -165,7 +165,7 @@ char **argv;
|
||||
strcpy(fnamebuf, "/tmp");
|
||||
}
|
||||
strcat(fnamebuf, "/mpackXXXXXX");
|
||||
- mktemp(fnamebuf);
|
||||
+ close(mkstemp(fnamebuf));
|
||||
outfname = strsave(fnamebuf);
|
||||
}
|
||||
|
33
converters/mpack/files/patch-unixunpk.c
Normal file
33
converters/mpack/files/patch-unixunpk.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- unixunpk.c.orig Mon Jul 21 23:51:55 2003
|
||||
+++ unixunpk.c Sun Mar 26 23:36:54 2006
|
||||
@@ -23,17 +23,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
#include "version.h"
|
||||
#include "part.h"
|
||||
|
||||
-extern int optind;
|
||||
-extern char *optarg;
|
||||
-
|
||||
extern int overwrite_files;
|
||||
extern int didchat;
|
||||
int quiet;
|
||||
|
||||
void usage(void);
|
||||
+int handleMessage(struct part *inpart, char *defaultContentType,
|
||||
+ int inAppleDouble, int extractText);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -100,7 +101,7 @@
|
||||
|
||||
void usage(void) {
|
||||
fprintf(stderr, "munpack version %s\n", MPACK_VERSION);
|
||||
- fprintf(stderr, "usage: munpack [-f] [-q] [-C directory] [files...]\n");
|
||||
+ fprintf(stderr, "usage: munpack [-f] [-q] [-t] [-C directory] [files...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
11
converters/mpack/files/patch-unixunpk.man
Normal file
11
converters/mpack/files/patch-unixunpk.man
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- unixunpk.man.orig Wed Mar 1 13:54:19 2006
|
||||
+++ unixunpk.man Wed Mar 1 13:54:38 2006
|
||||
@@ -107,7 +107,7 @@
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B TMPDIR
|
||||
-Directory to store temporary files. Default is /usr/tmp.
|
||||
+Directory to store temporary files. Default is /tmp.
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $TMPDIR/m-prts-$USER/
|
|
@ -1,12 +0,0 @@
|
|||
$OpenBSD: patch-unixunpk_c,v 1.1 2002/08/09 01:15:19 naddy Exp $
|
||||
--- unixunpk.c.orig Fri Aug 9 02:44:18 2002
|
||||
+++ unixunpk.c Fri Aug 9 02:44:38 2002
|
||||
@@ -100,7 +100,7 @@ char **argv;
|
||||
|
||||
usage() {
|
||||
fprintf(stderr, "munpack version %s\n", MPACK_VERSION);
|
||||
- fprintf(stderr, "usage: munpack [-f] [-q] [-C directory] [files...]\n");
|
||||
+ fprintf(stderr, "usage: munpack [-f] [-q] [-t] [-C directory] [files...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
83
converters/mpack/files/patch-uudecode.c
Normal file
83
converters/mpack/files/patch-uudecode.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
--- uudecode.c.orig Sun Mar 26 23:09:32 2006
|
||||
+++ uudecode.c Sun Mar 26 23:11:17 2006
|
||||
@@ -23,8 +23,10 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
+#include <unistd.h>
|
||||
#include "xmalloc.h"
|
||||
#include "common.h"
|
||||
#include "part.h"
|
||||
@@ -32,9 +34,25 @@
|
||||
extern char *os_idtodir(char *id);
|
||||
extern FILE *os_newtypedfile(char *fname, char *contentType, int flags, params contentParams);
|
||||
extern FILE *os_createnewfile(char *fname);
|
||||
+extern int os_binhex(struct part *inpart, int part, int nparts);
|
||||
+extern void os_closetypedfile(FILE *outfile);
|
||||
+extern void os_donewithdir(char *dir);
|
||||
+extern void os_perror(char *str);
|
||||
+extern void chat(char *s);
|
||||
+
|
||||
+extern void part_ungets(char *s, struct part *part);
|
||||
+extern void part_close(struct part *part);
|
||||
+extern int handleMessage(struct part *inpart, char *defaultContentType,
|
||||
+ int inAppleDouble, int extractText);
|
||||
|
||||
static FILE *startDescFile(char *fname);
|
||||
+static void uudecodeline(char *line, FILE *outfile);
|
||||
|
||||
+int parseSubject(unsigned 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);
|
||||
|
||||
/* Length of a normal uuencoded line, including newline */
|
||||
#define UULENGTH 62
|
||||
@@ -266,7 +284,7 @@
|
||||
}
|
||||
else if (part == 1 && fname && !descfile &&
|
||||
!strncasecmp(buf, "x-file-desc: ", 13)) {
|
||||
- if (descfile = startDescFile(fname)) {
|
||||
+ if ((descfile = startDescFile(fname))) {
|
||||
fputs(buf+13, descfile);
|
||||
fclose(descfile);
|
||||
descfile = 0;
|
||||
@@ -454,7 +472,7 @@
|
||||
/* Retrieve any previously saved number of the last part */
|
||||
if (nparts == 0) {
|
||||
sprintf(buf, "%sCT", dir);
|
||||
- if (partfile = fopen(buf, "r")) {
|
||||
+ if ((partfile = fopen(buf, "r"))) {
|
||||
if (fgets(buf, sizeof(buf), partfile)) {
|
||||
nparts = atoi(buf);
|
||||
if (nparts < 0) nparts = 0;
|
||||
@@ -722,7 +740,7 @@
|
||||
if (!*fname) return 1;
|
||||
|
||||
/* Guess the content-type of common filename extensions */
|
||||
- if (p = strrchr(fname, '.')) {
|
||||
+ if ((p = strrchr(fname, '.'))) {
|
||||
if (!strcasecmp(p, ".gif")) contentType = "image/gif";
|
||||
if (!strcasecmp(p, ".jpg")) contentType = "image/jpeg";
|
||||
if (!strcasecmp(p, ".jpeg")) contentType = "image/jpeg";
|
||||
@@ -826,7 +844,7 @@
|
||||
/*
|
||||
* Decode a uuencoded line to 'outfile'
|
||||
*/
|
||||
-int uudecodeline(char *line, FILE *outfile)
|
||||
+static void uudecodeline(char *line, FILE *outfile)
|
||||
{
|
||||
int c, len;
|
||||
|
||||
@@ -845,7 +863,6 @@
|
||||
}
|
||||
line += 4;
|
||||
}
|
||||
- return;
|
||||
}
|
||||
|
||||
|
28
converters/mpack/files/patch-xmalloc.c
Normal file
28
converters/mpack/files/patch-xmalloc.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
--- xmalloc.c.orig Mon Jul 21 23:35:31 2003
|
||||
+++ xmalloc.c Sun Mar 26 23:07:02 2006
|
||||
@@ -23,14 +23,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-extern char *malloc(), *realloc();
|
||||
|
||||
char *xmalloc (int size)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
- if (ret = malloc((unsigned) size))
|
||||
+ if ((ret = malloc((unsigned) size)))
|
||||
return ret;
|
||||
|
||||
fprintf(stderr, "Memory exhausted\n");
|
||||
@@ -43,7 +43,7 @@
|
||||
char *ret;
|
||||
|
||||
/* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */
|
||||
- if (ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size))
|
||||
+ if ((ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size)))
|
||||
return ret;
|
||||
|
||||
fprintf(stderr, "Memory exhausted\n");
|
Loading…
Add table
Reference in a new issue