fix types conversion
This commit is contained in:
parent
453fe2783e
commit
1f2fc4b132
@ -138,7 +138,7 @@ unsigned char UUEncodeTable[64] = {
|
|||||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||||
'X', 'Y', 'Z', '[', '\\',']', '^', '_'
|
'X', 'Y', 'Z', '[', '\\',']', '^', '_'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
unsigned char B64EncodeTable[64] = {
|
unsigned char B64EncodeTable[64] = {
|
||||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||||
@ -165,11 +165,11 @@ unsigned char XXEncodeTable[64] = {
|
|||||||
unsigned char BHEncodeTable[64] = {
|
unsigned char BHEncodeTable[64] = {
|
||||||
'!', '"', '#', '$', '%', '&', '\'', '(',
|
'!', '"', '#', '$', '%', '&', '\'', '(',
|
||||||
')', '*', '+', ',', '-', '0', '1', '2',
|
')', '*', '+', ',', '-', '0', '1', '2',
|
||||||
'3', '4', '5', '6', '8', '9', '@', 'A',
|
'3', '4', '5', '6', '8', '9', '@', 'A',
|
||||||
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
|
||||||
'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
|
'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R',
|
||||||
'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[',
|
'S', 'T', 'U', 'V', 'X', 'Y', 'Z', '[',
|
||||||
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'h',
|
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'h',
|
||||||
'i', 'j', 'k', 'l', 'm', 'p', 'q', 'r'
|
'i', 'j', 'k', 'l', 'm', 'p', 'q', 'r'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ char *uuestr_otemp;
|
|||||||
* Encode one part of the data stream
|
* Encode one part of the data stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc32_t *crc, crc32_t *pcrc)
|
UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc32_t *crc, crc32_t *pcrc)
|
||||||
{
|
{
|
||||||
unsigned char *itemp = (unsigned char *) uuestr_itemp;
|
unsigned char *itemp = (unsigned char *) uuestr_itemp;
|
||||||
@ -283,7 +283,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
/*
|
/*
|
||||||
* Busy Callback
|
* Busy Callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
|
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
|
||||||
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
|
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
|
||||||
uustring (S_ENCODE_CANCEL));
|
uustring (S_ENCODE_CANCEL));
|
||||||
@ -296,7 +296,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
*/
|
*/
|
||||||
if (count > 0 && itemp[count-1] == '\n') {
|
if (count > 0 && itemp[count-1] == '\n') {
|
||||||
itemp[--count] = '\0';
|
itemp[--count] = '\0';
|
||||||
if (fwrite (itemp, 1, count, outfile) != count ||
|
if (fwrite (itemp, 1, count, outfile) != (unsigned)count ||
|
||||||
fwrite ((char *) eolstring, 1,
|
fwrite ((char *) eolstring, 1,
|
||||||
strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
|
strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
|
||||||
return UURET_IOERR;
|
return UURET_IOERR;
|
||||||
@ -389,13 +389,13 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
|
|
||||||
*optr++ = '=';
|
*optr++ = '=';
|
||||||
llen++;
|
llen++;
|
||||||
|
|
||||||
if (fwrite (otemp, 1, llen, outfile) != llen ||
|
if (fwrite (otemp, 1, llen, outfile) != llen ||
|
||||||
fwrite ((char *) eolstring, 1,
|
fwrite ((char *) eolstring, 1,
|
||||||
strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
|
strlen((char *) eolstring), outfile) != strlen ((char *) eolstring)) {
|
||||||
return UURET_IOERR;
|
return UURET_IOERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
optr = otemp;
|
optr = otemp;
|
||||||
llen = 0;
|
llen = 0;
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
/*
|
/*
|
||||||
* Busy Callback
|
* Busy Callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
|
if (UUBUSYPOLL(ftell(infile)-progress.foffset,progress.fsize)) {
|
||||||
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
|
UUMessage (uuencode_id, __LINE__, UUMSG_NOTE,
|
||||||
uustring (S_ENCODE_CANCEL));
|
uustring (S_ENCODE_CANCEL));
|
||||||
@ -566,7 +566,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
if (encoding == B64ENCODED) {
|
if (encoding == B64ENCODED) {
|
||||||
if (count - index == 2) {
|
if (count - index == 2) {
|
||||||
*optr++ = table[itemp[index] >> 2];
|
*optr++ = table[itemp[index] >> 2];
|
||||||
*optr++ = table[((itemp[index ] & 0x03) << 4) |
|
*optr++ = table[((itemp[index ] & 0x03) << 4) |
|
||||||
((itemp[index+1] & 0xf0) >> 4)];
|
((itemp[index+1] & 0xf0) >> 4)];
|
||||||
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
|
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
|
||||||
*optr++ = '=';
|
*optr++ = '=';
|
||||||
@ -582,7 +582,7 @@ UUEncodeStream (FILE *outfile, FILE *infile, int encoding, long linperfile, crc3
|
|||||||
else if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
else if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
||||||
if (count - index == 2) {
|
if (count - index == 2) {
|
||||||
*optr++ = table[itemp[index] >> 2];
|
*optr++ = table[itemp[index] >> 2];
|
||||||
*optr++ = table[((itemp[index ] & 0x03) << 4) |
|
*optr++ = table[((itemp[index ] & 0x03) << 4) |
|
||||||
( itemp[index+1] >> 4)];
|
( itemp[index+1] >> 4)];
|
||||||
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
|
*optr++ = table[((itemp[index+1] & 0x0f) << 2)];
|
||||||
*optr++ = table[0];
|
*optr++ = table[0];
|
||||||
@ -633,7 +633,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
|
|||||||
crc32_t crc;
|
crc32_t crc;
|
||||||
crc32_t *crcptr=NULL;
|
crc32_t *crcptr=NULL;
|
||||||
|
|
||||||
if (outfile==NULL ||
|
if (outfile==NULL ||
|
||||||
(infile == NULL && infname==NULL) ||
|
(infile == NULL && infname==NULL) ||
|
||||||
(outfname==NULL && infname==NULL) ||
|
(outfname==NULL && infname==NULL) ||
|
||||||
(encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&&
|
(encoding!=UU_ENCODED&&encoding!=XX_ENCODED&&encoding!=B64ENCODED&&
|
||||||
@ -720,7 +720,7 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
|
|||||||
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
||||||
fprintf (outfile, "begin %o %s%s",
|
fprintf (outfile, "begin %o %s%s",
|
||||||
(themode) ? themode : 0644,
|
(themode) ? themode : 0644,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else if (encoding == YENC_ENCODED) {
|
else if (encoding == YENC_ENCODED) {
|
||||||
@ -728,13 +728,13 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
|
|||||||
crcptr = &crc;
|
crcptr = &crc;
|
||||||
if (progress.fsize == -1) {
|
if (progress.fsize == -1) {
|
||||||
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
||||||
progress.fsize,
|
progress.fsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,8 +751,8 @@ UUEncodeMulti (FILE *outfile, FILE *infile, char *infname, int encoding,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
||||||
fprintf (outfile, "%c%s",
|
fprintf (outfile, "%c%s",
|
||||||
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
fprintf (outfile, "end%s", (char *) eolstring);
|
fprintf (outfile, "end%s", (char *) eolstring);
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
|
|||||||
}
|
}
|
||||||
if (linperfile <= 0)
|
if (linperfile <= 0)
|
||||||
numparts = 1;
|
numparts = 1;
|
||||||
else
|
else
|
||||||
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
|
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
|
||||||
(linperfile*bpl[encoding]));
|
(linperfile*bpl[encoding]));
|
||||||
|
|
||||||
@ -905,7 +905,7 @@ UUEncodePartial (FILE *outfile, FILE *infile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fprintf (outfile, "%s", (char *) eolstring);
|
fprintf (outfile, "%s", (char *) eolstring);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for the first part of UU or XX messages, print a begin line
|
* for the first part of UU or XX messages, print a begin line
|
||||||
*/
|
*/
|
||||||
@ -923,33 +923,33 @@ UUEncodePartial (FILE *outfile, FILE *infile,
|
|||||||
if (progress.totsize == -1) {
|
if (progress.totsize == -1) {
|
||||||
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
|
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
|
||||||
partno,
|
partno,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
|
||||||
partno,
|
partno,
|
||||||
progress.totsize,
|
progress.totsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (outfile, "=ypart begin=%ld end=%ld%s",
|
fprintf (outfile, "=ypart begin=%ld end=%ld%s",
|
||||||
(partno-1)*linperfile*128+1,
|
(partno-1)*linperfile*128+1,
|
||||||
(partno*linperfile*128) < progress.totsize ?
|
(partno*linperfile*128) < progress.totsize ?
|
||||||
(partno*linperfile*128) : progress.totsize,
|
(partno*linperfile*128) : progress.totsize,
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (progress.totsize == -1) {
|
if (progress.totsize == -1) {
|
||||||
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
||||||
progress.totsize,
|
progress.totsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -993,15 +993,15 @@ UUEncodePartial (FILE *outfile, FILE *infile,
|
|||||||
|
|
||||||
if (feof (theifile) &&
|
if (feof (theifile) &&
|
||||||
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
||||||
fprintf (outfile, "%c%s",
|
fprintf (outfile, "%c%s",
|
||||||
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
fprintf (outfile, "end%s", (char *) eolstring);
|
fprintf (outfile, "end%s", (char *) eolstring);
|
||||||
}
|
}
|
||||||
else if (encoding == YENC_ENCODED) {
|
else if (encoding == YENC_ENCODED) {
|
||||||
if (numparts != 1) {
|
if (numparts != 1) {
|
||||||
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
|
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
|
||||||
(partno*linperfile*128) < progress.totsize ?
|
(partno*linperfile*128) < progress.totsize ?
|
||||||
linperfile*128 : (progress.totsize-(partno-1)*linperfile*128),
|
linperfile*128 : (progress.totsize-(partno-1)*linperfile*128),
|
||||||
partno,
|
partno,
|
||||||
pcrc);
|
pcrc);
|
||||||
@ -1115,7 +1115,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
|
|||||||
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
||||||
fprintf (outfile, "begin %o %s%s",
|
fprintf (outfile, "begin %o %s%s",
|
||||||
(themode) ? themode : 0644,
|
(themode) ? themode : 0644,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else if (encoding == YENC_ENCODED) {
|
else if (encoding == YENC_ENCODED) {
|
||||||
@ -1123,13 +1123,13 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
|
|||||||
crcptr = &crc;
|
crcptr = &crc;
|
||||||
if (progress.fsize == -1) {
|
if (progress.fsize == -1) {
|
||||||
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
||||||
progress.fsize,
|
progress.fsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1138,7 +1138,7 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
|
|||||||
if (res != UURET_CANCEL) {
|
if (res != UURET_CANCEL) {
|
||||||
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
|
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
|
||||||
uustring (S_ERR_ENCODING),
|
uustring (S_ERR_ENCODING),
|
||||||
UUFNameFilter ((infname)?infname:outfname),
|
UUFNameFilter ((infname)?infname:outfname),
|
||||||
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
|
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
|
||||||
}
|
}
|
||||||
progress.action = 0;
|
progress.action = 0;
|
||||||
@ -1146,8 +1146,8 @@ UUEncodeToStream (FILE *outfile, FILE *infile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
if (encoding == UU_ENCODED || encoding == XX_ENCODED) {
|
||||||
fprintf (outfile, "%c%s",
|
fprintf (outfile, "%c%s",
|
||||||
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
fprintf (outfile, "end%s", (char *) eolstring);
|
fprintf (outfile, "end%s", (char *) eolstring);
|
||||||
}
|
}
|
||||||
@ -1215,7 +1215,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
sprintf (oname, "%s", diskname);
|
sprintf (oname, "%s", diskname);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname)
|
len = ((uusavepath)?strlen(uusavepath):0) + strlen (diskname)
|
||||||
+ ((uuencodeext)?strlen(uuencodeext):0) + 5;
|
+ ((uuencodeext)?strlen(uuencodeext):0) + 5;
|
||||||
|
|
||||||
if ((oname = malloc (len)) == NULL) {
|
if ((oname = malloc (len)) == NULL) {
|
||||||
@ -1227,7 +1227,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
len = ((uusavepath) ? strlen (uusavepath) : 0) +
|
len = ((uusavepath) ? strlen (uusavepath) : 0) +
|
||||||
strlen(UUFNameFilter(infname)) +
|
strlen(UUFNameFilter(infname)) +
|
||||||
((uuencodeext)?strlen(uuencodeext):0) + 5;
|
((uuencodeext)?strlen(uuencodeext):0) + 5;
|
||||||
|
|
||||||
@ -1237,7 +1237,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
return UURET_NOMEM;
|
return UURET_NOMEM;
|
||||||
}
|
}
|
||||||
optr = UUFNameFilter (infname);
|
optr = UUFNameFilter (infname);
|
||||||
sprintf (oname, "%s%s",
|
sprintf (oname, "%s%s",
|
||||||
(uusavepath)?uusavepath:"",
|
(uusavepath)?uusavepath:"",
|
||||||
(*optr=='.')?optr+1:optr);
|
(*optr=='.')?optr+1:optr);
|
||||||
}
|
}
|
||||||
@ -1278,7 +1278,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
}
|
}
|
||||||
if (linperfile <= 0)
|
if (linperfile <= 0)
|
||||||
numparts = 1;
|
numparts = 1;
|
||||||
else
|
else
|
||||||
numparts = (int) (((long)finfo.st_size + (linperfile*bpl[encoding]-1)) /
|
numparts = (int) (((long)finfo.st_size + (linperfile*bpl[encoding]-1)) /
|
||||||
(linperfile*bpl[encoding]));
|
(linperfile*bpl[encoding]));
|
||||||
|
|
||||||
@ -1316,7 +1316,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
*/
|
*/
|
||||||
if (progress.numparts==1 && progress.totsize!=-1 && uuencodeext!=NULL)
|
if (progress.numparts==1 && progress.totsize!=-1 && uuencodeext!=NULL)
|
||||||
strcpy (optr, uuencodeext);
|
strcpy (optr, uuencodeext);
|
||||||
else
|
else
|
||||||
sprintf (optr, "%03d", part);
|
sprintf (optr, "%03d", part);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1383,7 +1383,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
if (part==1 && (encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
if (part==1 && (encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
||||||
fprintf (outfile, "begin %o %s%s",
|
fprintf (outfile, "begin %o %s%s",
|
||||||
(filemode)?filemode : 0644,
|
(filemode)?filemode : 0644,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else if (encoding == YENC_ENCODED) {
|
else if (encoding == YENC_ENCODED) {
|
||||||
@ -1397,33 +1397,33 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
if (progress.totsize == -1) {
|
if (progress.totsize == -1) {
|
||||||
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
|
fprintf (outfile, "=ybegin part=%d line=128 name=%s%s",
|
||||||
part,
|
part,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin part=%d line=128 size=%ld name=%s%s",
|
||||||
part,
|
part,
|
||||||
progress.totsize,
|
progress.totsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (outfile, "=ypart begin=%ld end=%ld%s",
|
fprintf (outfile, "=ypart begin=%ld end=%ld%s",
|
||||||
(part-1)*linperfile*128+1,
|
(part-1)*linperfile*128+1,
|
||||||
(part*linperfile*128) < progress.totsize ?
|
(part*linperfile*128) < progress.totsize ?
|
||||||
(part*linperfile*128) : progress.totsize,
|
(part*linperfile*128) : progress.totsize,
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (progress.totsize == -1) {
|
if (progress.totsize == -1) {
|
||||||
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
fprintf (outfile, "=ybegin line=128 name=%s%s",
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
fprintf (outfile, "=ybegin line=128 size=%ld name=%s%s",
|
||||||
progress.totsize,
|
progress.totsize,
|
||||||
UUFNameFilter ((outfname)?outfname:infname),
|
UUFNameFilter ((outfname)?outfname:infname),
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1434,7 +1434,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
if (res != UURET_CANCEL) {
|
if (res != UURET_CANCEL) {
|
||||||
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
|
UUMessage (uuencode_id, __LINE__, UUMSG_ERROR,
|
||||||
uustring (S_ERR_ENCODING),
|
uustring (S_ERR_ENCODING),
|
||||||
UUFNameFilter ((infname)?infname:outfname),
|
UUFNameFilter ((infname)?infname:outfname),
|
||||||
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
|
(res==UURET_IOERR)?strerror(uu_errno):UUstrerror (res));
|
||||||
}
|
}
|
||||||
if (infile==NULL) fclose (theifile);
|
if (infile==NULL) fclose (theifile);
|
||||||
@ -1447,15 +1447,15 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
|
|
||||||
if (feof (theifile) &&
|
if (feof (theifile) &&
|
||||||
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
(encoding == UU_ENCODED || encoding == XX_ENCODED)) {
|
||||||
fprintf (outfile, "%c%s",
|
fprintf (outfile, "%c%s",
|
||||||
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
(encoding==UU_ENCODED) ? UUEncodeTable[0] : XXEncodeTable[0],
|
||||||
(char *) eolstring);
|
(char *) eolstring);
|
||||||
fprintf (outfile, "end%s", (char *) eolstring);
|
fprintf (outfile, "end%s", (char *) eolstring);
|
||||||
}
|
}
|
||||||
else if (encoding == YENC_ENCODED) {
|
else if (encoding == YENC_ENCODED) {
|
||||||
if (numparts != 1) {
|
if (numparts != 1) {
|
||||||
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
|
fprintf (outfile, "=yend size=%ld part=%d pcrc32=%08lx",
|
||||||
(part*linperfile*128) < progress.totsize ?
|
(part*linperfile*128) < progress.totsize ?
|
||||||
linperfile*128 : (progress.totsize-(part-1)*linperfile*128),
|
linperfile*128 : (progress.totsize-(part-1)*linperfile*128),
|
||||||
part,
|
part,
|
||||||
pcrc);
|
pcrc);
|
||||||
@ -1465,7 +1465,7 @@ UUEncodeToFile (FILE *infile, char *infname, int encoding,
|
|||||||
progress.totsize);
|
progress.totsize);
|
||||||
}
|
}
|
||||||
if (feof (theifile))
|
if (feof (theifile))
|
||||||
fprintf (outfile, " crc32=%08lx", crc);
|
fprintf (outfile, " crc32=%08lx", crc);
|
||||||
fprintf (outfile, "%s", (char *) eolstring);
|
fprintf (outfile, "%s", (char *) eolstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1588,7 +1588,7 @@ UUE_PrepSingleExt (FILE *outfile, FILE *infile,
|
|||||||
|
|
||||||
res = UUEncodeToStream (outfile, infile, infname, encoding,
|
res = UUEncodeToStream (outfile, infile, infname, encoding,
|
||||||
outfname, filemode);
|
outfname, filemode);
|
||||||
|
|
||||||
_FP_free (subline);
|
_FP_free (subline);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -1660,7 +1660,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
|
|||||||
}
|
}
|
||||||
if (linperfile <= 0)
|
if (linperfile <= 0)
|
||||||
numparts = 1;
|
numparts = 1;
|
||||||
else
|
else
|
||||||
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
|
numparts = (int) (((long)finfo.st_size+(linperfile*bpl[encoding]-1))/
|
||||||
(linperfile*bpl[encoding]));
|
(linperfile*bpl[encoding]));
|
||||||
|
|
||||||
@ -1741,7 +1741,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (subject)
|
if (subject)
|
||||||
sprintf (subline, "%s (%03d/%03d) - [ %s ]",
|
sprintf (subline, "%s (%03d/%03d) - [ %s ]",
|
||||||
subject, partno, numparts, oname);
|
subject, partno, numparts, oname);
|
||||||
else
|
else
|
||||||
sprintf (subline, "[ %s ] (%03d/%03d)",
|
sprintf (subline, "[ %s ] (%03d/%03d)",
|
||||||
@ -1771,7 +1771,7 @@ UUE_PrepPartialExt (FILE *outfile, FILE *infile,
|
|||||||
fprintf (outfile, "\tid=\"%s\"%s",
|
fprintf (outfile, "\tid=\"%s\"%s",
|
||||||
mimeid, (char *) eolstring);
|
mimeid, (char *) eolstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (outfile, "%s", (char *) eolstring);
|
fprintf (outfile, "%s", (char *) eolstring);
|
||||||
|
|
||||||
res = UUEncodePartial (outfile, theifile,
|
res = UUEncodePartial (outfile, theifile,
|
||||||
|
@ -225,7 +225,7 @@ UUBrokenByNetscape (char *string)
|
|||||||
* Try to repair a Netscape-corrupted line of data.
|
* Try to repair a Netscape-corrupted line of data.
|
||||||
* This must only be called on corrupted lines, since non-Netscape
|
* This must only be called on corrupted lines, since non-Netscape
|
||||||
* data may even _get_ corrupted by this procedure.
|
* data may even _get_ corrupted by this procedure.
|
||||||
*
|
*
|
||||||
* Some checks are included multiply to speed up the procedure. For
|
* Some checks are included multiply to speed up the procedure. For
|
||||||
* example: (*p1!='<' || strnicmp(p1,"</a>",4)). If the first expression
|
* example: (*p1!='<' || strnicmp(p1,"</a>",4)). If the first expression
|
||||||
* becomes true, the costly function isn't called :-)
|
* becomes true, the costly function isn't called :-)
|
||||||
@ -265,7 +265,7 @@ UUNetscapeCollapse (char *string)
|
|||||||
while (*p1) {
|
while (*p1) {
|
||||||
if (*p1 == '<') {
|
if (*p1 == '<') {
|
||||||
if ((_FP_strnicmp (p1, "<ahref=", 7) == 0 ||
|
if ((_FP_strnicmp (p1, "<ahref=", 7) == 0 ||
|
||||||
_FP_strnicmp (p1, "<a href=",8) == 0) &&
|
_FP_strnicmp (p1, "<a href=",8) == 0) &&
|
||||||
(_FP_strstr (p1, "</a>") != 0 || _FP_strstr (p1, "</A>") != 0)) {
|
(_FP_strstr (p1, "</a>") != 0 || _FP_strstr (p1, "</A>") != 0)) {
|
||||||
while (*p1 && *p1!='>') p1++;
|
while (*p1 && *p1!='>') p1++;
|
||||||
if (*p1=='\0' || *(p1+1)!='<') return 0;
|
if (*p1=='\0' || *(p1+1)!='<') return 0;
|
||||||
@ -635,20 +635,20 @@ UUDecodeLine (char *s, char *d, int method)
|
|||||||
|
|
||||||
if(i-- > 0)
|
if(i-- > 0)
|
||||||
d[count++] = c;
|
d[count++] = c;
|
||||||
|
|
||||||
cc <<= 4;
|
cc <<= 4;
|
||||||
c = table[ACAST(*s++)];
|
c = table[ACAST(*s++)];
|
||||||
cc |= (c >> 2);
|
cc |= (c >> 2);
|
||||||
|
|
||||||
if(i-- > 0)
|
if(i-- > 0)
|
||||||
d[count++] = cc;
|
d[count++] = cc;
|
||||||
|
|
||||||
c <<= 6;
|
c <<= 6;
|
||||||
c |= table[ACAST(*s++)];
|
c |= table[ACAST(*s++)];
|
||||||
|
|
||||||
if(i-- > 0)
|
if(i-- > 0)
|
||||||
d[count++] = c;
|
d[count++] = c;
|
||||||
|
|
||||||
j -= 4;
|
j -= 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -748,7 +748,7 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state,
|
|||||||
|
|
||||||
uulboundary = -1;
|
uulboundary = -1;
|
||||||
|
|
||||||
while (!feof (datain) &&
|
while (!feof (datain) &&
|
||||||
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
||||||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
||||||
if (_FP_fgets (line, 255, datain) == NULL)
|
if (_FP_fgets (line, 255, datain) == NULL)
|
||||||
@ -822,7 +822,7 @@ UUDecodeQP (FILE *datain, FILE *dataout, int *state,
|
|||||||
* encapsulation line is conceptually attached to the boundary.
|
* encapsulation line is conceptually attached to the boundary.
|
||||||
* So if the part ends here, don't print a line break"
|
* So if the part ends here, don't print a line break"
|
||||||
*/
|
*/
|
||||||
if (val && (!feof (datain) &&
|
if (val && (!feof (datain) &&
|
||||||
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
||||||
(!(flags&FL_PROPER) && uu_fast_scanning))))
|
(!(flags&FL_PROPER) && uu_fast_scanning))))
|
||||||
fprintf (dataout, "%s\n", p1);
|
fprintf (dataout, "%s\n", p1);
|
||||||
@ -845,7 +845,7 @@ UUDecodePT (FILE *datain, FILE *dataout, int *state,
|
|||||||
|
|
||||||
uulboundary = -1;
|
uulboundary = -1;
|
||||||
|
|
||||||
while (!feof (datain) &&
|
while (!feof (datain) &&
|
||||||
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
(ftell(datain)<maxpos || flags&FL_TOEND ||
|
||||||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
||||||
if (_FP_fgets (line, 255, datain) == NULL)
|
if (_FP_fgets (line, 255, datain) == NULL)
|
||||||
@ -941,7 +941,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
*state = BEGIN;
|
*state = BEGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!feof (datain) && *state != DONE &&
|
while (!feof (datain) && *state != DONE &&
|
||||||
(ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 ||
|
(ftell(datain)<maxpos || flags&FL_TOEND || maxpos==-1 ||
|
||||||
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
(!(flags&FL_PROPER) && uu_fast_scanning))) {
|
||||||
if (_FP_fgets (line, 299, datain) == NULL)
|
if (_FP_fgets (line, 299, datain) == NULL)
|
||||||
@ -971,7 +971,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
vlc = 0;
|
vlc = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Busy Polls
|
* Busy Polls
|
||||||
*/
|
*/
|
||||||
@ -1061,7 +1061,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
if ((ptr = _FP_strstr (line, " end=")) == NULL) {
|
if ((ptr = _FP_strstr (line, " end=")) == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
yepartends = atoi (ptr + 5);
|
yepartends = atoi (ptr + 5);
|
||||||
}
|
}
|
||||||
tf = 1;
|
tf = 1;
|
||||||
@ -1070,7 +1070,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
else {
|
else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tc = tf = vlc = 0;
|
tc = tf = vlc = 0;
|
||||||
lc[0] = lc[1] = 0;
|
lc[0] = lc[1] = 0;
|
||||||
}
|
}
|
||||||
@ -1111,7 +1111,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
{
|
{
|
||||||
size_t size = atol(ptr + 6);
|
size_t size = atol(ptr + 6);
|
||||||
if (size != yepartsize && yefilesize != -1) {
|
if (size != yepartsize && yefilesize != -1) {
|
||||||
if (size != yefilesize)
|
if (size != (size_t)yefilesize)
|
||||||
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
|
UUMessage (uunconc_id, __LINE__, UUMSG_WARNING,
|
||||||
uustring (S_PSIZE_MISMATCH), progress.curfile,
|
uustring (S_PSIZE_MISMATCH), progress.curfile,
|
||||||
progress.partno, yepartsize, size);
|
progress.partno, yepartsize, size);
|
||||||
@ -1226,7 +1226,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
|
|||||||
if (*state == DONE ||
|
if (*state == DONE ||
|
||||||
(*state == DATA && method == B64ENCODED &&
|
(*state == DATA && method == B64ENCODED &&
|
||||||
vflag == B64ENCODED && (flags&FL_PROPER || haddh))) {
|
vflag == B64ENCODED && (flags&FL_PROPER || haddh))) {
|
||||||
for (tf=0; tf<tc; tf++)
|
for (tf=0; tf<tc; tf++)
|
||||||
count += UUDecodeLine (save[tf], oline + count, method);
|
count += UUDecodeLine (save[tf], oline + count, method);
|
||||||
if (count) {
|
if (count) {
|
||||||
if (method == BH_ENCODED) {
|
if (method == BH_ENCODED) {
|
||||||
@ -1345,7 +1345,7 @@ UUDecode (uulist *data)
|
|||||||
progress.numparts = (iter->partno)?iter->partno:1;
|
progress.numparts = (iter->partno)?iter->partno:1;
|
||||||
iter = iter->NEXT;
|
iter = iter->NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* let's rock!
|
* let's rock!
|
||||||
*/
|
*/
|
||||||
@ -1411,7 +1411,7 @@ UUDecode (uulist *data)
|
|||||||
iter = iter->NEXT;
|
iter = iter->NEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == DATA &&
|
if (state == DATA &&
|
||||||
(data->uudet == B64ENCODED || data->uudet == QP_ENCODED ||
|
(data->uudet == B64ENCODED || data->uudet == QP_ENCODED ||
|
||||||
data->uudet == PT_ENCODED))
|
data->uudet == PT_ENCODED))
|
||||||
state = DONE; /* assume we're done */
|
state = DONE; /* assume we're done */
|
||||||
|
Reference in New Issue
Block a user