ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/uucheck.c
(Generate patch)

Comparing Convert-UUlib/uulib/uucheck.c (file contents):
Revision 1.4 by root, Sun Mar 31 20:04:30 2002 UTC vs.
Revision 1.5 by root, Sun Mar 31 20:08:42 2002 UTC

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
56char * uucheck_id = "$Id: uucheck.c,v 1.4 2002/03/31 20:04:30 root Exp $"; 56char * uucheck_id = "$Id: uucheck.c,v 1.5 2002/03/31 20:08:42 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 */
132/* 132/*
133 * Ignore a "Repost" prefix of the subject line. We don't want to get 133 * Ignore a "Repost" prefix of the subject line. We don't want to get
134 * a file named "Repost" :-) 134 * a file named "Repost" :-)
135 **/ 135 **/
136 136
137 if (FP_strnicmp (subject, "repost", 6) == 0) 137 if (_FP_strnicmp (subject, "repost", 6) == 0)
138 subject += 6; 138 subject += 6;
139 if (FP_strnicmp (subject, "re:", 3) == 0) 139 if (_FP_strnicmp (subject, "re:", 3) == 0)
140 subject += 3; 140 subject += 3;
141 141
142 while (*subject == ' ' || *subject == ':') subject++; 142 while (*subject == ' ' || *subject == ':') subject++;
143 143
144 part = FP_stristr (subject, "part"); 144 part = _FP_stristr (subject, "part");
145 if (part == subject) { 145 if (part == subject) {
146 subject += 4; 146 subject += 4;
147 while (*subject == ' ') subject++; 147 while (*subject == ' ') subject++;
148 } 148 }
149 149
222 /*while (*ptr && *ptr != 0x0a && *ptr != 0x0d && ptr != part) {*/ 222 /*while (*ptr && *ptr != 0x0a && *ptr != 0x0d && ptr != part) {*/
223 while (*ptr && *ptr != 0x0a && *ptr != 0x0d) { 223 while (*ptr && *ptr != 0x0a && *ptr != 0x0d) {
224 iter = ptr; 224 iter = ptr;
225 count = length = alflag = 0; 225 count = length = alflag = 0;
226 226
227 if (FP_strnicmp (ptr, "ftp", 3) == 0) { 227 if (_FP_strnicmp (ptr, "ftp", 3) == 0) {
228 /* hey, that's an ftp address */ 228 /* hey, that's an ftp address */
229 while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.') 229 while (isalpha (*ptr) || isdigit (*ptr) || *ptr == '.')
230 ptr++; 230 ptr++;
231 continue; 231 continue;
232 } 232 }
261 ptr = iter + 1; 261 ptr = iter + 1;
262 length = 0; 262 length = 0;
263 continue; 263 continue;
264 } 264 }
265 265
266 if (FP_strnicmp (iter, "edu", 3) == 0 || 266 if (_FP_strnicmp (iter, "edu", 3) == 0 ||
267 FP_strnicmp (iter, "gov", 3) == 0) { 267 _FP_strnicmp (iter, "gov", 3) == 0) {
268 /* hey, that's an ftp address */ 268 /* hey, that's an ftp address */
269 while (isalpha (*iter) || isdigit (*iter) || *iter == '.') 269 while (isalpha (*iter) || isdigit (*iter) || *iter == '.')
270 iter++; 270 iter++;
271 ptr = iter; 271 ptr = iter;
272 length = 0; 272 length = 0;
438 } 438 }
439 439
440 while (iter[count] == ' ' || iter[count] == '#' || 440 while (iter[count] == ' ' || iter[count] == '#' ||
441 iter[count] == '/' || iter[count] == '\\') count++; 441 iter[count] == '/' || iter[count] == '\\') count++;
442 442
443 if (FP_strnicmp (iter + count, "of", 2) == 0) 443 if (_FP_strnicmp (iter + count, "of", 2) == 0)
444 count += 2; 444 count += 2;
445 445
446 while (iter[count] == ' ') count++; 446 while (iter[count] == ' ') count++;
447 while (isdigit (iter[count])) count++; 447 while (isdigit (iter[count])) count++;
448 while (iter[count] == ' ') count++; 448 while (iter[count] == ' ') count++;
464 /* 464 /*
465 * look for the string "part " followed by a number 465 * look for the string "part " followed by a number
466 */ 466 */
467 467
468 if (length == 0) { 468 if (length == 0) {
469 if ((iter = FP_stristr (subject, "part ")) != NULL) { 469 if ((iter = _FP_stristr (subject, "part ")) != NULL) {
470 iter += 5; 470 iter += 5;
471 471
472 while (isspace (*iter) || *iter == '.' || *iter == '-') 472 while (isspace (*iter) || *iter == '.' || *iter == '-')
473 iter++; 473 iter++;
474 474
475 while (isdigit (iter[length])) 475 while (isdigit (iter[length]))
476 length++; 476 length++;
477 477
478 if (length == 0) { 478 if (length == 0) {
479 if (FP_strnicmp (iter, "one", 3) == 0) length = 1; 479 if (_FP_strnicmp (iter, "one", 3) == 0) length = 1;
480 else if (FP_strnicmp (iter, "two", 3) == 0) length = 2; 480 else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2;
481 else if (FP_strnicmp (iter, "three", 5) == 0) length = 3; 481 else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3;
482 else if (FP_strnicmp (iter, "four", 4) == 0) length = 4; 482 else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4;
483 else if (FP_strnicmp (iter, "five", 4) == 0) length = 5; 483 else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5;
484 else if (FP_strnicmp (iter, "six", 3) == 0) length = 6; 484 else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6;
485 else if (FP_strnicmp (iter, "seven", 5) == 0) length = 7; 485 else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7;
486 else if (FP_strnicmp (iter, "eight", 5) == 0) length = 8; 486 else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8;
487 else if (FP_strnicmp (iter, "nine", 4) == 0) length = 9; 487 else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9;
488 else if (FP_strnicmp (iter, "ten", 3) == 0) length = 10; 488 else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10;
489 489
490 if (length && (*whend = strchr (iter, ' '))) { 490 if (length && (*whend = strchr (iter, ' '))) {
491 *where = iter; 491 *where = iter;
492 return length; 492 return length;
493 } 493 }
504 /* 504 /*
505 * look for the string "part" followed by a number 505 * look for the string "part" followed by a number
506 */ 506 */
507 507
508 if (length == 0) { 508 if (length == 0) {
509 if ((iter = FP_stristr (subject, "part")) != NULL) { 509 if ((iter = _FP_stristr (subject, "part")) != NULL) {
510 iter += 4; 510 iter += 4;
511 511
512 while (isspace (*iter) || *iter == '.' || *iter == '-') 512 while (isspace (*iter) || *iter == '.' || *iter == '-')
513 iter++; 513 iter++;
514 514
515 while (isdigit (iter[length])) 515 while (isdigit (iter[length]))
516 length++; 516 length++;
517 517
518 if (length == 0) { 518 if (length == 0) {
519 if (FP_strnicmp (iter, "one", 3) == 0) length = 1; 519 if (_FP_strnicmp (iter, "one", 3) == 0) length = 1;
520 else if (FP_strnicmp (iter, "two", 3) == 0) length = 2; 520 else if (_FP_strnicmp (iter, "two", 3) == 0) length = 2;
521 else if (FP_strnicmp (iter, "three", 5) == 0) length = 3; 521 else if (_FP_strnicmp (iter, "three", 5) == 0) length = 3;
522 else if (FP_strnicmp (iter, "four", 4) == 0) length = 4; 522 else if (_FP_strnicmp (iter, "four", 4) == 0) length = 4;
523 else if (FP_strnicmp (iter, "five", 4) == 0) length = 5; 523 else if (_FP_strnicmp (iter, "five", 4) == 0) length = 5;
524 else if (FP_strnicmp (iter, "six", 3) == 0) length = 6; 524 else if (_FP_strnicmp (iter, "six", 3) == 0) length = 6;
525 else if (FP_strnicmp (iter, "seven", 5) == 0) length = 7; 525 else if (_FP_strnicmp (iter, "seven", 5) == 0) length = 7;
526 else if (FP_strnicmp (iter, "eight", 5) == 0) length = 8; 526 else if (_FP_strnicmp (iter, "eight", 5) == 0) length = 8;
527 else if (FP_strnicmp (iter, "nine", 4) == 0) length = 9; 527 else if (_FP_strnicmp (iter, "nine", 4) == 0) length = 9;
528 else if (FP_strnicmp (iter, "ten", 3) == 0) length = 10; 528 else if (_FP_strnicmp (iter, "ten", 3) == 0) length = 10;
529 529
530 if (length && (*whend = strchr (iter, ' '))) { 530 if (length && (*whend = strchr (iter, ' '))) {
531 *where = iter; 531 *where = iter;
532 return length; 532 return length;
533 } 533 }
544 /* 544 /*
545 * look for [0-9]* "of" [0-9]* 545 * look for [0-9]* "of" [0-9]*
546 */ 546 */
547 547
548 if (length == 0) { 548 if (length == 0) {
549 if ((iter = FP_strirstr (subject, "of")) != NULL) { 549 if ((iter = _FP_strirstr (subject, "of")) != NULL) {
550 while (iter>subject && isspace (*(iter-1))) 550 while (iter>subject && isspace (*(iter-1)))
551 iter--; 551 iter--;
552 if (isdigit(*(iter-1))) { 552 if (isdigit(*(iter-1))) {
553 while (iter>subject && isdigit (*(iter-1))) 553 while (iter>subject && isdigit (*(iter-1)))
554 iter--; 554 iter--;
643 643
644 if (length == 0) { 644 if (length == 0) {
645 /* 645 /*
646 * some people use the strangest things, including spelling mistakes :-) 646 * some people use the strangest things, including spelling mistakes :-)
647 */ 647 */
648 if ((iter = FP_stristr (subject, "first")) != NULL) length = 1; 648 if ((iter = _FP_stristr (subject, "first")) != NULL) length = 1;
649 else if ((iter = FP_stristr (subject, "second")) != NULL) length = 2; 649 else if ((iter = _FP_stristr (subject, "second")) != NULL) length = 2;
650 else if ((iter = FP_stristr (subject, "third")) != NULL) length = 3; 650 else if ((iter = _FP_stristr (subject, "third")) != NULL) length = 3;
651 else if ((iter = FP_stristr (subject, "forth")) != NULL) length = 4; 651 else if ((iter = _FP_stristr (subject, "forth")) != NULL) length = 4;
652 else if ((iter = FP_stristr (subject, "fourth")) != NULL) length = 4; 652 else if ((iter = _FP_stristr (subject, "fourth")) != NULL) length = 4;
653 else if ((iter = FP_stristr (subject, "fifth")) != NULL) length = 5; 653 else if ((iter = _FP_stristr (subject, "fifth")) != NULL) length = 5;
654 else if ((iter = FP_stristr (subject, "sixth")) != NULL) length = 6; 654 else if ((iter = _FP_stristr (subject, "sixth")) != NULL) length = 6;
655 else if ((iter = FP_stristr (subject, "seventh")) != NULL) length = 7; 655 else if ((iter = _FP_stristr (subject, "seventh")) != NULL) length = 7;
656 else if ((iter = FP_stristr (subject, "eigth")) != NULL) length = 8; 656 else if ((iter = _FP_stristr (subject, "eigth")) != NULL) length = 8;
657 else if ((iter = FP_stristr (subject, "eighth")) != NULL) length = 8; 657 else if ((iter = _FP_stristr (subject, "eighth")) != NULL) length = 8;
658 else if ((iter = FP_stristr (subject, "nineth")) != NULL) length = 9; 658 else if ((iter = _FP_stristr (subject, "nineth")) != NULL) length = 9;
659 else if ((iter = FP_stristr (subject, "ninth")) != NULL) length = 9; 659 else if ((iter = _FP_stristr (subject, "ninth")) != NULL) length = 9;
660 else if ((iter = FP_stristr (subject, "tenth")) != NULL) length = 10; 660 else if ((iter = _FP_stristr (subject, "tenth")) != NULL) length = 10;
661 else iter = NULL; 661 else iter = NULL;
662 662
663 if (length && iter && (*whend = strchr (iter, ' '))) { 663 if (length && iter && (*whend = strchr (iter, ' '))) {
664 *where = iter; 664 *where = iter;
665 return length; 665 return length;
672 return -1; 672 return -1;
673 673
674 *where = iter; 674 *where = iter;
675 675
676 if (delim && delim[0]) { 676 if (delim && delim[0]) {
677 if ((*whend=FP_stristr (iter, delim)) != NULL && (*whend - *where) < 12) { 677 if ((*whend=_FP_stristr (iter, delim)) != NULL && (*whend - *where) < 12) {
678 ptr = (*whend += strlen (delim)); 678 ptr = (*whend += strlen (delim));
679 679
680 while (*ptr == ' ') 680 while (*ptr == ' ')
681 ptr++; 681 ptr++;
682 682
728 UUkillfile (result); 728 UUkillfile (result);
729 return NULL; 729 return NULL;
730 } 730 }
731 731
732 if (data->filename != NULL) { 732 if (data->filename != NULL) {
733 if ((result->filename = FP_strdup (data->filename)) == NULL) { 733 if ((result->filename = _FP_strdup (data->filename)) == NULL) {
734 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, 734 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR,
735 uustring (S_OUT_OF_MEMORY), 735 uustring (S_OUT_OF_MEMORY),
736 strlen (data->filename)+1); 736 strlen (data->filename)+1);
737 *ret = UURET_NOMEM; 737 *ret = UURET_NOMEM;
738 UUkillfile (result); 738 UUkillfile (result);
745 if (uu_dumbness <= 1) 745 if (uu_dumbness <= 1)
746 result->subfname = UUGetFileName (data->subject, where, whend); 746 result->subfname = UUGetFileName (data->subject, where, whend);
747 else 747 else
748 result->subfname = NULL; 748 result->subfname = NULL;
749 749
750 result->mimeid = FP_strdup (data->mimeid); 750 result->mimeid = _FP_strdup (data->mimeid);
751 result->mimetype = FP_strdup (data->mimetype); 751 result->mimetype = _FP_strdup (data->mimetype);
752 752
753 if (result->partno == -1 && 753 if (result->partno == -1 &&
754 (data->uudet == PT_ENCODED || data->uudet == QP_ENCODED)) 754 (data->uudet == PT_ENCODED || data->uudet == QP_ENCODED))
755 result->partno = 1; 755 result->partno = 1;
756 756
758 /* 758 /*
759 * Don't touch this part. But it should really have a filename 759 * Don't touch this part. But it should really have a filename
760 */ 760 */
761 if (result->filename == NULL) { 761 if (result->filename == NULL) {
762 sprintf (temp, "%s.%03d", nofname, ++nofnum); 762 sprintf (temp, "%s.%03d", nofname, ++nofnum);
763 result->filename = FP_strdup (temp); 763 result->filename = _FP_strdup (temp);
764 } 764 }
765 if (result->subfname == NULL) 765 if (result->subfname == NULL)
766 result->subfname = FP_strdup (result->filename); 766 result->subfname = _FP_strdup (result->filename);
767 767
768 if (result->filename == NULL || 768 if (result->filename == NULL ||
769 result->subfname == NULL) { 769 result->subfname == NULL) {
770 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, 770 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR,
771 uustring (S_OUT_OF_MEMORY), 771 uustring (S_OUT_OF_MEMORY),
788 */ 788 */
789 /* 789 /*
790 * in this case, it really _should_ have a filename somewhere 790 * in this case, it really _should_ have a filename somewhere
791 */ 791 */
792 if (result->filename != NULL) 792 if (result->filename != NULL)
793 result->subfname = FP_strdup (result->filename); 793 result->subfname = _FP_strdup (result->filename);
794 else { /* if not, escape to UNKNOWN. We need to fill subfname */ 794 else { /* if not, escape to UNKNOWN. We need to fill subfname */
795 sprintf (temp, "%s.%03d", nofname, ++nofnum); 795 sprintf (temp, "%s.%03d", nofname, ++nofnum);
796 result->subfname = FP_strdup (temp); 796 result->subfname = _FP_strdup (temp);
797 } 797 }
798 /* 798 /*
799 * in case the strdup failed 799 * in case the strdup failed
800 */ 800 */
801 if (result->subfname == NULL) { 801 if (result->subfname == NULL) {
816 * initialize lastvalid 816 * initialize lastvalid
817 */ 817 */
818 lastvalid = 1; 818 lastvalid = 1;
819 lastenc = data->uudet; 819 lastenc = data->uudet;
820 lastpart = result->partno = 1; 820 lastpart = result->partno = 1;
821 FP_strncpy (uucheck_lastname, result->subfname, 256); 821 _FP_strncpy (uucheck_lastname, result->subfname, 256);
822 } 822 }
823 else 823 else
824 result->partno = 1; 824 result->partno = 1;
825 } 825 }
826 else if (result->subfname == NULL && data->uudet && data->mimeid) { 826 else if (result->subfname == NULL && data->uudet && data->mimeid) {
828 * if it's got a file name, use it. Else use the mime-id for identifying 828 * if it's got a file name, use it. Else use the mime-id for identifying
829 * this part, and hope there's no other files encoded in the same message 829 * this part, and hope there's no other files encoded in the same message
830 * under the same id. 830 * under the same id.
831 */ 831 */
832 if (result->filename) 832 if (result->filename)
833 result->subfname = FP_strdup (result->filename); 833 result->subfname = _FP_strdup (result->filename);
834 else 834 else
835 result->subfname = FP_strdup (result->mimeid); 835 result->subfname = _FP_strdup (result->mimeid);
836 } 836 }
837 else if (result->subfname == NULL && data->uudet) { 837 else if (result->subfname == NULL && data->uudet) {
838 /* 838 /*
839 * ff we have lastvalid, use it. Make an exception for 839 * ff we have lastvalid, use it. Make an exception for
840 * Base64-encoded files. 840 * Base64-encoded files.
842 if (data->uudet == B64ENCODED) { 842 if (data->uudet == B64ENCODED) {
843 /* 843 /*
844 * Assume it's the first part. I wonder why it's got no part number? 844 * Assume it's the first part. I wonder why it's got no part number?
845 */ 845 */
846 if (result->filename != NULL) 846 if (result->filename != NULL)
847 result->subfname = FP_strdup (result->filename); 847 result->subfname = _FP_strdup (result->filename);
848 else { /* if not, escape to UNKNOWN. We need to fill subfname */ 848 else { /* if not, escape to UNKNOWN. We need to fill subfname */
849 sprintf (temp, "%s.%03d", nofname, ++nofnum); 849 sprintf (temp, "%s.%03d", nofname, ++nofnum);
850 result->subfname = FP_strdup (temp); 850 result->subfname = _FP_strdup (temp);
851 } 851 }
852 if (result->subfname == NULL) { 852 if (result->subfname == NULL) {
853 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR, 853 UUMessage (uucheck_id, __LINE__, UUMSG_ERROR,
854 uustring (S_OUT_OF_MEMORY), 854 uustring (S_OUT_OF_MEMORY),
855 (result->filename)? 855 (result->filename)?
859 return NULL; 859 return NULL;
860 } 860 }
861 lastvalid = 0; 861 lastvalid = 0;
862 } 862 }
863 else if (lastvalid && data->uudet == lastenc && result->partno == -1) { 863 else if (lastvalid && data->uudet == lastenc && result->partno == -1) {
864 result->subfname = FP_strdup (uucheck_lastname); 864 result->subfname = _FP_strdup (uucheck_lastname);
865 result->partno = ++lastpart; 865 result->partno = ++lastpart;
866 866
867 /* 867 /*
868 * if it's the last part, invalidate lastvalid 868 * if it's the last part, invalidate lastvalid
869 */ 869 */
870 if (data->end || (data->partno && data->partno == data->maxpno)) 870 if (data->end || (data->partno && data->partno == data->maxpno))
871 lastvalid = 0; 871 lastvalid = 0;
872 } 872 }
873 else if (data->partno != -1 && result->filename) { 873 else if (data->partno != -1 && result->filename) {
874 result->subfname = FP_strdup (result->filename); 874 result->subfname = _FP_strdup (result->filename);
875 } 875 }
876 else { 876 else {
877 /* 877 /*
878 * it's got no info, it's got no begin, and we don't know anything 878 * it's got no info, it's got no begin, and we don't know anything
879 * about this part. Let's forget all about it. 879 * about this part. Let's forget all about it.
912 /* 912 /*
913 * hmm, this is reason enough to initialize lastvalid, at least 913 * hmm, this is reason enough to initialize lastvalid, at least
914 * if we have no end 914 * if we have no end
915 */ 915 */
916 if (!data->end) { 916 if (!data->end) {
917 FP_strncpy (uucheck_lastname, result->subfname, 256); 917 _FP_strncpy (uucheck_lastname, result->subfname, 256);
918 result->partno = lastpart = 1; 918 result->partno = lastpart = 1;
919 lastenc = data->uudet; 919 lastenc = data->uudet;
920 lastvalid = 1; 920 lastvalid = 1;
921 } 921 }
922 else 922 else
923 result->partno = 1; 923 result->partno = 1;
924 } 924 }
925 else if (result->partno == -1 && data->uudet) { 925 else if (result->partno == -1 && data->uudet) {
926 if (lastvalid && FP_stricmp (uucheck_lastname, result->subfname) == 0) { 926 if (lastvalid && _FP_stricmp (uucheck_lastname, result->subfname) == 0) {
927 /* 927 /*
928 * if the subject filename is the same as last time, use part no 928 * if the subject filename is the same as last time, use part no
929 * of lastvalid. If at end, invalidate lastvalid 929 * of lastvalid. If at end, invalidate lastvalid
930 */ 930 */
931 result->partno = ++lastpart; 931 result->partno = ++lastpart;
961 } 961 }
962 962
963 skipcheck: 963 skipcheck:
964 964
965 if (result->filename) { 965 if (result->filename) {
966 if (*(ptr = FP_cutdir (result->filename))) { 966 if (*(ptr = _FP_cutdir (result->filename))) {
967 p2 = FP_strdup (ptr); 967 p2 = _FP_strdup (ptr);
968 FP_free (result->filename); 968 _FP_free (result->filename);
969 result->filename = p2; 969 result->filename = p2;
970 } 970 }
971 } 971 }
972 972
973 result->data = data; 973 result->data = data;
1006 1006
1007 while (iter) { 1007 while (iter) {
1008 if (data->data->flags & FL_SINGLE) { 1008 if (data->data->flags & FL_SINGLE) {
1009 /* this space intentionally left blank */ 1009 /* this space intentionally left blank */
1010 } 1010 }
1011 else if ((FP_stricmp (data->subfname, iter->subfname) == 0 || 1011 else if ((_FP_stricmp (data->subfname, iter->subfname) == 0 ||
1012 (data->mimeid && iter->mimeid && 1012 (data->mimeid && iter->mimeid &&
1013 strcmp (data->mimeid, iter->mimeid) == 0)) && 1013 strcmp (data->mimeid, iter->mimeid) == 0)) &&
1014 !(iter->begin && data->data->begin) && 1014 !(iter->begin && data->data->begin) &&
1015 !(iter->end && data->data->end) && 1015 !(iter->end && data->data->end) &&
1016 !(data->mimeid && iter->mimeid && 1016 !(data->mimeid && iter->mimeid &&
1031 (data->partno==fiter->partno || 1031 (data->partno==fiter->partno ||
1032 (data->partno > fiter->partno && fiter->data->end))) 1032 (data->partno > fiter->partno && fiter->data->end)))
1033 goto goahead; 1033 goto goahead;
1034 1034
1035 if (iter->filename == NULL && data->filename != NULL) { 1035 if (iter->filename == NULL && data->filename != NULL) {
1036 if ((iter->filename = FP_strdup (data->filename)) == NULL) 1036 if ((iter->filename = _FP_strdup (data->filename)) == NULL)
1037 return UURET_NOMEM; 1037 return UURET_NOMEM;
1038 } 1038 }
1039 1039
1040 /* 1040 /*
1041 * special case when we might have tagged a part as Base64 when the 1041 * special case when we might have tagged a part as Base64 when the
1076 iter->mode = data->data->mode; 1076 iter->mode = data->data->mode;
1077 if (data->data->begin) iter->begin = (data->partno)?data->partno:1; 1077 if (data->data->begin) iter->begin = (data->partno)?data->partno:1;
1078 if (data->data->end) iter->end = (data->partno)?data->partno:1; 1078 if (data->data->end) iter->end = (data->partno)?data->partno:1;
1079 1079
1080 if (data->mimetype) { 1080 if (data->mimetype) {
1081 FP_free (iter->mimetype); 1081 _FP_free (iter->mimetype);
1082 iter->mimetype = FP_strdup (data->mimetype); 1082 iter->mimetype = _FP_strdup (data->mimetype);
1083 } 1083 }
1084 1084
1085 /* 1085 /*
1086 * insert part at the beginning 1086 * insert part at the beginning
1087 */ 1087 */
1106 * if we find the same part no again, check which one looks better 1106 * if we find the same part no again, check which one looks better
1107 */ 1107 */
1108 if (data->partno == fiter->partno) { 1108 if (data->partno == fiter->partno) {
1109 if (fiter->data->subject == NULL) 1109 if (fiter->data->subject == NULL)
1110 return UURET_NODATA; 1110 return UURET_NODATA;
1111 else if (FP_stristr (fiter->data->subject, "repost") != NULL && 1111 else if (_FP_stristr (fiter->data->subject, "repost") != NULL &&
1112 FP_stristr (data->data->subject, "repost") == NULL) 1112 _FP_stristr (data->data->subject, "repost") == NULL)
1113 return UURET_NODATA; 1113 return UURET_NODATA;
1114 else if (fiter->data->uudet && !data->data->uudet) 1114 else if (fiter->data->uudet && !data->data->uudet)
1115 return UURET_NODATA; 1115 return UURET_NODATA;
1116 else { 1116 else {
1117 /* 1117 /*
1178 1178
1179 if ((unew = (uulist *) malloc (sizeof (uulist))) == NULL) { 1179 if ((unew = (uulist *) malloc (sizeof (uulist))) == NULL) {
1180 return UURET_NOMEM; 1180 return UURET_NOMEM;
1181 } 1181 }
1182 1182
1183 if ((unew->subfname = FP_strdup (data->subfname)) == NULL) { 1183 if ((unew->subfname = _FP_strdup (data->subfname)) == NULL) {
1184 FP_free (unew); 1184 _FP_free (unew);
1185 return UURET_NOMEM; 1185 return UURET_NOMEM;
1186 } 1186 }
1187 1187
1188 if (data->filename != NULL) { 1188 if (data->filename != NULL) {
1189 if ((unew->filename = FP_strdup (data->filename)) == NULL) { 1189 if ((unew->filename = _FP_strdup (data->filename)) == NULL) {
1190 FP_free (unew->subfname); 1190 _FP_free (unew->subfname);
1191 FP_free (unew); 1191 _FP_free (unew);
1192 return UURET_NOMEM; 1192 return UURET_NOMEM;
1193 } 1193 }
1194 } 1194 }
1195 else 1195 else
1196 unew->filename = NULL; 1196 unew->filename = NULL;
1197 1197
1198 if (data->mimeid != NULL) { 1198 if (data->mimeid != NULL) {
1199 if ((unew->mimeid = FP_strdup (data->mimeid)) == NULL) { 1199 if ((unew->mimeid = _FP_strdup (data->mimeid)) == NULL) {
1200 FP_free (unew->subfname); 1200 _FP_free (unew->subfname);
1201 FP_free (unew->filename); 1201 _FP_free (unew->filename);
1202 FP_free (unew); 1202 _FP_free (unew);
1203 return UURET_NOMEM; 1203 return UURET_NOMEM;
1204 } 1204 }
1205 } 1205 }
1206 else 1206 else
1207 unew->mimeid = NULL; 1207 unew->mimeid = NULL;
1208 1208
1209 if (data->mimetype != NULL) { 1209 if (data->mimetype != NULL) {
1210 if ((unew->mimetype = FP_strdup (data->mimetype)) == NULL) { 1210 if ((unew->mimetype = _FP_strdup (data->mimetype)) == NULL) {
1211 FP_free (unew->mimeid); 1211 _FP_free (unew->mimeid);
1212 FP_free (unew->subfname); 1212 _FP_free (unew->subfname);
1213 FP_free (unew->filename); 1213 _FP_free (unew->filename);
1214 FP_free (unew); 1214 _FP_free (unew);
1215 return UURET_NOMEM; 1215 return UURET_NOMEM;
1216 } 1216 }
1217 } 1217 }
1218 else 1218 else
1219 unew->mimetype = NULL; 1219 unew->mimetype = NULL;
1403 1403
1404 /* 1404 /*
1405 * Set the parts we have and/or missing 1405 * Set the parts we have and/or missing
1406 */ 1406 */
1407 1407
1408 FP_free (liter->haveparts); 1408 _FP_free (liter->haveparts);
1409 FP_free (liter->misparts); 1409 _FP_free (liter->misparts);
1410 1410
1411 liter->haveparts = NULL; 1411 liter->haveparts = NULL;
1412 liter->misparts = NULL; 1412 liter->misparts = NULL;
1413 1413
1414 if (havecount) { 1414 if (havecount) {
1446 if (liter->state==UUFILE_OK && 1446 if (liter->state==UUFILE_OK &&
1447 (liter->filename==NULL || liter->filename[0]=='\0')) { 1447 (liter->filename==NULL || liter->filename[0]=='\0')) {
1448 /* 1448 /*
1449 * Emergency backup if the file does not have a filename 1449 * Emergency backup if the file does not have a filename
1450 */ 1450 */
1451 FP_free (liter->filename); 1451 _FP_free (liter->filename);
1452 if (liter->subfname && liter->subfname[0] && 1452 if (liter->subfname && liter->subfname[0] &&
1453 FP_strpbrk (liter->subfname, "()[];: ") == NULL) 1453 _FP_strpbrk (liter->subfname, "()[];: ") == NULL)
1454 liter->filename = FP_strdup (liter->subfname); 1454 liter->filename = _FP_strdup (liter->subfname);
1455 else { 1455 else {
1456 sprintf (uucheck_tempname, "%s.%03d", nofname, ++nofnum); 1456 sprintf (uucheck_tempname, "%s.%03d", nofname, ++nofnum);
1457 liter->filename = FP_strdup (uucheck_tempname); 1457 liter->filename = _FP_strdup (uucheck_tempname);
1458 } 1458 }
1459 } 1459 }
1460 liter = liter->NEXT; 1460 liter = liter->NEXT;
1461 } 1461 }
1462 1462

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines