… | |
… | |
51 | #include <uudeview.h> |
51 | #include <uudeview.h> |
52 | #include <uuint.h> |
52 | #include <uuint.h> |
53 | #include <fptools.h> |
53 | #include <fptools.h> |
54 | #include <uustring.h> |
54 | #include <uustring.h> |
55 | |
55 | |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.19 2011/05/27 13:37:13 root Exp $"; |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.20 2020/12/10 22:49:15 root Exp $"; |
57 | |
57 | |
58 | /* |
58 | /* |
59 | * Arbitrary number. This is the maximum number of part numbers we |
59 | * Arbitrary number. This is the maximum number of part numbers we |
60 | * store for our have-parts and missing-parts lists |
60 | * store for our have-parts and missing-parts lists |
61 | */ |
61 | */ |
… | |
… | |
95 | "()[]", "[]()" |
95 | "()[]", "[]()" |
96 | }; |
96 | }; |
97 | |
97 | |
98 | /* |
98 | /* |
99 | * Extract a filename from the subject line. We need anything to identify |
99 | * Extract a filename from the subject line. We need anything to identify |
100 | * the name of the program for sorting. If a nice filename cannot be found, |
100 | * the name of the program for sorting. If a nice filename cannot be found, |
101 | * the subject line itself is used |
101 | * the subject line itself is used |
102 | * ptonum is, if not NULL, a pointer to the part number in the subject line, |
102 | * ptonum is, if not NULL, a pointer to the part number in the subject line, |
103 | * so that it won't be used as filename. |
103 | * so that it won't be used as filename. |
104 | **/ |
104 | **/ |
105 | static char * |
105 | static char * |
… | |
… | |
160 | } |
160 | } |
161 | iter++; |
161 | iter++; |
162 | while (isspace (*iter)) |
162 | while (isspace (*iter)) |
163 | iter++; |
163 | iter++; |
164 | count = length = alflag = 0; |
164 | count = length = alflag = 0; |
165 | while (iter[count] && |
165 | while (iter[count] && |
166 | (isalnum (iter[count]) || strchr (fnchars, iter[count])!=NULL)) { |
166 | (isalnum (iter[count]) || strchr (fnchars, iter[count])!=NULL)) { |
167 | if (isalpha (iter[count])) |
167 | if (isalpha (iter[count])) |
168 | alflag++; |
168 | alflag++; |
169 | count++; |
169 | count++; |
170 | } |
170 | } |
… | |
… | |
220 | /* #warning another experimental change */ |
220 | /* #warning another experimental change */ |
221 | /*while (*ptr && *ptr != 0x0a && *ptr != 0x0d && ptr != part) {*/ |
221 | /*while (*ptr && *ptr != 0x0a && *ptr != 0x0d && ptr != part) {*/ |
222 | while (*ptr && *ptr != 0x0a && *ptr != 0x0d) { |
222 | while (*ptr && *ptr != 0x0a && *ptr != 0x0d) { |
223 | iter = ptr; |
223 | iter = ptr; |
224 | count = length = alflag = 0; |
224 | count = length = alflag = 0; |
225 | |
225 | |
226 | if (_FP_strnicmp (ptr, "ftp", 3) == 0) { |
226 | if (_FP_strnicmp (ptr, "ftp", 3) == 0) { |
227 | /* hey, that's an ftp address */ |
227 | /* hey, that's an ftp address */ |
228 | while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') |
228 | while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') |
229 | ptr++; |
229 | ptr++; |
230 | continue; |
230 | continue; |
231 | } |
231 | } |
232 | |
232 | |
233 | while ((isalnum(*iter)||strchr(fnchars, *iter)!=NULL|| |
233 | while ((isalnum(*iter)||strchr(fnchars, *iter)!=NULL|| |
234 | *iter=='/') && *iter && iter != ptonum && *iter != '.') { |
234 | *iter=='/') && *iter && iter != ptonum && *iter != '.') { |
235 | if (isalpha (*iter)) |
235 | if (isalpha (*iter)) |
236 | alflag = 1; |
236 | alflag = 1; |
237 | |
237 | |
238 | count++; iter++; |
238 | count++; iter++; |
239 | } |
239 | } |
240 | if (*iter == '\0' || iter == ptonum) { |
240 | if (*iter == '\0' || iter == ptonum) { |
241 | if (iter == ptonum) |
241 | if (iter == ptonum) |
242 | ptr = ptonend; |
242 | ptr = ptonend; |
… | |
… | |
260 | ptr = iter + 1; |
260 | ptr = iter + 1; |
261 | length = 0; |
261 | length = 0; |
262 | continue; |
262 | continue; |
263 | } |
263 | } |
264 | |
264 | |
265 | if (_FP_strnicmp (iter, "edu", 3) == 0 || |
265 | if (_FP_strnicmp (iter, "edu", 3) == 0 || |
266 | _FP_strnicmp (iter, "gov", 3) == 0) { |
266 | _FP_strnicmp (iter, "gov", 3) == 0) { |
267 | /* hey, that's an ftp address */ |
267 | /* hey, that's an ftp address */ |
268 | while (isalpha (*iter) || isdigit (*iter) || *iter == '.') |
268 | while (isalpha (*iter) || isdigit (*iter) || *iter == '.') |
269 | iter++; |
269 | iter++; |
270 | ptr = iter; |
270 | ptr = iter; |
271 | length = 0; |
271 | length = 0; |
272 | continue; |
272 | continue; |
273 | } |
273 | } |
274 | |
274 | |
275 | length += count + 1; |
275 | length += count + 1; |
276 | count = 0; |
276 | count = 0; |
277 | |
277 | |
278 | while ((isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
278 | while ((isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
279 | iter[count]=='/') && iter[count] && iter[count] != '.') |
279 | iter[count]=='/') && iter[count] && iter[count] != '.') |
280 | count++; |
280 | count++; |
281 | |
281 | |
282 | if (iter[count]==':' && iter[count+1]=='/') { |
282 | if (iter[count]==':' && iter[count+1]=='/') { |
283 | /* looks like stuff from a mail server */ |
283 | /* looks like stuff from a mail server */ |
284 | ptr = iter + 1; |
284 | ptr = iter + 1; |
285 | length = 0; |
285 | length = 0; |
286 | continue; |
286 | continue; |
287 | } |
287 | } |
288 | |
288 | |
289 | if (count > 8 || iter == ptonum) { |
289 | if (count > 8 || iter == ptonum) { |
290 | ptr = iter; |
290 | ptr = iter; |
291 | length = 0; |
291 | length = 0; |
292 | continue; |
292 | continue; |
293 | } |
293 | } |
294 | |
294 | |
295 | if (iter[count] != '.') { |
295 | if (iter[count] != '.') { |
296 | length += count; |
296 | length += count; |
297 | break; |
297 | break; |
298 | } |
298 | } |
299 | |
299 | |
300 | while (iter[count] && |
300 | while (iter[count] && |
301 | (isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
301 | (isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL|| |
302 | iter[count]=='/')) |
302 | iter[count]=='/')) |
303 | count++; |
303 | count++; |
304 | |
304 | |
305 | if (iter[count]==':' && iter[count+1]=='/') { |
305 | if (iter[count]==':' && iter[count+1]=='/') { |
306 | /* looks like stuff from a mail server */ |
306 | /* looks like stuff from a mail server */ |
307 | ptr = iter + 1; |
307 | ptr = iter + 1; |
308 | length = 0; |
308 | length = 0; |
309 | continue; |
309 | continue; |
310 | } |
310 | } |
311 | |
311 | |
312 | if (count < 12 && iter != ptonum) { |
312 | if (count < 12 && iter != ptonum) { |
313 | length += count; |
313 | length += count; |
314 | break; |
314 | break; |
315 | } |
315 | } |
316 | |
316 | |
… | |
… | |
324 | |
324 | |
325 | while (*ptr && !isalpha (*ptr)) |
325 | while (*ptr && !isalpha (*ptr)) |
326 | ptr++; |
326 | ptr++; |
327 | |
327 | |
328 | while ((isalnum(ptr[length])||strchr(fnchars,ptr[length])!=NULL|| |
328 | while ((isalnum(ptr[length])||strchr(fnchars,ptr[length])!=NULL|| |
329 | ptr[length] == '/') && |
329 | ptr[length] == '/') && |
330 | ptr[length] && ptr+length!=part && ptr+length!=ptonum) |
330 | ptr[length] && ptr+length!=part && ptr+length!=ptonum) |
331 | length++; |
331 | length++; |
332 | |
332 | |
333 | if (length) { |
333 | if (length) { |
334 | if (ptr[length] == '\0' || ptr[length] == 0x0a || ptr[length] == 0x0d) { |
334 | if (ptr[length] == '\0' || ptr[length] == 0x0a || ptr[length] == 0x0d) { |
… | |
… | |
361 | if ((result = (char *) malloc (length + 1)) == NULL) { |
361 | if ((result = (char *) malloc (length + 1)) == NULL) { |
362 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
362 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
363 | uustring (S_OUT_OF_MEMORY), length+1); |
363 | uustring (S_OUT_OF_MEMORY), length+1); |
364 | return NULL; |
364 | return NULL; |
365 | } |
365 | } |
366 | |
366 | |
367 | memcpy (result, ptr, length); |
367 | memcpy (result, ptr, length); |
368 | result[length] = '\0'; |
368 | result[length] = '\0'; |
369 | |
369 | |
370 | return uu_FileNameCallback ? uu_FileNameCallback(uu_FNCBArg, subject, result) : result; |
370 | return uu_FileNameCallback ? uu_FileNameCallback(uu_FNCBArg, subject, result) : result; |
371 | } |
371 | } |
372 | |
372 | |
373 | /* |
373 | /* |
374 | * Extract the Part Number from the subject line. |
374 | * Extract the Part Number from the subject line. |
… | |
… | |
424 | if (!isdigit (*iter)) { |
424 | if (!isdigit (*iter)) { |
425 | continue; |
425 | continue; |
426 | } |
426 | } |
427 | while (isdigit (iter[count])) |
427 | while (isdigit (iter[count])) |
428 | count++; |
428 | count++; |
429 | |
429 | |
430 | if (iter[count] == '\0') { |
430 | if (iter[count] == '\0') { |
431 | iter += count; |
431 | iter += count; |
432 | break; |
432 | break; |
433 | } |
433 | } |
434 | |
434 | |
… | |
… | |
442 | continue; |
442 | continue; |
443 | } |
443 | } |
444 | |
444 | |
445 | while (iter[count] == ' ' || iter[count] == '#' || |
445 | while (iter[count] == ' ' || iter[count] == '#' || |
446 | iter[count] == '/' || iter[count] == '\\') count++; |
446 | iter[count] == '/' || iter[count] == '\\') count++; |
447 | |
447 | |
448 | if (_FP_strnicmp (iter + count, "of", 2) == 0) |
448 | if (_FP_strnicmp (iter + count, "of", 2) == 0) |
449 | count += 2; |
449 | count += 2; |
450 | |
450 | |
451 | while (iter[count] == ' ') count++; |
451 | while (iter[count] == ' ') count++; |
452 | while (isdigit (iter[count])) count++; |
452 | while (isdigit (iter[count])) count++; |
453 | while (iter[count] == ' ') count++; |
453 | while (iter[count] == ' ') count++; |
454 | |
454 | |
455 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
455 | if (iter[count] == brackchr[uu_bracket_policy][bpc+1]) { |
456 | *where = iter; |
456 | *where = iter; |
457 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
457 | bdel[0] = brackchr[uu_bracket_policy][bpc+1]; |
458 | delim = bdel; |
458 | delim = bdel; |
459 | length = plength; |
459 | length = plength; |
… | |
… | |
608 | |
608 | |
609 | #if 0 |
609 | #if 0 |
610 | if (length == 0) { |
610 | if (length == 0) { |
611 | count = strlen(subject) - 1; |
611 | count = strlen(subject) - 1; |
612 | ptr = subject; |
612 | ptr = subject; |
613 | |
613 | |
614 | while (count > 0) { |
614 | while (count > 0) { |
615 | if (!isdigit(ptr[count])||isalpha(ptr[count+1])||ptr[count+1] == '.') { |
615 | if (!isdigit(ptr[count])||isalpha(ptr[count+1])||ptr[count+1] == '.') { |
616 | count--; |
616 | count--; |
617 | continue; |
617 | continue; |
618 | } |
618 | } |
619 | length = 0; |
619 | length = 0; |
620 | |
620 | |
621 | while (count >= 0 && isdigit (ptr[count])) { |
621 | while (count >= 0 && isdigit (ptr[count])) { |
622 | count--; length++; |
622 | count--; length++; |
623 | } |
623 | } |
624 | if (count>=0 && ((isalpha (ptr[count]) && |
624 | if (count>=0 && ((isalpha (ptr[count]) && |
625 | (ptr[count] != 's' || ptr[count+1] != 't') && |
625 | (ptr[count] != 's' || ptr[count+1] != 't') && |
626 | (ptr[count] != 'n' || ptr[count+1] != 'd')) || |
626 | (ptr[count] != 'n' || ptr[count+1] != 'd')) || |
627 | ptr[count] == '/' || ptr[count] == '.' || |
627 | ptr[count] == '/' || ptr[count] == '.' || |
628 | ptr[count] == '-' || ptr[count] == '_')) { |
628 | ptr[count] == '-' || ptr[count] == '_')) { |
629 | length = 0; |
629 | length = 0; |
630 | continue; |
630 | continue; |
631 | } |
631 | } |
632 | count++; |
632 | count++; |
… | |
… | |
755 | |
755 | |
756 | result->yefilesize = data->yefilesize; |
756 | result->yefilesize = data->yefilesize; |
757 | result->mimeid = _FP_strdup (data->mimeid); |
757 | result->mimeid = _FP_strdup (data->mimeid); |
758 | result->mimetype = _FP_strdup (data->mimetype); |
758 | result->mimetype = _FP_strdup (data->mimetype); |
759 | |
759 | |
760 | if (result->partno == -1 && |
760 | if (result->partno == -1 && |
761 | (data->uudet == PT_ENCODED || data->uudet == QP_ENCODED)) |
761 | (data->uudet == PT_ENCODED || data->uudet == QP_ENCODED)) |
762 | result->partno = 1; |
762 | result->partno = 1; |
763 | |
763 | |
764 | if (data->flags & FL_SINGLE) { |
764 | if (data->flags & FL_SINGLE) { |
765 | /* |
765 | /* |
… | |
… | |
770 | result->filename = _FP_strdup (temp); |
770 | result->filename = _FP_strdup (temp); |
771 | } |
771 | } |
772 | if (result->subfname == NULL) |
772 | if (result->subfname == NULL) |
773 | result->subfname = _FP_strdup (result->filename); |
773 | result->subfname = _FP_strdup (result->filename); |
774 | |
774 | |
775 | if (result->filename == NULL || |
775 | if (result->filename == NULL || |
776 | result->subfname == NULL) { |
776 | result->subfname == NULL) { |
777 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
777 | UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, |
778 | uustring (S_OUT_OF_MEMORY), |
778 | uustring (S_OUT_OF_MEMORY), |
779 | (result->filename==NULL)? |
779 | (result->filename==NULL)? |
780 | (strlen(temp)+1):(strlen(result->filename)+1)); |
780 | (strlen(temp)+1):(strlen(result->filename)+1)); |
… | |
… | |
784 | } |
784 | } |
785 | if (result->partno == -1) |
785 | if (result->partno == -1) |
786 | result->partno = 1; |
786 | result->partno = 1; |
787 | } |
787 | } |
788 | else if (result->subfname == NULL && data->uudet && |
788 | else if (result->subfname == NULL && data->uudet && |
789 | (data->begin || result->partno == 1 || |
789 | (data->begin || result->partno == 1 || |
790 | (!uu_dumbness && result->partno == -1 && |
790 | (!uu_dumbness && result->partno == -1 && |
791 | (data->subject != NULL || result->filename != NULL)))) { |
791 | (data->subject != NULL || result->filename != NULL)))) { |
792 | /* |
792 | /* |
793 | * If it's the first part of something and has some valid data, but |
793 | * If it's the first part of something and has some valid data, but |
794 | * no subject or anything, initialize lastvalid |
794 | * no subject or anything, initialize lastvalid |
795 | */ |
795 | */ |
… | |
… | |
878 | lastvalid = 0; |
878 | lastvalid = 0; |
879 | } |
879 | } |
880 | else if (data->partno != -1 && result->filename) { |
880 | else if (data->partno != -1 && result->filename) { |
881 | result->subfname = _FP_strdup (result->filename); |
881 | result->subfname = _FP_strdup (result->filename); |
882 | } |
882 | } |
883 | else { |
883 | else { |
884 | /* |
884 | /* |
885 | * it's got no info, it's got no begin, and we don't know anything |
885 | * it's got no info, it's got no begin, and we don't know anything |
886 | * about this part. Let's forget all about it. |
886 | * about this part. Let's forget all about it. |
887 | */ |
887 | */ |
888 | *ret = UURET_NODATA; |
888 | *ret = UURET_NODATA; |
889 | UUkillfile (result); |
889 | UUkillfile (result); |
… | |
… | |
915 | * useful part number |
915 | * useful part number |
916 | */ |
916 | */ |
917 | |
917 | |
918 | if (result->partno == -1 && data->begin) { |
918 | if (result->partno == -1 && data->begin) { |
919 | /* |
919 | /* |
920 | * hmm, this is reason enough to initialize lastvalid, at least |
920 | * hmm, this is reason enough to initialize lastvalid, at least |
921 | * if we have no end |
921 | * if we have no end |
922 | */ |
922 | */ |
923 | if (!data->end) { |
923 | if (!data->end) { |
924 | _FP_strncpy (uucheck_lastname, result->subfname, 256); |
924 | _FP_strncpy (uucheck_lastname, result->subfname, 256); |
925 | result->partno = lastpart = 1; |
925 | result->partno = lastpart = 1; |
… | |
… | |
1055 | /* |
1055 | /* |
1056 | * special case when we might have tagged a part as Base64 when the |
1056 | * special case when we might have tagged a part as Base64 when the |
1057 | * file was really XX |
1057 | * file was really XX |
1058 | */ |
1058 | */ |
1059 | |
1059 | |
1060 | if (data->data->uudet == B64ENCODED && |
1060 | if (data->data->uudet == B64ENCODED && |
1061 | iter->uudet == XX_ENCODED && iter->begin) { |
1061 | iter->uudet == XX_ENCODED && iter->begin) { |
1062 | data->data->uudet = XX_ENCODED; |
1062 | data->data->uudet = XX_ENCODED; |
1063 | } |
1063 | } |
1064 | else if (data->data->uudet == XX_ENCODED && data->data->begin && |
1064 | else if (data->data->uudet == XX_ENCODED && data->data->begin && |
1065 | iter->uudet == B64ENCODED) { |
1065 | iter->uudet == B64ENCODED) { |
… | |
… | |
1147 | |
1147 | |
1148 | /* |
1148 | /* |
1149 | * if at the end of the part list, add it |
1149 | * if at the end of the part list, add it |
1150 | */ |
1150 | */ |
1151 | |
1151 | |
1152 | if (fiter->NEXT == NULL || |
1152 | if (fiter->NEXT == NULL || |
1153 | (data->partno != -1 && data->partno < fiter->NEXT->partno)) { |
1153 | (data->partno != -1 && data->partno < fiter->NEXT->partno)) { |
1154 | data->NEXT = fiter->NEXT; |
1154 | data->NEXT = fiter->NEXT; |
1155 | fiter->NEXT = data; |
1155 | fiter->NEXT = data; |
1156 | |
1156 | |
1157 | if (data->partno == -1) |
1157 | if (data->partno == -1) |
… | |
… | |
1160 | return UURET_OK; |
1160 | return UURET_OK; |
1161 | } |
1161 | } |
1162 | last = fiter; |
1162 | last = fiter; |
1163 | fiter = fiter->NEXT; |
1163 | fiter = fiter->NEXT; |
1164 | } |
1164 | } |
1165 | |
1165 | |
1166 | return UURET_OK; /* Shouldn't get here */ |
1166 | return UURET_OK; /* Shouldn't get here */ |
1167 | } |
1167 | } |
1168 | goahead: |
1168 | goahead: |
1169 | /* |
1169 | /* |
1170 | * we need iter below |
1170 | * we need iter below |
1171 | */ |
1171 | */ |
1172 | if (iter->NEXT == NULL) |
1172 | if (iter->NEXT == NULL) |
1173 | break; |
1173 | break; |
1174 | |
1174 | |
1175 | iter = iter->NEXT; |
1175 | iter = iter->NEXT; |
1176 | } |
1176 | } |
1177 | /* |
1177 | /* |
… | |
… | |
1275 | if (liter->state & UUFILE_OK) { |
1275 | if (liter->state & UUFILE_OK) { |
1276 | liter = liter->NEXT; |
1276 | liter = liter->NEXT; |
1277 | continue; |
1277 | continue; |
1278 | } |
1278 | } |
1279 | else if ((liter->uudet == QP_ENCODED || |
1279 | else if ((liter->uudet == QP_ENCODED || |
1280 | liter->uudet == PT_ENCODED) && |
1280 | liter->uudet == PT_ENCODED) && |
1281 | (liter->flags & FL_SINGLE)) { |
1281 | (liter->flags & FL_SINGLE)) { |
1282 | if ((liter->flags&FL_PROPER)==0) |
1282 | if ((liter->flags&FL_PROPER)==0) |
1283 | liter->size = -1; |
1283 | liter->size = -1; |
1284 | else |
1284 | else |
1285 | liter->size = liter->thisfile->data->length; |
1285 | liter->size = liter->thisfile->data->length; |
… | |
… | |
1346 | liter->uudet == PT_ENCODED) |
1346 | liter->uudet == PT_ENCODED) |
1347 | flag |= 3; /* Don't need begin or end with Base64 or plain text*/ |
1347 | flag |= 3; /* Don't need begin or end with Base64 or plain text*/ |
1348 | |
1348 | |
1349 | if (fiter->data->begin) flag |= 1; |
1349 | if (fiter->data->begin) flag |= 1; |
1350 | if (fiter->data->end) flag |= 2; |
1350 | if (fiter->data->end) flag |= 2; |
1351 | if (fiter->data->uudet) flag |= 4; |
1351 | if (fiter->data->uudet) flag |= 4; |
1352 | |
1352 | |
1353 | /* |
1353 | /* |
1354 | * guess size of part |
1354 | * guess size of part |
1355 | */ |
1355 | */ |
1356 | |
1356 | |
… | |
… | |
1367 | case QP_ENCODED: |
1367 | case QP_ENCODED: |
1368 | case PT_ENCODED: |
1368 | case PT_ENCODED: |
1369 | thesize += fiter->data->length; |
1369 | thesize += fiter->data->length; |
1370 | break; |
1370 | break; |
1371 | } |
1371 | } |
1372 | |
1372 | |
1373 | fiter = fiter->NEXT; |
1373 | fiter = fiter->NEXT; |
1374 | |
1374 | |
1375 | while (fiter != NULL) { |
1375 | while (fiter != NULL) { |
1376 | for (count = part+1; count < fiter->partno && miscount < MAXPLIST; count++) |
1376 | for (count = part+1; count < fiter->partno && miscount < MAXPLIST; count++) |
1377 | misparts[miscount++] = count; |
1377 | misparts[miscount++] = count; |
1378 | |
1378 | |
1379 | part = fiter->partno; |
1379 | part = fiter->partno; |
1380 | |
1380 | |
1381 | if (havecount < MAXPLIST) |
1381 | if (havecount < MAXPLIST) |
1382 | haveparts[havecount++] = part; |
1382 | haveparts[havecount++] = part; |
1383 | |
1383 | |
1384 | if (fiter->data->begin) flag |= 1; |
1384 | if (fiter->data->begin) flag |= 1; |
1385 | if (fiter->data->end) flag |= 2; |
1385 | if (fiter->data->end) flag |= 2; |
… | |
… | |
1401 | break; |
1401 | break; |
1402 | } |
1402 | } |
1403 | |
1403 | |
1404 | if (fiter->data->end) |
1404 | if (fiter->data->end) |
1405 | break; |
1405 | break; |
1406 | |
1406 | |
1407 | fiter = fiter->NEXT; |
1407 | fiter = fiter->NEXT; |
1408 | } |
1408 | } |
1409 | |
1409 | |
1410 | /* |
1410 | /* |
1411 | * if in fast mode, we don't notice an 'end'. So if its uu or xx |
1411 | * if in fast mode, we don't notice an 'end'. So if its uu or xx |
1412 | * encoded, there's a begin line and encoded data, assume it's |
1412 | * encoded, there's a begin line and encoded data, assume it's |
1413 | * there. |
1413 | * there. |
1414 | */ |
1414 | */ |
1415 | |
1415 | |
1416 | if (uu_fast_scanning && (flag & 0x01) && (flag & 0x04) && |
1416 | if (uu_fast_scanning && (flag & 0x01) && (flag & 0x04) && |
1417 | (liter->uudet == UU_ENCODED || liter->uudet == XX_ENCODED)) |
1417 | (liter->uudet == UU_ENCODED || liter->uudet == XX_ENCODED)) |
1418 | flag |= 2; |
1418 | flag |= 2; |
1419 | |
1419 | |
1420 | /* |
1420 | /* |
… | |
… | |
1424 | _FP_free (liter->haveparts); |
1424 | _FP_free (liter->haveparts); |
1425 | _FP_free (liter->misparts); |
1425 | _FP_free (liter->misparts); |
1426 | |
1426 | |
1427 | liter->haveparts = NULL; |
1427 | liter->haveparts = NULL; |
1428 | liter->misparts = NULL; |
1428 | liter->misparts = NULL; |
1429 | |
1429 | |
1430 | if (havecount) { |
1430 | if (havecount) { |
1431 | if ((liter->haveparts=(int*)malloc((havecount+1)*sizeof(int)))!=NULL) { |
1431 | if ((liter->haveparts=(int*)malloc((havecount+1)*sizeof(int)))!=NULL) { |
1432 | memcpy (liter->haveparts, haveparts, havecount*sizeof(int)); |
1432 | memcpy (liter->haveparts, haveparts, havecount*sizeof(int)); |
1433 | liter->haveparts[havecount] = 0; |
1433 | liter->haveparts[havecount] = 0; |
1434 | } |
1434 | } |
1435 | } |
1435 | } |
1436 | |
1436 | |
1437 | if (miscount) { |
1437 | if (miscount) { |
1438 | if ((liter->misparts=(int*)malloc((miscount+1)*sizeof(int)))!=NULL) { |
1438 | if ((liter->misparts=(int*)malloc((miscount+1)*sizeof(int)))!=NULL) { |
1439 | memcpy (liter->misparts, misparts, miscount*sizeof(int)); |
1439 | memcpy (liter->misparts, misparts, miscount*sizeof(int)); |
1440 | liter->misparts[miscount] = 0; |
1440 | liter->misparts[miscount] = 0; |
1441 | } |
1441 | } |
… | |
… | |
1447 | */ |
1447 | */ |
1448 | |
1448 | |
1449 | if ((flag & 1) == 0) liter->state |= UUFILE_NOBEGIN; |
1449 | if ((flag & 1) == 0) liter->state |= UUFILE_NOBEGIN; |
1450 | if ((flag & 2) == 0) liter->state |= UUFILE_NOEND; |
1450 | if ((flag & 2) == 0) liter->state |= UUFILE_NOEND; |
1451 | if ((flag & 4) == 0) liter->state |= UUFILE_NODATA; |
1451 | if ((flag & 4) == 0) liter->state |= UUFILE_NODATA; |
1452 | |
1452 | |
1453 | if ((flag & 7) == 7 && miscount==0) { |
1453 | if ((flag & 7) == 7 && miscount==0) { |
1454 | liter->state = UUFILE_OK; |
1454 | liter->state = UUFILE_OK; |
1455 | } |
1455 | } |
1456 | |
1456 | |
1457 | if ((uu_fast_scanning && (liter->flags&FL_PROPER)==0) || thesize<=0) |
1457 | if ((uu_fast_scanning && (liter->flags&FL_PROPER)==0) || thesize<=0) |
1458 | liter->size = -1; |
1458 | liter->size = -1; |
1459 | else |
1459 | else |
1460 | liter->size = thesize; |
1460 | liter->size = thesize; |
1461 | |
1461 | |
1462 | if (liter->state==UUFILE_OK && |
1462 | if (liter->state==UUFILE_OK && |
1463 | (liter->filename==NULL || liter->filename[0]=='\0')) { |
1463 | (liter->filename==NULL || liter->filename[0]=='\0')) { |
1464 | /* |
1464 | /* |
1465 | * Emergency backup if the file does not have a filename |
1465 | * Emergency backup if the file does not have a filename |
1466 | */ |
1466 | */ |
1467 | _FP_free (liter->filename); |
1467 | _FP_free (liter->filename); |