Some improvements for recognizing filenames with tilde in the name
This commit is contained in:
parent
a2b356f113
commit
fdb527747e
@ -84,7 +84,7 @@ static char *nofname = "UNKNOWN";
|
|||||||
* special characters we allow an unquoted filename to have
|
* special characters we allow an unquoted filename to have
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char *fnchars = "._-~!";
|
char *uufnchars = "._-~!$@";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Policy for extracting a part number from the subject line.
|
* Policy for extracting a part number from the subject line.
|
||||||
@ -164,7 +164,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
iter++;
|
iter++;
|
||||||
count = length = alflag = 0;
|
count = length = alflag = 0;
|
||||||
while (iter[count] &&
|
while (iter[count] &&
|
||||||
(isalnum (iter[count]) || strchr (fnchars, iter[count])!=NULL)) {
|
(isalnum (iter[count]) || strchr (uufnchars, iter[count])!=NULL)) {
|
||||||
if (isalpha (iter[count]))
|
if (isalpha (iter[count]))
|
||||||
alflag++;
|
alflag++;
|
||||||
count++;
|
count++;
|
||||||
@ -201,7 +201,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
count = length = 0;
|
count = length = 0;
|
||||||
iter++;
|
iter++;
|
||||||
while (iter[count] &&
|
while (iter[count] &&
|
||||||
(isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL))
|
(isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL))
|
||||||
count++;
|
count++;
|
||||||
if (iter[count] == ' ' && length > 4) {
|
if (iter[count] == ' ' && length > 4) {
|
||||||
length = count;
|
length = count;
|
||||||
@ -229,7 +229,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((isalnum(*iter)||strchr(fnchars, *iter)!=NULL||
|
while ((isalnum(*iter)||strchr(uufnchars, *iter)!=NULL||
|
||||||
*iter=='/') && *iter && iter != ptonum && *iter != '.') {
|
*iter=='/') && *iter && iter != ptonum && *iter != '.') {
|
||||||
if (isalpha (*iter))
|
if (isalpha (*iter))
|
||||||
alflag = 1;
|
alflag = 1;
|
||||||
@ -263,7 +263,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
length += count + 1;
|
length += count + 1;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
while ((isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL||
|
while ((isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL||
|
||||||
iter[count]=='/') && iter[count] && iter[count] != '.')
|
iter[count]=='/') && iter[count] && iter[count] != '.')
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (iter[count] &&
|
while (iter[count] &&
|
||||||
(isalnum(iter[count])||strchr(fnchars, iter[count])!=NULL||
|
(isalnum(iter[count])||strchr(uufnchars, iter[count])!=NULL||
|
||||||
iter[count]=='/'))
|
iter[count]=='/'))
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ UUGetFileName (char *subject, char *ptonum, char *ptonend)
|
|||||||
while (*ptr && !isalpha (*ptr))
|
while (*ptr && !isalpha (*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
while ((isalnum(ptr[length])||strchr(fnchars,ptr[length])!=NULL||
|
while ((isalnum(ptr[length])||strchr(uufnchars,ptr[length])!=NULL||
|
||||||
ptr[length] == '/') &&
|
ptr[length] == '/') &&
|
||||||
ptr[length] && ptr+length!=part && ptr+length!=ptonum)
|
ptr[length] && ptr+length!=part && ptr+length!=ptonum)
|
||||||
length++;
|
length++;
|
||||||
|
@ -210,6 +210,8 @@ extern int uu_more_mime;
|
|||||||
extern char *uusavepath;
|
extern char *uusavepath;
|
||||||
extern char *uuencodeext;
|
extern char *uuencodeext;
|
||||||
|
|
||||||
|
extern char *uufnchars;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Encoding/Decoding tables
|
* Encoding/Decoding tables
|
||||||
*/
|
*/
|
||||||
|
@ -704,9 +704,7 @@ ScanData (FILE *datei, char *fname, int *errcode,
|
|||||||
ptr += 8;
|
ptr += 8;
|
||||||
while (isspace (*ptr)) ptr++;
|
while (isspace (*ptr)) ptr++;
|
||||||
p2 = ptr;
|
p2 = ptr;
|
||||||
while (isalnum(*p2) ||
|
while (isalnum(*p2) || (strchr(uufnchars, *p2)!=NULL))
|
||||||
*p2 == '.' || *p2=='_' || *p2 == '-' ||
|
|
||||||
*p2 == '!' || *p2=='@' || *p2 == '$')
|
|
||||||
p2++;
|
p2++;
|
||||||
c = *p2; *p2 = '\0';
|
c = *p2; *p2 = '\0';
|
||||||
if (p2 != ptr && result->filename == NULL)
|
if (p2 != ptr && result->filename == NULL)
|
||||||
|
Reference in New Issue
Block a user