summaryrefslogtreecommitdiff
path: root/converters/mpack/files/patch-uudecode.c
blob: 48c28d71b6ad95b47e8833b645fc7c5376f810b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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;
 }