Files
macports-ports/mail/mpack/files/implicit.patch

288 lines
7.2 KiB
Diff

Fix a zillion implicit declaration of function errors.
Taken from https://sources.debian.org/patches/mpack/1.6-8.2/01-legacy.patch/
but changes not related to fixing build errors have been removed.
--- part.c.orig
+++ 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;
--- decode.c.orig
+++ decode.c
@@ -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'.
*/
--- xmalloc.c.orig
+++ xmalloc.c
@@ -23,8 +23,8 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-extern char *malloc(), *realloc();
char *xmalloc (int size)
{
--- unixos.c.orig
+++ unixos.c
@@ -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;
--- unixunpk.c.orig
+++ unixunpk.c
@@ -23,17 +23,19 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.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)
{
--- magic.c.orig
+++ 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 {
--- uudecode.c.orig
+++ uudecode.c
@@ -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(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
@@ -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;
--- md5.h.orig
+++ md5.h
@@ -34,6 +34,8 @@
#define PROTOTYPES 0
#endif
+#include <stdint.h>
+
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
--- unixpk.c.orig
+++ unixpk.c
@@ -23,23 +23,27 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <getopt.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)
{
--- encode.c.orig
+++ encode.c
@@ -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