… | |
… | |
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.7 2003/07/28 15:47:54 root Exp $"; |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.8 2003/11/06 13:33:41 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 | */ |
… | |
… | |
794 | * no subject or anything, initialize lastvalid |
794 | * no subject or anything, initialize lastvalid |
795 | */ |
795 | */ |
796 | /* |
796 | /* |
797 | * in this case, it really _should_ have a filename somewhere |
797 | * in this case, it really _should_ have a filename somewhere |
798 | */ |
798 | */ |
799 | if (result->filename != NULL) |
799 | if (result->filename != NULL && *result->filename) |
800 | result->subfname = _FP_strdup (result->filename); |
800 | result->subfname = _FP_strdup (result->filename); |
801 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
801 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
802 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
802 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
803 | result->subfname = _FP_strdup (temp); |
803 | result->subfname = _FP_strdup (temp); |
804 | } |
804 | } |
… | |
… | |
848 | */ |
848 | */ |
849 | if (data->uudet == B64ENCODED) { |
849 | if (data->uudet == B64ENCODED) { |
850 | /* |
850 | /* |
851 | * Assume it's the first part. I wonder why it's got no part number? |
851 | * Assume it's the first part. I wonder why it's got no part number? |
852 | */ |
852 | */ |
853 | if (result->filename != NULL) |
853 | if (result->filename != NULL && *result->filename) |
854 | result->subfname = _FP_strdup (result->filename); |
854 | result->subfname = _FP_strdup (result->filename); |
855 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
855 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
856 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
856 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
857 | result->subfname = _FP_strdup (temp); |
857 | result->subfname = _FP_strdup (temp); |
858 | } |
858 | } |
… | |
… | |
995 | uulist *iter = UUGlobalFileList, *unew; |
995 | uulist *iter = UUGlobalFileList, *unew; |
996 | uufile *fiter, *last; |
996 | uufile *fiter, *last; |
997 | |
997 | |
998 | /* |
998 | /* |
999 | * Part belongs together, if |
999 | * Part belongs together, if |
|
|
1000 | * (1) The MIME-IDs match, or |
1000 | * (a) The file name received from the subject lines match _or_ |
1001 | * (2) The file name received from the subject lines match, and |
1001 | * the MIME-IDs match, |
|
|
1002 | * (b) Not both parts have a begin line |
1002 | * (a) Not both parts have a begin line |
1003 | * (c) Not both parts have an end line |
1003 | * (b) Not both parts have an end line |
1004 | * (d) Both parts don't have different MIME-IDs |
1004 | * (c) Both parts don't have different MIME-IDs |
1005 | * (e) Both parts don't encode different files |
1005 | * (d) Both parts don't encode different files |
1006 | * (f) The other part wants to stay alone (FL_SINGLE) |
1006 | * (e) The other part wants to stay alone (FL_SINGLE) |
1007 | */ |
1007 | */ |
1008 | |
1008 | |
1009 | /* |
1009 | /* |
1010 | * check if this part wants to be left alone. If so, don't bother |
1010 | * check if this part wants to be left alone. If so, don't bother |
1011 | * to do all the checks |
1011 | * to do all the checks |
… | |
… | |
1013 | |
1013 | |
1014 | while (iter) { |
1014 | while (iter) { |
1015 | if (data->data->flags & FL_SINGLE) { |
1015 | if (data->data->flags & FL_SINGLE) { |
1016 | /* this space intentionally left blank */ |
1016 | /* this space intentionally left blank */ |
1017 | } |
1017 | } |
1018 | else if ((_FP_stricmp (data->subfname, iter->subfname) == 0 || |
|
|
1019 | (data->mimeid && iter->mimeid && |
1018 | else if ((data->mimeid && iter->mimeid && |
1020 | strcmp (data->mimeid, iter->mimeid) == 0)) && |
1019 | strcmp (data->mimeid, iter->mimeid) == 0) || |
|
|
1020 | (_FP_stricmp (data->subfname, iter->subfname) == 0 && |
1021 | !(iter->begin && data->data->begin) && |
1021 | !(iter->begin && data->data->begin) && |
1022 | !(iter->end && data->data->end) && |
1022 | !(iter->end && data->data->end) && |
1023 | !(data->mimeid && iter->mimeid && |
1023 | !(data->mimeid && iter->mimeid && |
1024 | strcmp (data->mimeid, iter->mimeid) != 0) && |
1024 | strcmp (data->mimeid, iter->mimeid) != 0) && |
1025 | !(data->filename && iter->filename && |
1025 | !(data->filename && iter->filename && |
1026 | strcmp (data->filename, iter->filename) != 0) && |
1026 | strcmp (data->filename, iter->filename) != 0) && |
1027 | !(iter->flags & FL_SINGLE)) { |
1027 | !(iter->flags & FL_SINGLE))) { |
1028 | |
1028 | |
1029 | /* |
1029 | /* |
1030 | * if we already have this part, don't try to insert it |
1030 | * Don't insert a part that is already there. |
|
|
1031 | * |
|
|
1032 | * Also don't add a part beyond the "end" marker (unless we |
|
|
1033 | * have a mimeid, which screws up the marker). |
1031 | */ |
1034 | */ |
1032 | |
1035 | |
1033 | for (fiter=iter->thisfile; |
1036 | for (fiter=iter->thisfile; fiter; fiter=fiter->NEXT) { |
1034 | fiter && (data->partno>fiter->partno) && !fiter->data->end; |
|
|
1035 | fiter=fiter->NEXT) |
|
|
1036 | /* empty loop */ ; |
|
|
1037 | if (fiter && |
|
|
1038 | (data->partno==fiter->partno || |
1037 | if (data->partno == fiter->partno) |
|
|
1038 | goto goahead; |
|
|
1039 | if (!iter->mimeid) { |
1039 | (data->partno > fiter->partno && fiter->data->end))) |
1040 | if (data->partno > fiter->partno && fiter->data->end) { |
1040 | goto goahead; |
1041 | goto goahead; |
|
|
1042 | } |
|
|
1043 | } |
|
|
1044 | } |
1041 | |
1045 | |
1042 | if (iter->filename == NULL && data->filename != NULL) { |
1046 | if (iter->filename == NULL && data->filename != NULL) { |
1043 | if ((iter->filename = _FP_strdup (data->filename)) == NULL) |
1047 | if ((iter->filename = _FP_strdup (data->filename)) == NULL) |
1044 | return UURET_NOMEM; |
1048 | return UURET_NOMEM; |
1045 | } |
1049 | } |