… | |
… | |
52 | #include <uudeview.h> |
52 | #include <uudeview.h> |
53 | #include <uuint.h> |
53 | #include <uuint.h> |
54 | #include <fptools.h> |
54 | #include <fptools.h> |
55 | #include <uustring.h> |
55 | #include <uustring.h> |
56 | |
56 | |
57 | char * uuutil_id = "$Id: uuutil.c,v 1.2 2001/06/11 20:42:39 root Exp $"; |
57 | char * uuutil_id = "$Id: uuutil.c,v 1.2.2.4 2003/11/06 13:08:25 root Exp $"; |
58 | |
58 | |
59 | /* |
59 | /* |
60 | * Parts with different known extensions will not be merged by SPMS. |
60 | * Parts with different known extensions will not be merged by SPMS. |
61 | * if first character is '@', it is synonymous to the previous one. |
61 | * if first character is '@', it is synonymous to the previous one. |
62 | */ |
62 | */ |
… | |
… | |
71 | |
71 | |
72 | /* |
72 | /* |
73 | * forward declarations of local functions |
73 | * forward declarations of local functions |
74 | */ |
74 | */ |
75 | |
75 | |
76 | static int UUSMPKnownExt (char *filename); |
76 | static int UUSMPKnownExt _ANSI_ARGS_((char *filename)); |
77 | static uulist * UU_smparts_r (uulist *, int); |
77 | static uulist * UU_smparts_r _ANSI_ARGS_((uulist *, int)); |
78 | |
78 | |
79 | /* |
79 | /* |
80 | * mallocable areas |
80 | * mallocable areas |
81 | */ |
81 | */ |
82 | |
82 | |
… | |
… | |
88 | |
88 | |
89 | void |
89 | void |
90 | UUkillfread (fileread *data) |
90 | UUkillfread (fileread *data) |
91 | { |
91 | { |
92 | if (data != NULL) { |
92 | if (data != NULL) { |
93 | FP_free (data->subject); |
93 | _FP_free (data->subject); |
94 | FP_free (data->filename); |
94 | _FP_free (data->filename); |
95 | FP_free (data->origin); |
95 | _FP_free (data->origin); |
96 | FP_free (data->mimeid); |
96 | _FP_free (data->mimeid); |
97 | FP_free (data->mimetype); |
97 | _FP_free (data->mimetype); |
98 | FP_free (data->sfname); |
98 | _FP_free (data->sfname); |
99 | FP_free (data); |
99 | _FP_free (data); |
100 | } |
100 | } |
101 | } |
101 | } |
102 | |
102 | |
103 | void |
103 | void |
104 | UUkillfile (uufile *data) |
104 | UUkillfile (uufile *data) |
105 | { |
105 | { |
106 | uufile *next; |
106 | uufile *next; |
107 | |
107 | |
108 | while (data) { |
108 | while (data) { |
109 | FP_free (data->filename); |
109 | _FP_free (data->filename); |
110 | FP_free (data->subfname); |
110 | _FP_free (data->subfname); |
111 | FP_free (data->mimeid); |
111 | _FP_free (data->mimeid); |
112 | FP_free (data->mimetype); |
112 | _FP_free (data->mimetype); |
113 | UUkillfread (data->data); |
113 | UUkillfread (data->data); |
114 | |
114 | |
115 | next = data->NEXT; |
115 | next = data->NEXT; |
116 | FP_free (data); |
116 | _FP_free (data); |
117 | data = next; |
117 | data = next; |
118 | } |
118 | } |
119 | } |
119 | } |
120 | |
120 | |
121 | void |
121 | void |
… | |
… | |
128 | if (unlink (data->binfile)) |
128 | if (unlink (data->binfile)) |
129 | UUMessage (uuutil_id, __LINE__, UUMSG_WARNING, |
129 | UUMessage (uuutil_id, __LINE__, UUMSG_WARNING, |
130 | uustring (S_TMP_NOT_REMOVED), |
130 | uustring (S_TMP_NOT_REMOVED), |
131 | data->binfile, strerror (errno)); |
131 | data->binfile, strerror (errno)); |
132 | |
132 | |
133 | FP_free (data->filename); |
133 | _FP_free (data->filename); |
134 | FP_free (data->subfname); |
134 | _FP_free (data->subfname); |
135 | FP_free (data->mimeid); |
135 | _FP_free (data->mimeid); |
136 | FP_free (data->mimetype); |
136 | _FP_free (data->mimetype); |
137 | FP_free (data->binfile); |
137 | _FP_free (data->binfile); |
138 | UUkillfile (data->thisfile); |
138 | UUkillfile (data->thisfile); |
139 | FP_free (data->haveparts); |
139 | _FP_free (data->haveparts); |
140 | FP_free (data->misparts); |
140 | _FP_free (data->misparts); |
141 | |
141 | |
142 | next = data->NEXT; |
142 | next = data->NEXT; |
143 | FP_free (data); |
143 | _FP_free (data); |
144 | data = next; |
144 | data = next; |
145 | } |
145 | } |
146 | } |
146 | } |
147 | |
147 | |
148 | /* |
148 | /* |
… | |
… | |
151 | |
151 | |
152 | void |
152 | void |
153 | UUkillheaders (headers *data) |
153 | UUkillheaders (headers *data) |
154 | { |
154 | { |
155 | if (data != NULL) { |
155 | if (data != NULL) { |
156 | FP_free (data->from); |
156 | _FP_free (data->from); |
157 | FP_free (data->subject); |
157 | _FP_free (data->subject); |
158 | FP_free (data->rcpt); |
158 | _FP_free (data->rcpt); |
159 | FP_free (data->date); |
159 | _FP_free (data->date); |
160 | FP_free (data->mimevers); |
160 | _FP_free (data->mimevers); |
161 | FP_free (data->ctype); |
161 | _FP_free (data->ctype); |
162 | FP_free (data->ctenc); |
162 | _FP_free (data->ctenc); |
163 | FP_free (data->fname); |
163 | _FP_free (data->fname); |
164 | FP_free (data->boundary); |
164 | _FP_free (data->boundary); |
165 | FP_free (data->mimeid); |
165 | _FP_free (data->mimeid); |
166 | memset (data, 0, sizeof (headers)); |
166 | memset (data, 0, sizeof (headers)); |
167 | } |
167 | } |
168 | } |
168 | } |
169 | |
169 | |
170 | /* |
170 | /* |
… | |
… | |
173 | */ |
173 | */ |
174 | |
174 | |
175 | static int |
175 | static int |
176 | UUSMPKnownExt (char *filename) |
176 | UUSMPKnownExt (char *filename) |
177 | { |
177 | { |
178 | char **eiter = knownexts, *ptr=FP_strrchr(filename, '.'); |
178 | char **eiter = knownexts, *ptr=_FP_strrchr(filename, '.'); |
179 | int count=0, where=0; |
179 | int count=0, where=0; |
180 | |
180 | |
181 | if (ptr == NULL) |
181 | if (ptr == NULL) |
182 | return -1; |
182 | return -1; |
183 | ptr++; |
183 | ptr++; |
184 | |
184 | |
185 | while (*eiter) { |
185 | while (*eiter) { |
186 | if (FP_stricmp (ptr, (**eiter=='@')?*eiter+1:*eiter) == 0) |
186 | if (_FP_stricmp (ptr, (**eiter=='@')?*eiter+1:*eiter) == 0) |
187 | return where; |
187 | return where; |
188 | else |
188 | else |
189 | eiter++; |
189 | eiter++; |
190 | |
190 | |
191 | if (*eiter == NULL) |
191 | if (*eiter == NULL) |
… | |
… | |
381 | |
381 | |
382 | dest = iter->thisfile; |
382 | dest = iter->thisfile; |
383 | fiter = addit->thisfile; |
383 | fiter = addit->thisfile; |
384 | |
384 | |
385 | if (iter->filename == NULL && addit->filename != NULL) |
385 | if (iter->filename == NULL && addit->filename != NULL) |
386 | iter->filename = FP_strdup (addit->filename); |
386 | iter->filename = _FP_strdup (addit->filename); |
387 | |
387 | |
388 | if (addit->begin) iter->begin = 1; |
388 | if (addit->begin) iter->begin = 1; |
389 | if (addit->end) iter->end = 1; |
389 | if (addit->end) iter->end = 1; |
390 | |
390 | |
391 | if (addit->mode != 0 && iter->mode == 0) |
391 | if (addit->mode != 0 && iter->mode == 0) |