… | |
… | |
47 | #endif |
47 | #endif |
48 | #ifdef HAVE_ERRNO_H |
48 | #ifdef HAVE_ERRNO_H |
49 | #include <errno.h> |
49 | #include <errno.h> |
50 | #endif |
50 | #endif |
51 | |
51 | |
|
|
52 | #include <crc32.h> |
52 | #include <uudeview.h> |
53 | #include <uudeview.h> |
53 | #include <uuint.h> |
54 | #include <uuint.h> |
54 | #include <fptools.h> |
55 | #include <fptools.h> |
55 | #include <uustring.h> |
56 | #include <uustring.h> |
56 | |
57 | |
57 | char * uunconc_id = "$Id: uunconc.c,v 1.3 2002/02/10 22:47:18 root Exp $"; |
58 | char * uunconc_id = "$Id: uunconc.c,v 1.3.2.5 2004/04/18 19:55:46 root Exp $"; |
58 | |
59 | |
59 | /* for braindead systems */ |
60 | /* for braindead systems */ |
60 | #ifndef SEEK_SET |
61 | #ifndef SEEK_SET |
61 | #ifdef L_BEGIN |
62 | #ifdef L_BEGIN |
62 | #define SEEK_SET L_BEGIN |
63 | #define SEEK_SET L_BEGIN |
… | |
… | |
116 | |
117 | |
117 | /* |
118 | /* |
118 | * To prevent warnings when using a char as index into an array |
119 | * To prevent warnings when using a char as index into an array |
119 | */ |
120 | */ |
120 | |
121 | |
121 | #define ACAST(s) ((int)(uchar)(s)) |
122 | #define ACAST(s) ((int)(unsigned char)(s)) |
122 | |
123 | |
123 | /* |
124 | /* |
124 | * Initialize decoding tables |
125 | * Initialize decoding tables |
125 | */ |
126 | */ |
126 | |
127 | |
… | |
… | |
193 | int len; |
194 | int len; |
194 | |
195 | |
195 | if (string==NULL || (len=strlen(string))<3) |
196 | if (string==NULL || (len=strlen(string))<3) |
196 | return 0; |
197 | return 0; |
197 | |
198 | |
198 | if ((ptr = FP_stristr (string, "<a href=")) != NULL) { |
199 | if ((ptr = _FP_stristr (string, "<a href=")) != NULL) { |
199 | if (FP_stristr (string, "</a>") > ptr) |
200 | if (_FP_stristr (string, "</a>") > ptr) |
200 | return 2; |
201 | return 2; |
201 | } |
202 | } |
202 | |
203 | |
203 | ptr = string + len; |
204 | ptr = string + len; |
204 | |
205 | |
… | |
… | |
207 | } |
208 | } |
208 | if (len<3) return 0; |
209 | if (len<3) return 0; |
209 | if (*--ptr == ' ') ptr--; |
210 | if (*--ptr == ' ') ptr--; |
210 | ptr--; |
211 | ptr--; |
211 | |
212 | |
212 | if (FP_strnicmp (ptr, "<a", 2) == 0) |
213 | if (_FP_strnicmp (ptr, "<a", 2) == 0) |
213 | return 1; |
214 | return 1; |
214 | |
215 | |
215 | return 0; |
216 | return 0; |
216 | } |
217 | } |
217 | |
218 | |
… | |
… | |
241 | /* |
242 | /* |
242 | * First pass |
243 | * First pass |
243 | */ |
244 | */ |
244 | while (*p1) { |
245 | while (*p1) { |
245 | if (*p1 == '&') { |
246 | if (*p1 == '&') { |
246 | if (FP_strnicmp (p1, "&", 5) == 0) { p1+=5; *p2++='&'; res=1; } |
247 | if (_FP_strnicmp (p1, "&", 5) == 0) { p1+=5; *p2++='&'; res=1; } |
247 | else if (FP_strnicmp (p1, "<", 4) == 0) { p1+=4; *p2++='<'; res=1; } |
248 | else if (_FP_strnicmp (p1, "<", 4) == 0) { p1+=4; *p2++='<'; res=1; } |
248 | else if (FP_strnicmp (p1, ">", 4) == 0) { p1+=4; *p2++='>'; res=1; } |
249 | else if (_FP_strnicmp (p1, ">", 4) == 0) { p1+=4; *p2++='>'; res=1; } |
249 | else *p2++ = *p1++; |
250 | else *p2++ = *p1++; |
250 | res = 1; |
|
|
251 | } |
251 | } |
252 | else *p2++ = *p1++; |
252 | else *p2++ = *p1++; |
253 | } |
253 | } |
254 | *p2 = '\0'; |
254 | *p2 = '\0'; |
255 | /* |
255 | /* |
… | |
… | |
257 | */ |
257 | */ |
258 | p1 = p2 = string; |
258 | p1 = p2 = string; |
259 | |
259 | |
260 | while (*p1) { |
260 | while (*p1) { |
261 | if (*p1 == '<') { |
261 | if (*p1 == '<') { |
262 | if ((FP_strnicmp (p1, "<ahref=", 7) == 0 || |
262 | if ((_FP_strnicmp (p1, "<ahref=", 7) == 0 || |
263 | FP_strnicmp (p1, "<a href=",8) == 0) && |
263 | _FP_strnicmp (p1, "<a href=",8) == 0) && |
264 | (FP_strstr (p1, "</a>") != 0 || FP_strstr (p1, "</A>") != 0)) { |
264 | (_FP_strstr (p1, "</a>") != 0 || _FP_strstr (p1, "</A>") != 0)) { |
265 | while (*p1 && *p1!='>') p1++; |
265 | while (*p1 && *p1!='>') p1++; |
266 | if (*p1=='\0' || *(p1+1)!='<') return 0; |
266 | if (*p1=='\0' || *(p1+1)!='<') return 0; |
267 | p1++; |
267 | p1++; |
268 | while (*p1 && (*p1!='<' || FP_strnicmp(p1,"</a>",4)!=0)) { |
268 | while (*p1 && (*p1!='<' || _FP_strnicmp(p1,"</a>",4)!=0)) { |
269 | *p2++ = *p1++; |
269 | *p2++ = *p1++; |
270 | } |
270 | } |
271 | if (FP_strnicmp(p1,"</a>",4) != 0) |
271 | if (_FP_strnicmp(p1,"</a>",4) != 0) |
272 | return 0; |
272 | return 0; |
273 | p1+=4; |
273 | p1+=4; |
274 | res=1; |
274 | res=1; |
275 | } |
275 | } |
276 | else |
276 | else |
… | |
… | |
296 | UUValidData (char *ptr, int encoding, int *bhflag) |
296 | UUValidData (char *ptr, int encoding, int *bhflag) |
297 | { |
297 | { |
298 | int i=0, j, len=0, suspicious=0, flag=0; |
298 | int i=0, j, len=0, suspicious=0, flag=0; |
299 | char *s = ptr; |
299 | char *s = ptr; |
300 | |
300 | |
301 | if ((s == NULL) || ((schar)*s < '\0')) { |
301 | if ((s == NULL) || (*s == '\0')) { |
302 | return(0); /* bad string */ |
302 | return 0; /* bad string */ |
303 | } |
|
|
304 | |
303 | } |
|
|
304 | |
305 | while (*s && *s!='\012' && *s!='\015') { |
305 | while (*s && *s!='\012' && *s!='\015') { |
306 | s++; |
306 | s++; |
307 | len++; |
307 | len++; |
308 | i++; |
308 | i++; |
309 | } |
309 | } |
… | |
… | |
318 | goto _t_XX; |
318 | goto _t_XX; |
319 | case B64ENCODED: |
319 | case B64ENCODED: |
320 | goto _t_B64; |
320 | goto _t_B64; |
321 | case BH_ENCODED: |
321 | case BH_ENCODED: |
322 | goto _t_Binhex; |
322 | goto _t_Binhex; |
|
|
323 | case YENC_ENCODED: |
|
|
324 | return YENC_ENCODED; |
323 | } |
325 | } |
324 | |
326 | |
325 | _t_Binhex: /* Binhex Test */ |
327 | _t_Binhex: /* Binhex Test */ |
326 | len = i; s = ptr; |
328 | len = i; s = ptr; |
327 | |
329 | |
… | |
… | |
467 | */ |
469 | */ |
468 | if (encoding != UU_ENCODED) |
470 | if (encoding != UU_ENCODED) |
469 | if (strchr (ptr, ' ') != NULL) |
471 | if (strchr (ptr, ' ') != NULL) |
470 | goto _t_XX; |
472 | goto _t_XX; |
471 | |
473 | |
472 | /* suspicious = 1; we're careful here REMOVED 0.4.15 _FP__ */ |
474 | /* suspicious = 1; we're careful here REMOVED 0.4.15 __FP__ */ |
473 | len = j; |
475 | len = j; |
474 | } |
476 | } |
475 | |
477 | |
476 | while (len--) { |
478 | while (len--) { |
477 | if (*s < 0 || UUxlat[ACAST(*s++)] < 0) { |
479 | if (*s < 0 || UUxlat[ACAST(*s++)] < 0) { |
… | |
… | |
537 | |
539 | |
538 | nflag = UUBrokenByNetscape (line); |
540 | nflag = UUBrokenByNetscape (line); |
539 | |
541 | |
540 | while (vflag == 0 && nflag && safety--) { |
542 | while (vflag == 0 && nflag && safety--) { |
541 | if (nflag == 1) { /* need next line to repair */ |
543 | if (nflag == 1) { /* need next line to repair */ |
|
|
544 | if (strlen (line) > 250) |
|
|
545 | break; |
542 | ptr = line + strlen (line); |
546 | ptr = line + strlen (line); |
543 | while (ptr>line && (*(ptr-1)=='\015' || *(ptr-1)=='\012')) |
547 | while (ptr>line && (*(ptr-1)=='\015' || *(ptr-1)=='\012')) |
544 | ptr--; |
548 | ptr--; |
545 | if (FP_fgets (ptr, 255-(ptr-line), datei) == NULL) |
549 | if (_FP_fgets (ptr, 255-(ptr-line), datei) == NULL) |
546 | break; |
550 | break; |
547 | } |
551 | } |
548 | else { /* don't need next line to repair */ |
552 | else { /* don't need next line to repair */ |
549 | } |
553 | } |
550 | if (UUNetscapeCollapse (line)) { |
554 | if (UUNetscapeCollapse (line)) { |
… | |
… | |
616 | if (method == UU_ENCODED) |
620 | if (method == UU_ENCODED) |
617 | table = UUxlat; |
621 | table = UUxlat; |
618 | else |
622 | else |
619 | table = XXxlat; |
623 | table = XXxlat; |
620 | |
624 | |
621 | i = table [(uchar)*s++]; |
625 | i = table [ACAST(*s++)]; |
622 | j = UUxlen[i] - 1; |
626 | j = UUxlen[i] - 1; |
623 | |
627 | |
624 | while(j > 0) { |
628 | while(j > 0) { |
625 | c = table[(uchar)*s++] << 2; |
629 | c = table[ACAST(*s++)] << 2; |
626 | cc = table[(uchar)*s++]; |
630 | cc = table[ACAST(*s++)]; |
627 | c |= (cc >> 4); |
631 | c |= (cc >> 4); |
628 | |
632 | |
629 | if(i-- > 0) |
633 | if(i-- > 0) |
630 | d[count++] = c; |
634 | d[count++] = c; |
631 | |
635 | |
632 | cc <<= 4; |
636 | cc <<= 4; |
633 | c = table[(uchar)*s++]; |
637 | c = table[ACAST(*s++)]; |
634 | cc |= (c >> 2); |
638 | cc |= (c >> 2); |
635 | |
639 | |
636 | if(i-- > 0) |
640 | if(i-- > 0) |
637 | d[count++] = cc; |
641 | d[count++] = cc; |
638 | |
642 | |
639 | c <<= 6; |
643 | c <<= 6; |
640 | c |= table[(uchar)*s++]; |
644 | c |= table[ACAST(*s++)]; |
641 | |
645 | |
642 | if(i-- > 0) |
646 | if(i-- > 0) |
643 | d[count++] = c; |
647 | d[count++] = c; |
644 | |
648 | |
645 | j -= 4; |
649 | j -= 4; |
… | |
… | |
704 | d[count++] = (z2 << 4) | (z3 >> 2); |
708 | d[count++] = (z2 << 4) | (z3 >> 2); |
705 | s+=3; |
709 | s+=3; |
706 | } |
710 | } |
707 | while (BHxlat[ACAST(*s)] != -1) |
711 | while (BHxlat[ACAST(*s)] != -1) |
708 | uuncdl_fulline[leftover++] = *s++; |
712 | uuncdl_fulline[leftover++] = *s++; |
|
|
713 | } |
|
|
714 | else if (method == YENC_ENCODED) { |
|
|
715 | while (*s) { |
|
|
716 | if (*s == '=') { |
|
|
717 | if (*++s != '\0') { |
|
|
718 | d[count++] = (char) ((int) *s - 64 - 42); |
|
|
719 | s++; |
|
|
720 | } |
|
|
721 | } |
|
|
722 | else if (*s == '\n' || *s == '\r') { |
|
|
723 | s++; /* ignore */ |
|
|
724 | } |
|
|
725 | else { |
|
|
726 | d[count++] = (char) ((int) *s++ - 42); |
|
|
727 | } |
|
|
728 | } |
709 | } |
729 | } |
710 | |
730 | |
711 | return count; |
731 | return count; |
712 | } |
732 | } |
713 | |
733 | |
… | |
… | |
726 | uulboundary = -1; |
746 | uulboundary = -1; |
727 | |
747 | |
728 | while (!feof (datain) && |
748 | while (!feof (datain) && |
729 | (ftell(datain)<maxpos || flags&FL_TOEND || |
749 | (ftell(datain)<maxpos || flags&FL_TOEND || |
730 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
750 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
731 | if (FP_fgets (line, 255, datain) == NULL) |
751 | if (_FP_fgets (line, 255, datain) == NULL) |
732 | break; |
752 | break; |
733 | if (ferror (datain)) { |
753 | if (ferror (datain)) { |
734 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
754 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
735 | uustring (S_SOURCE_READ_ERR), |
755 | uustring (S_SOURCE_READ_ERR), |
736 | strerror (uu_errno = errno)); |
756 | strerror (uu_errno = errno)); |
… | |
… | |
823 | uulboundary = -1; |
843 | uulboundary = -1; |
824 | |
844 | |
825 | while (!feof (datain) && |
845 | while (!feof (datain) && |
826 | (ftell(datain)<maxpos || flags&FL_TOEND || |
846 | (ftell(datain)<maxpos || flags&FL_TOEND || |
827 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
847 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
828 | if (FP_fgets (line, 255, datain) == NULL) |
848 | if (_FP_fgets (line, 255, datain) == NULL) |
829 | break; |
849 | break; |
830 | if (ferror (datain)) { |
850 | if (ferror (datain)) { |
831 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
851 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
832 | uustring (S_SOURCE_READ_ERR), |
852 | uustring (S_SOURCE_READ_ERR), |
833 | strerror (uu_errno = errno)); |
853 | strerror (uu_errno = errno)); |
… | |
… | |
874 | } |
894 | } |
875 | } |
895 | } |
876 | return UURET_OK; |
896 | return UURET_OK; |
877 | } |
897 | } |
878 | |
898 | |
|
|
899 | /* |
|
|
900 | * Decode a single field using method. For the moment, this supports |
|
|
901 | * Base64 and Quoted Printable only, to support RFC 1522 header decoding. |
|
|
902 | * Quit when seeing the RFC 1522 ?= end marker. |
|
|
903 | */ |
|
|
904 | |
|
|
905 | int |
|
|
906 | UUDecodeField (char *s, char *d, int method) |
|
|
907 | { |
|
|
908 | int z1, z2, z3, z4; |
|
|
909 | int count=0; |
|
|
910 | |
|
|
911 | if (method == B64ENCODED) { |
|
|
912 | while ((z1 = B64xlat[ACAST(*s)]) != -1) { |
|
|
913 | if ((z2 = B64xlat[ACAST(*(s+1))]) == -1) break; |
|
|
914 | if ((z3 = B64xlat[ACAST(*(s+2))]) == -1) break; |
|
|
915 | if ((z4 = B64xlat[ACAST(*(s+3))]) == -1) break; |
|
|
916 | |
|
|
917 | d[count++] = (z1 << 2) | (z2 >> 4); |
|
|
918 | d[count++] = (z2 << 4) | (z3 >> 2); |
|
|
919 | d[count++] = (z3 << 6) | (z4); |
|
|
920 | |
|
|
921 | s+=4; |
|
|
922 | } |
|
|
923 | if (z1 != -1 && z2 != -1 && *(s+2) == '=') { |
|
|
924 | d[count++] = (z1 << 2) | (z2 >> 4); |
|
|
925 | s+=2; |
|
|
926 | } |
|
|
927 | else if (z1 != -1 && z2 != -1 && z3 != -1 && *(s+3) == '=') { |
|
|
928 | d[count++] = (z1 << 2) | (z2 >> 4); |
|
|
929 | d[count++] = (z2 << 4) | (z3 >> 2); |
|
|
930 | s+=3; |
|
|
931 | } |
|
|
932 | } |
|
|
933 | else if (method == QP_ENCODED) { |
|
|
934 | while (*s && (*s != '?' || *(s+1) != '=')) { |
|
|
935 | while (*s && *s != '=' && (*s != '?' || *(s+1) != '=')) { |
|
|
936 | d[count++] = *s++; |
|
|
937 | } |
|
|
938 | if (*s == '=') { |
|
|
939 | if (isxdigit (*(s+1)) && isxdigit (*(s+2))) { |
|
|
940 | d[count] = (isdigit (*(s+1)) ? (*(s+1)-'0') : (tolower (*(s+1))-'a'+10)) << 4; |
|
|
941 | d[count] |= (isdigit (*(s+2)) ? (*(s+2)-'0') : (tolower (*(s+2))-'a'+10)); |
|
|
942 | count++; |
|
|
943 | s+=3; |
|
|
944 | } |
|
|
945 | else if (*(s+1) == '\012' || *(s+1) == '\015') { |
|
|
946 | s+=2; |
|
|
947 | } |
|
|
948 | else { |
|
|
949 | d[count++] = *s++; |
|
|
950 | } |
|
|
951 | } |
|
|
952 | } |
|
|
953 | } |
|
|
954 | else { |
|
|
955 | return -1; |
|
|
956 | } |
|
|
957 | |
|
|
958 | d[count] = '\0'; |
|
|
959 | return count; |
|
|
960 | } |
|
|
961 | |
879 | int |
962 | int |
880 | UUDecodePart (FILE *datain, FILE *dataout, int *state, |
963 | UUDecodePart (FILE *datain, FILE *dataout, int *state, |
881 | long maxpos, int method, int flags, |
964 | long maxpos, int method, int flags, |
882 | char *boundary) |
965 | char *boundary) |
883 | { |
966 | { |
884 | char *line=uugen_fnbuffer, *oline=uuncdp_oline; |
967 | char *line=uugen_fnbuffer, *oline=uuncdp_oline; |
885 | int warning=0, vlc=0, lc[2], hadct=0; |
968 | int warning=0, vlc=0, lc[2], hadct=0; |
886 | int tc=0, tf=0, vflag, haddata=0, haddh=0; |
969 | int tc=0, tf=0, vflag, haddata=0, haddh=0; |
|
|
970 | long yefilesize=0, yepartends=0; |
|
|
971 | crc32_t yepartcrc=crc32(0L, Z_NULL, 0); |
|
|
972 | static crc32_t yefilecrc=0; |
887 | static int bhflag=0; |
973 | static int bhflag=0; |
888 | size_t count=0; |
974 | size_t count=0; |
|
|
975 | size_t yepartsize=0; |
|
|
976 | char *ptr; |
889 | |
977 | |
890 | if (datain == NULL || dataout == NULL) { |
978 | if (datain == NULL || dataout == NULL) { |
|
|
979 | yefilecrc = crc32(0L, Z_NULL, 0); |
891 | bhflag = 0; |
980 | bhflag = 0; |
892 | return UURET_OK; |
981 | return UURET_OK; |
893 | } |
982 | } |
894 | |
983 | |
895 | /* |
984 | /* |
… | |
… | |
906 | lc[0] = lc[1] = 0; |
995 | lc[0] = lc[1] = 0; |
907 | vflag = 0; |
996 | vflag = 0; |
908 | |
997 | |
909 | uulboundary = -1; |
998 | uulboundary = -1; |
910 | |
999 | |
|
|
1000 | if (method == YENC_ENCODED) { |
|
|
1001 | *state = BEGIN; |
|
|
1002 | } |
|
|
1003 | |
911 | while (!feof (datain) && *state != DONE && |
1004 | while (!feof (datain) && *state != DONE && |
912 | (ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 || |
1005 | (ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 || |
913 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
1006 | (!(flags&FL_PROPER) && uu_fast_scanning))) { |
914 | if (FP_fgets (line, 255, datain) == NULL) |
1007 | if (_FP_fgets (line, 255, datain) == NULL) |
915 | break; |
1008 | break; |
|
|
1009 | |
916 | if (ferror (datain)) { |
1010 | if (ferror (datain)) { |
917 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1011 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
918 | uustring (S_SOURCE_READ_ERR), |
1012 | uustring (S_SOURCE_READ_ERR), |
919 | strerror (uu_errno = errno)); |
1013 | strerror (uu_errno = errno)); |
920 | return UURET_IOERR; |
1014 | return UURET_IOERR; |
921 | } |
1015 | } |
|
|
1016 | |
922 | if (line[0]=='\015' || line[0]=='\012') { /* Empty line? */ |
1017 | if (line[0]=='\015' || line[0]=='\012') { /* Empty line? */ |
923 | if (*state == DATA && |
1018 | if (*state == DATA && |
924 | (method == UU_ENCODED || method == XX_ENCODED)) |
1019 | (method == UU_ENCODED || method == XX_ENCODED)) |
925 | *state = END; |
1020 | *state = END; |
|
|
1021 | |
926 | /* |
1022 | /* |
927 | * if we had a whole block of valid lines before, we reset our |
1023 | * if we had a whole block of valid lines before, we reset our |
928 | * 'valid data' flag, tf. Without this 'if', we'd break decoding |
1024 | * 'valid data' flag, tf. Without this 'if', we'd break decoding |
929 | * files with interleaved blank lines. The value of 5 is chosen |
1025 | * files with interleaved blank lines. The value of 5 is chosen |
930 | * quite arbitrarly. |
1026 | * quite arbitrarly. |
931 | */ |
1027 | */ |
|
|
1028 | |
932 | if (vlc > 5) |
1029 | if (vlc > 5) |
933 | tf = tc = 0; |
1030 | tf = tc = 0; |
934 | vlc = 0; |
1031 | vlc = 0; |
935 | continue; |
1032 | continue; |
936 | } |
1033 | } |
… | |
… | |
965 | * Use this pseudo-handling only if !FL_PROPER |
1062 | * Use this pseudo-handling only if !FL_PROPER |
966 | */ |
1063 | */ |
967 | |
1064 | |
968 | if ((flags&FL_PROPER) == 0) { |
1065 | if ((flags&FL_PROPER) == 0) { |
969 | if (strncmp (line, "BEGIN", 5) == 0 && |
1066 | if (strncmp (line, "BEGIN", 5) == 0 && |
970 | FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ |
1067 | _FP_strstr (line, "CUT HERE") && !tf) { /* I hate these lines */ |
971 | tc = tf = vlc = 0; |
1068 | tc = tf = vlc = 0; |
972 | continue; |
1069 | continue; |
973 | } |
1070 | } |
974 | /* MIME body boundary */ |
1071 | /* MIME body boundary */ |
975 | if (line[0] == '-' && line[1] == '-' && method == B64ENCODED) { |
1072 | if (line[0] == '-' && line[1] == '-' && method == B64ENCODED) { |
… | |
… | |
981 | } |
1078 | } |
982 | hadct = 0; |
1079 | hadct = 0; |
983 | haddh = 1; |
1080 | haddh = 1; |
984 | continue; |
1081 | continue; |
985 | } |
1082 | } |
986 | if (FP_strnicmp (line, "Content-Type", 12) == 0) |
1083 | if (_FP_strnicmp (line, "Content-Type", 12) == 0) |
987 | hadct = 1; |
1084 | hadct = 1; |
988 | } |
1085 | } |
989 | |
1086 | |
990 | if (*state == BEGIN) { |
1087 | if (*state == BEGIN) { |
|
|
1088 | if ((method == UU_ENCODED || method == XX_ENCODED) && |
991 | if (strncmp (line, "begin ", 6) == 0 || |
1089 | (strncmp (line, "begin ", 6) == 0 || |
992 | FP_strnicmp (line, "<pre>begin ", 11) == 0) { /* for LYNX */ |
1090 | _FP_strnicmp (line, "<pre>begin ", 11) == 0)) { /* for LYNX */ |
993 | *state = DATA; |
1091 | *state = DATA; |
994 | continue; |
1092 | continue; |
995 | } |
1093 | } |
996 | else if (method == BH_ENCODED && line[0] == ':') { |
1094 | else if (method == BH_ENCODED && line[0] == ':') { |
997 | if (UUValidData (line, BH_ENCODED, &bhflag) == BH_ENCODED) { |
1095 | if (UUValidData (line, BH_ENCODED, &bhflag) == BH_ENCODED) { |
… | |
… | |
999 | *state = DATA; |
1097 | *state = DATA; |
1000 | } |
1098 | } |
1001 | else |
1099 | else |
1002 | continue; |
1100 | continue; |
1003 | } |
1101 | } |
1004 | else |
1102 | else if (method == YENC_ENCODED && |
|
|
1103 | strncmp (line, "=ybegin ", 8) == 0 && |
|
|
1104 | _FP_strstr (line, " name=") != NULL) { |
|
|
1105 | *state = DATA; |
|
|
1106 | |
|
|
1107 | if ((ptr = _FP_strstr (line, " size=")) != NULL) { |
|
|
1108 | ptr += 6; |
|
|
1109 | yefilesize = atoi (ptr); |
|
|
1110 | } |
|
|
1111 | else { |
|
|
1112 | yefilesize = -1; |
|
|
1113 | } |
|
|
1114 | |
|
|
1115 | if (_FP_strstr (line, " part=") != NULL) { |
|
|
1116 | if (_FP_fgets (line, 255, datain) == NULL) { |
|
|
1117 | break; |
|
|
1118 | } |
|
|
1119 | |
|
|
1120 | if ((ptr = _FP_strstr (line, " end=")) == NULL) { |
|
|
1121 | break; |
|
|
1122 | } |
|
|
1123 | |
|
|
1124 | yepartends = atoi (ptr + 5); |
|
|
1125 | } |
|
|
1126 | tf = 1; |
1005 | continue; |
1127 | continue; |
|
|
1128 | } |
|
|
1129 | else { |
|
|
1130 | continue; |
|
|
1131 | } |
1006 | |
1132 | |
1007 | tc = tf = vlc = 0; |
1133 | tc = tf = vlc = 0; |
1008 | lc[0] = lc[1] = 0; |
1134 | lc[0] = lc[1] = 0; |
1009 | } |
1135 | } |
1010 | else if ((*state == END) && |
1136 | else if ((*state == END) && |
… | |
… | |
1012 | if (strncmp (line, "end", 3) == 0) { |
1138 | if (strncmp (line, "end", 3) == 0) { |
1013 | *state = DONE; |
1139 | *state = DONE; |
1014 | break; |
1140 | break; |
1015 | } |
1141 | } |
1016 | } |
1142 | } |
|
|
1143 | |
|
|
1144 | if (*state == DATA && method == YENC_ENCODED && |
|
|
1145 | strncmp (line, "=yend ", 6) == 0) { |
|
|
1146 | if ((ptr = _FP_strstr (line, " pcrc32=")) != NULL) { |
|
|
1147 | crc32_t pcrc32 = strtoul (ptr + 8, NULL, 16); |
|
|
1148 | if (pcrc32 != yepartcrc) { |
|
|
1149 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
|
|
1150 | uustring (S_PCRC_MISMATCH), progress.curfile, progress.partno); |
|
|
1151 | } |
|
|
1152 | } |
|
|
1153 | if ((ptr = _FP_strstr (line, " crc32=")) != NULL) |
|
|
1154 | { |
|
|
1155 | crc32_t fcrc32 = strtoul (ptr + 7, NULL, 16); |
|
|
1156 | if (fcrc32 != yefilecrc) { |
|
|
1157 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
|
|
1158 | uustring (S_CRC_MISMATCH), progress.curfile); |
|
|
1159 | } |
|
|
1160 | } |
|
|
1161 | if ((ptr = _FP_strstr (line, " size=")) != NULL) |
|
|
1162 | { |
|
|
1163 | size_t size = atol(ptr + 6); |
|
|
1164 | if (size != yepartsize && yefilesize != -1) { |
|
|
1165 | if (size != yefilesize) |
|
|
1166 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
|
|
1167 | uustring (S_PSIZE_MISMATCH), progress.curfile, |
|
|
1168 | progress.partno, yepartsize, size); |
|
|
1169 | else |
|
|
1170 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
|
|
1171 | uustring (S_SIZE_MISMATCH), progress.curfile, |
|
|
1172 | yepartsize, size); |
|
|
1173 | } |
|
|
1174 | } |
|
|
1175 | if (yepartends == 0 || yepartends >= yefilesize) { |
|
|
1176 | *state = DONE; |
|
|
1177 | } |
|
|
1178 | break; |
|
|
1179 | } |
|
|
1180 | |
1017 | if (*state == DATA || *state == END) { |
1181 | if (*state == DATA || *state == END) { |
1018 | if (method==B64ENCODED && line[0]=='-' && line[1]=='-' && tc) { |
1182 | if (method==B64ENCODED && line[0]=='-' && line[1]=='-' && tc) { |
1019 | break; |
1183 | break; |
1020 | } |
1184 | } |
1021 | |
1185 | |
… | |
… | |
1033 | } |
1197 | } |
1034 | |
1198 | |
1035 | if (vflag == method) { |
1199 | if (vflag == method) { |
1036 | if (tf) { |
1200 | if (tf) { |
1037 | count = UUDecodeLine (line, oline, method); |
1201 | count = UUDecodeLine (line, oline, method); |
|
|
1202 | if (method == YENC_ENCODED) { |
|
|
1203 | if (yepartends) |
|
|
1204 | yepartcrc = crc32(yepartcrc, oline, count); |
|
|
1205 | yefilecrc = crc32(yefilecrc, oline, count); |
|
|
1206 | yepartsize += count; |
|
|
1207 | } |
1038 | vlc++; lc[1]++; |
1208 | vlc++; lc[1]++; |
1039 | } |
1209 | } |
1040 | else if (tc == 3) { |
1210 | else if (tc == 3) { |
1041 | count = UUDecodeLine (save[0], oline, method); |
1211 | count = UUDecodeLine (save[0], oline, method); |
1042 | count += UUDecodeLine (save[1], oline + count, method); |
1212 | count += UUDecodeLine (save[1], oline + count, method); |
… | |
… | |
1058 | } |
1228 | } |
1059 | lc[0] = 0; |
1229 | lc[0] = 0; |
1060 | lc[1] = 3; |
1230 | lc[1] = 3; |
1061 | } |
1231 | } |
1062 | else { |
1232 | else { |
1063 | FP_strncpy (save[tc++], line, 256); |
1233 | _FP_strncpy (save[tc++], line, 256); |
1064 | } |
1234 | } |
|
|
1235 | |
1065 | if (method == UU_ENCODED) |
1236 | if (method == UU_ENCODED) |
1066 | *state = (line[0] == 'M') ? DATA : END; |
1237 | *state = (line[0] == 'M') ? DATA : END; |
1067 | else if (method == XX_ENCODED) |
1238 | else if (method == XX_ENCODED) |
1068 | *state = (line[0] == 'h') ? DATA : END; |
1239 | *state = (line[0] == 'h') ? DATA : END; |
1069 | else if (method == B64ENCODED) |
1240 | else if (method == B64ENCODED) |
… | |
… | |
1078 | } |
1249 | } |
1079 | } |
1250 | } |
1080 | else if (*state != DONE) { |
1251 | else if (*state != DONE) { |
1081 | return UURET_NOEND; |
1252 | return UURET_NOEND; |
1082 | } |
1253 | } |
|
|
1254 | |
1083 | if (count) { |
1255 | if (count) { |
1084 | if (method == BH_ENCODED) { |
1256 | if (method == BH_ENCODED) { |
1085 | if (UUbhwrite (oline, 1, count, dataout) != count) { |
1257 | if (UUbhwrite (oline, 1, count, dataout) != count) { |
1086 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1258 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1087 | uustring (S_WR_ERR_TEMP), |
1259 | uustring (S_WR_ERR_TEMP), |
… | |
… | |
1137 | FILE *datain, *dataout; |
1309 | FILE *datain, *dataout; |
1138 | unsigned char r[8]; |
1310 | unsigned char r[8]; |
1139 | char *mode, *ntmp; |
1311 | char *mode, *ntmp; |
1140 | uufile *iter; |
1312 | uufile *iter; |
1141 | size_t bytes; |
1313 | size_t bytes; |
1142 | #ifdef HAVE_MKSTEMP |
|
|
1143 | int tmpfd; |
|
|
1144 | const char *tmpprefix = "uuXXXXXX"; |
|
|
1145 | char *tmpdir = NULL; |
|
|
1146 | #endif /* HAVE_MKSTEMP */ |
|
|
1147 | |
1314 | |
1148 | if (data == NULL || data->thisfile == NULL) |
1315 | if (data == NULL || data->thisfile == NULL) |
1149 | return UURET_ILLVAL; |
1316 | return UURET_ILLVAL; |
1150 | |
1317 | |
1151 | if (data->state & UUFILE_TMPFILE) |
1318 | if (data->state & UUFILE_TMPFILE) |
… | |
… | |
1160 | if (data->uudet == PT_ENCODED) |
1327 | if (data->uudet == PT_ENCODED) |
1161 | mode = "wt"; /* open text files in text mode */ |
1328 | mode = "wt"; /* open text files in text mode */ |
1162 | else |
1329 | else |
1163 | mode = "wb"; /* otherwise in binary */ |
1330 | mode = "wb"; /* otherwise in binary */ |
1164 | |
1331 | |
1165 | #ifdef HAVE_MKSTEMP |
|
|
1166 | if ((getuid()==geteuid()) && (getgid()==getegid())) { |
|
|
1167 | tmpdir=getenv("TMPDIR"); |
|
|
1168 | } |
|
|
1169 | |
|
|
1170 | if (!tmpdir) { |
|
|
1171 | tmpdir = "/tmp"; |
|
|
1172 | } |
|
|
1173 | data->binfile = malloc(strlen(tmpdir)+strlen(tmpprefix)+2); |
|
|
1174 | |
|
|
1175 | if (!data->binfile) { |
|
|
1176 | #else |
|
|
1177 | if ((data->binfile = tempnam (NULL, "uu")) == NULL) { |
1332 | if ((data->binfile = tempnam (NULL, "uu")) == NULL) { |
1178 | #endif /* HAVE_MKSTEMP */ |
|
|
1179 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1333 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1180 | uustring (S_NO_TEMP_NAME)); |
1334 | uustring (S_NO_TEMP_NAME)); |
1181 | return UURET_NOMEM; |
1335 | return UURET_NOMEM; |
1182 | } |
1336 | } |
1183 | |
1337 | |
1184 | #ifdef HAVE_MKSTEMP |
|
|
1185 | strcpy(data->binfile, tmpdir); |
|
|
1186 | strcat(data->binfile, "/"); |
|
|
1187 | strcat(data->binfile, tmpprefix); |
|
|
1188 | |
|
|
1189 | if ((tmpfd = mkstemp(data->binfile)) == -1 || |
|
|
1190 | (dataout = fdopen(tmpfd, mode)) == NULL) { |
|
|
1191 | #else |
|
|
1192 | if ((dataout = fopen (data->binfile, mode)) == NULL) { |
1338 | if ((dataout = fopen (data->binfile, mode)) == NULL) { |
1193 | #endif /* HAVE_MKSTEMP */ |
|
|
1194 | /* |
1339 | /* |
1195 | * we couldn't create a temporary file. Usually this means that TMP |
1340 | * we couldn't create a temporary file. Usually this means that TMP |
1196 | * and TEMP aren't set |
1341 | * and TEMP aren't set |
1197 | */ |
1342 | */ |
1198 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1343 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1199 | uustring (S_WR_ERR_TARGET), |
1344 | uustring (S_WR_ERR_TARGET), |
1200 | data->binfile, strerror (uu_errno = errno)); |
1345 | data->binfile, strerror (uu_errno = errno)); |
1201 | #ifdef HAVE_MKSTEMP |
|
|
1202 | if (tmpfd != -1) { |
|
|
1203 | unlink(data->binfile); |
|
|
1204 | close(tmpfd); |
|
|
1205 | } |
|
|
1206 | #endif /* HAVE_MKSTEMP */ |
|
|
1207 | FP_free (data->binfile); |
1346 | _FP_free (data->binfile); |
1208 | data->binfile = NULL; |
1347 | data->binfile = NULL; |
1209 | uu_errno = errno; |
1348 | uu_errno = errno; |
1210 | return UURET_IOERR; |
1349 | return UURET_IOERR; |
1211 | } |
1350 | } |
1212 | |
|
|
1213 | /* |
1351 | /* |
1214 | * we don't have begin lines in Base64 or plain text files. |
1352 | * we don't have begin lines in Base64 or plain text files. |
1215 | */ |
1353 | */ |
1216 | if (data->uudet == B64ENCODED || data->uudet == QP_ENCODED || |
1354 | if (data->uudet == B64ENCODED || data->uudet == QP_ENCODED || |
1217 | data->uudet == PT_ENCODED) |
1355 | data->uudet == PT_ENCODED) |
… | |
… | |
1232 | /* |
1370 | /* |
1233 | * initialize progress information |
1371 | * initialize progress information |
1234 | */ |
1372 | */ |
1235 | progress.action = 0; |
1373 | progress.action = 0; |
1236 | if (data->filename != NULL) { |
1374 | if (data->filename != NULL) { |
1237 | FP_strncpy (progress.curfile, |
1375 | _FP_strncpy (progress.curfile, |
1238 | (strlen(data->filename)>255)? |
1376 | (strlen(data->filename)>255)? |
1239 | (data->filename+strlen(data->filename)-255):data->filename, |
1377 | (data->filename+strlen(data->filename)-255):data->filename, |
1240 | 256); |
1378 | 256); |
1241 | } |
1379 | } |
1242 | else { |
1380 | else { |
1243 | FP_strncpy (progress.curfile, |
1381 | _FP_strncpy (progress.curfile, |
1244 | (strlen(data->binfile)>255)? |
1382 | (strlen(data->binfile)>255)? |
1245 | (data->binfile+strlen(data->binfile)-255):data->binfile, |
1383 | (data->binfile+strlen(data->binfile)-255):data->binfile, |
1246 | 256); |
1384 | 256); |
1247 | } |
1385 | } |
1248 | progress.partno = 0; |
1386 | progress.partno = 0; |
… | |
… | |
1261 | * let's rock! |
1399 | * let's rock! |
1262 | */ |
1400 | */ |
1263 | |
1401 | |
1264 | iter = data->thisfile; |
1402 | iter = data->thisfile; |
1265 | while (iter) { |
1403 | while (iter) { |
1266 | if (part != -1 && iter->partno != part+1) |
1404 | if (part != -1 && iter->partno != part+1 && !uu_desperate) |
1267 | break; |
1405 | break; |
1268 | else |
1406 | else |
1269 | part = iter->partno; |
1407 | part = iter->partno; |
1270 | |
1408 | |
1271 | if (iter->data->sfname == NULL) { |
1409 | if (iter->data->sfname == NULL) { |
… | |
… | |
1297 | uustring (S_NOT_OPEN_FILE), |
1435 | uustring (S_NOT_OPEN_FILE), |
1298 | iter->data->sfname, strerror (uu_errno = errno)); |
1436 | iter->data->sfname, strerror (uu_errno = errno)); |
1299 | res = UURET_IOERR; |
1437 | res = UURET_IOERR; |
1300 | break; |
1438 | break; |
1301 | } |
1439 | } |
1302 | FP_strncpy (uugen_fnbuffer, iter->data->sfname, 1024); |
1440 | _FP_strncpy (uugen_fnbuffer, iter->data->sfname, 1024); |
1303 | } |
1441 | } |
1304 | |
1442 | |
1305 | progress.partno = part; |
1443 | progress.partno = part; |
1306 | progress.fsize = (iter->data->length)?iter->data->length:-1; |
1444 | progress.fsize = (iter->data->length)?iter->data->length:-1; |
1307 | progress.percent = 0; |
1445 | progress.percent = 0; |
… | |
… | |
1325 | if (state == DATA && |
1463 | if (state == DATA && |
1326 | (data->uudet == B64ENCODED || data->uudet == QP_ENCODED || |
1464 | (data->uudet == B64ENCODED || data->uudet == QP_ENCODED || |
1327 | data->uudet == PT_ENCODED)) |
1465 | data->uudet == PT_ENCODED)) |
1328 | state = DONE; /* assume we're done */ |
1466 | state = DONE; /* assume we're done */ |
1329 | |
1467 | |
1330 | fclose (dataout); |
1468 | if (fclose (dataout)) { |
|
|
1469 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
|
|
1470 | uustring (S_WR_ERR_TEMP), |
|
|
1471 | strerror (uu_errno = errno)); |
|
|
1472 | res = UURET_IOERR; |
|
|
1473 | } |
1331 | |
1474 | |
1332 | if (res != UURET_OK || (state != DONE && !uu_desperate)) { |
1475 | if (res != UURET_OK || (state != DONE && !uu_desperate)) { |
1333 | unlink (data->binfile); |
1476 | unlink (data->binfile); |
1334 | FP_free (data->binfile); |
1477 | _FP_free (data->binfile); |
1335 | data->binfile = NULL; |
1478 | data->binfile = NULL; |
1336 | data->state &= ~UUFILE_TMPFILE; |
1479 | data->state &= ~UUFILE_TMPFILE; |
1337 | data->state |= UUFILE_ERROR; |
1480 | data->state |= UUFILE_ERROR; |
1338 | |
1481 | |
1339 | if (res == UURET_OK && state != DONE) |
1482 | if (res == UURET_OK && state != DONE) |
… | |
… | |
1351 | /* |
1494 | /* |
1352 | * If this was a BinHex file, we must extract its data or resource fork |
1495 | * If this was a BinHex file, we must extract its data or resource fork |
1353 | */ |
1496 | */ |
1354 | |
1497 | |
1355 | if (data->uudet == BH_ENCODED && data->binfile) { |
1498 | if (data->uudet == BH_ENCODED && data->binfile) { |
1356 | #ifdef HAVE_MKSTEMP |
|
|
1357 | ntmp = malloc(strlen(tmpdir)+strlen(tmpprefix)+2); |
|
|
1358 | |
|
|
1359 | if (ntmp == NULL) { |
|
|
1360 | #else |
|
|
1361 | if ((ntmp = tempnam (NULL, "uu")) == NULL) { |
1499 | if ((ntmp = tempnam (NULL, "uu")) == NULL) { |
1362 | #endif /* HAVE_MKSTEMP */ |
|
|
1363 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1500 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1364 | uustring (S_NO_TEMP_NAME)); |
1501 | uustring (S_NO_TEMP_NAME)); |
1365 | progress.action = 0; |
1502 | progress.action = 0; |
1366 | return UURET_NOMEM; |
1503 | return UURET_NOMEM; |
1367 | } |
1504 | } |
… | |
… | |
1371 | data->binfile, strerror (uu_errno = errno)); |
1508 | data->binfile, strerror (uu_errno = errno)); |
1372 | progress.action = 0; |
1509 | progress.action = 0; |
1373 | free (ntmp); |
1510 | free (ntmp); |
1374 | return UURET_IOERR; |
1511 | return UURET_IOERR; |
1375 | } |
1512 | } |
1376 | #ifdef HAVE_MKSTEMP |
|
|
1377 | strcpy(ntmp, tmpdir); |
|
|
1378 | strcat(ntmp, "/"); |
|
|
1379 | strcat(ntmp, tmpprefix); |
|
|
1380 | if ((tmpfd = mkstemp(ntmp)) == -1 || |
|
|
1381 | (dataout = fdopen(tmpfd, "wb")) == NULL) { |
|
|
1382 | #else |
|
|
1383 | if ((dataout = fopen (ntmp, "wb")) == NULL) { |
1513 | if ((dataout = fopen (ntmp, "wb")) == NULL) { |
1384 | #endif /* HAVE_MKSTEMP */ |
|
|
1385 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1514 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
1386 | uustring (S_NOT_OPEN_TARGET), |
1515 | uustring (S_NOT_OPEN_TARGET), |
1387 | ntmp, strerror (uu_errno = errno)); |
1516 | ntmp, strerror (uu_errno = errno)); |
1388 | progress.action = 0; |
1517 | progress.action = 0; |
1389 | fclose (datain); |
1518 | fclose (datain); |
1390 | #ifdef HAVE_MKSTEMP |
|
|
1391 | if (tmpfd != -1) { |
|
|
1392 | unlink(ntmp); |
|
|
1393 | close(tmpfd); |
|
|
1394 | } |
|
|
1395 | #endif /* HAVE_MKSTEMP */ |
|
|
1396 | free (ntmp); |
1519 | free (ntmp); |
1397 | return UURET_IOERR; |
1520 | return UURET_IOERR; |
1398 | } |
1521 | } |
1399 | |
|
|
1400 | /* |
1522 | /* |
1401 | * read fork lengths. remember they're in Motorola format |
1523 | * read fork lengths. remember they're in Motorola format |
1402 | */ |
1524 | */ |
1403 | r[0] = fgetc (datain); |
1525 | r[0] = fgetc (datain); |
1404 | hb = (int) r[0] + 22; |
1526 | hb = (int) r[0] + 22; |
… | |
… | |
1496 | /* |
1618 | /* |
1497 | * replace temp file |
1619 | * replace temp file |
1498 | */ |
1620 | */ |
1499 | |
1621 | |
1500 | fclose (datain); |
1622 | fclose (datain); |
1501 | fclose (dataout); |
1623 | if (fclose (dataout)) { |
|
|
1624 | UUMessage (uunconc_id, __LINE__, UUMSG_ERROR, |
|
|
1625 | uustring (S_WR_ERR_TARGET), |
|
|
1626 | ntmp, strerror (uu_errno = errno)); |
|
|
1627 | unlink (ntmp); |
|
|
1628 | free (ntmp); |
|
|
1629 | return UURET_IOERR; |
|
|
1630 | } |
1502 | |
1631 | |
1503 | if (unlink (data->binfile)) { |
1632 | if (unlink (data->binfile)) { |
1504 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
1633 | UUMessage (uunconc_id, __LINE__, UUMSG_WARNING, |
1505 | uustring (S_TMP_NOT_REMOVED), |
1634 | uustring (S_TMP_NOT_REMOVED), |
1506 | data->binfile, strerror (uu_errno = errno)); |
1635 | data->binfile, strerror (uu_errno = errno)); |
… | |
… | |
1530 | */ |
1659 | */ |
1531 | |
1660 | |
1532 | memset (&myenv, 0, sizeof (headers)); |
1661 | memset (&myenv, 0, sizeof (headers)); |
1533 | UUScanHeader (datain, &myenv); |
1662 | UUScanHeader (datain, &myenv); |
1534 | |
1663 | |
1535 | if (FP_stristr (myenv.ctenc, "uu") != NULL) |
1664 | if (_FP_stristr (myenv.ctenc, "uu") != NULL) |
1536 | encoding = UU_ENCODED; |
1665 | encoding = UU_ENCODED; |
1537 | else if (FP_stristr (myenv.ctenc, "xx") != NULL) |
1666 | else if (_FP_stristr (myenv.ctenc, "xx") != NULL) |
1538 | encoding = XX_ENCODED; |
1667 | encoding = XX_ENCODED; |
1539 | else if (FP_stricmp (myenv.ctenc, "base64") == 0) |
1668 | else if (_FP_stricmp (myenv.ctenc, "base64") == 0) |
1540 | encoding = B64ENCODED; |
1669 | encoding = B64ENCODED; |
1541 | else if (FP_stricmp (myenv.ctenc, "quoted-printable") == 0) |
1670 | else if (_FP_stricmp (myenv.ctenc, "quoted-printable") == 0) |
1542 | encoding = QP_ENCODED; |
1671 | encoding = QP_ENCODED; |
1543 | else |
1672 | else |
1544 | encoding = PT_ENCODED; |
1673 | encoding = PT_ENCODED; |
1545 | |
1674 | |
1546 | UUkillheaders (&myenv); |
1675 | UUkillheaders (&myenv); |