… | |
… | |
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.3.2.3 2002/10/13 13:03:07 root Exp $"; |
56 | char * uucheck_id = "$Id: uucheck.c,v 1.3.2.4 2003/11/06 13:08:23 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 | */ |
… | |
… | |
773 | * no subject or anything, initialize lastvalid |
773 | * no subject or anything, initialize lastvalid |
774 | */ |
774 | */ |
775 | /* |
775 | /* |
776 | * in this case, it really _should_ have a filename somewhere |
776 | * in this case, it really _should_ have a filename somewhere |
777 | */ |
777 | */ |
778 | if (result->filename != NULL) |
778 | if (result->filename != NULL && *result->filename) |
779 | result->subfname = _FP_strdup (result->filename); |
779 | result->subfname = _FP_strdup (result->filename); |
780 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
780 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
781 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
781 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
782 | result->subfname = _FP_strdup (temp); |
782 | result->subfname = _FP_strdup (temp); |
783 | } |
783 | } |
… | |
… | |
827 | */ |
827 | */ |
828 | if (data->uudet == B64ENCODED) { |
828 | if (data->uudet == B64ENCODED) { |
829 | /* |
829 | /* |
830 | * Assume it's the first part. I wonder why it's got no part number? |
830 | * Assume it's the first part. I wonder why it's got no part number? |
831 | */ |
831 | */ |
832 | if (result->filename != NULL) |
832 | if (result->filename != NULL && *result->filename) |
833 | result->subfname = _FP_strdup (result->filename); |
833 | result->subfname = _FP_strdup (result->filename); |
834 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
834 | else { /* if not, escape to UNKNOWN. We need to fill subfname */ |
835 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
835 | sprintf (temp, "%s.%03d", nofname, ++nofnum); |
836 | result->subfname = _FP_strdup (temp); |
836 | result->subfname = _FP_strdup (temp); |
837 | } |
837 | } |
… | |
… | |
974 | uulist *iter = UUGlobalFileList, *unew; |
974 | uulist *iter = UUGlobalFileList, *unew; |
975 | uufile *fiter, *last; |
975 | uufile *fiter, *last; |
976 | |
976 | |
977 | /* |
977 | /* |
978 | * Part belongs together, if |
978 | * Part belongs together, if |
|
|
979 | * (1) The MIME-IDs match, or |
979 | * (a) The file name received from the subject lines match _or_ |
980 | * (2) The file name received from the subject lines match, and |
980 | * the MIME-IDs match, |
|
|
981 | * (b) Not both parts have a begin line |
981 | * (a) Not both parts have a begin line |
982 | * (c) Not both parts have an end line |
982 | * (b) Not both parts have an end line |
983 | * (d) Both parts don't have different MIME-IDs |
983 | * (c) Both parts don't have different MIME-IDs |
984 | * (e) Both parts don't encode different files |
984 | * (d) Both parts don't encode different files |
985 | * (f) The other part wants to stay alone (FL_SINGLE) |
985 | * (e) The other part wants to stay alone (FL_SINGLE) |
986 | */ |
986 | */ |
987 | |
987 | |
988 | /* |
988 | /* |
989 | * check if this part wants to be left alone. If so, don't bother |
989 | * check if this part wants to be left alone. If so, don't bother |
990 | * to do all the checks |
990 | * to do all the checks |
… | |
… | |
992 | |
992 | |
993 | while (iter) { |
993 | while (iter) { |
994 | if (data->data->flags & FL_SINGLE) { |
994 | if (data->data->flags & FL_SINGLE) { |
995 | /* this space intentionally left blank */ |
995 | /* this space intentionally left blank */ |
996 | } |
996 | } |
997 | else if ((_FP_stricmp (data->subfname, iter->subfname) == 0 || |
|
|
998 | (data->mimeid && iter->mimeid && |
997 | else if ((data->mimeid && iter->mimeid && |
999 | strcmp (data->mimeid, iter->mimeid) == 0)) && |
998 | strcmp (data->mimeid, iter->mimeid) == 0) || |
|
|
999 | (_FP_stricmp (data->subfname, iter->subfname) == 0 && |
1000 | !(iter->begin && data->data->begin) && |
1000 | !(iter->begin && data->data->begin) && |
1001 | !(iter->end && data->data->end) && |
1001 | !(iter->end && data->data->end) && |
1002 | !(data->mimeid && iter->mimeid && |
1002 | !(data->mimeid && iter->mimeid && |
1003 | strcmp (data->mimeid, iter->mimeid) != 0) && |
1003 | strcmp (data->mimeid, iter->mimeid) != 0) && |
1004 | !(data->filename && iter->filename && |
1004 | !(data->filename && iter->filename && |
1005 | strcmp (data->filename, iter->filename) != 0) && |
1005 | strcmp (data->filename, iter->filename) != 0) && |
1006 | !(iter->flags & FL_SINGLE)) { |
1006 | !(iter->flags & FL_SINGLE))) { |
1007 | |
1007 | |
1008 | /* |
1008 | /* |
1009 | * if we already have this part, don't try to insert it |
1009 | * Don't insert a part that is already there. |
|
|
1010 | * |
|
|
1011 | * Also don't add a part beyond the "end" marker (unless we |
|
|
1012 | * have a mimeid, which screws up the marker). |
1010 | */ |
1013 | */ |
1011 | |
1014 | |
1012 | for (fiter=iter->thisfile; |
1015 | for (fiter=iter->thisfile; fiter; fiter=fiter->NEXT) { |
1013 | fiter && (data->partno>fiter->partno) && !fiter->data->end; |
|
|
1014 | fiter=fiter->NEXT) |
|
|
1015 | /* empty loop */ ; |
|
|
1016 | if (fiter && |
|
|
1017 | (data->partno==fiter->partno || |
1016 | if (data->partno == fiter->partno) |
|
|
1017 | goto goahead; |
|
|
1018 | if (!iter->mimeid) { |
1018 | (data->partno > fiter->partno && fiter->data->end))) |
1019 | if (data->partno > fiter->partno && fiter->data->end) { |
1019 | goto goahead; |
1020 | goto goahead; |
|
|
1021 | } |
|
|
1022 | } |
|
|
1023 | } |
1020 | |
1024 | |
1021 | if (iter->filename == NULL && data->filename != NULL) { |
1025 | if (iter->filename == NULL && data->filename != NULL) { |
1022 | if ((iter->filename = _FP_strdup (data->filename)) == NULL) |
1026 | if ((iter->filename = _FP_strdup (data->filename)) == NULL) |
1023 | return UURET_NOMEM; |
1027 | return UURET_NOMEM; |
1024 | } |
1028 | } |