* umsdos filename patch
@ 1993-12-09 21:24 Chris Hall
0 siblings, 0 replies; only message in thread
From: Chris Hall @ 1993-12-09 21:24 UTC (permalink / raw)
Currently umsdos can create files that msdos doesn't like, because
they contain invalid characters (e.g. the file c++ doesn't have its
name translated, and msdos doesn't like a + in a filename). This
patch should fix that by converting invalid characters to #s. It also
adds some more device driver names to the current list.
Chris Hall
_______cut here_______
*** linux/fs/umsdos/mangle.org Tue Nov 16 00:00:16 1993
--- linux/fs/umsdos/mangle.c Mon Dec 6 04:47:54 1993
***************
*** 90,95 ****
--- 90,96 ----
int len,
struct umsdos_info *info)
{
+ static const char *badchars="\"*+,/:;<=>?[\\]|~";
int ret = -ENAMETOOLONG;
if (len <= sizeof(info->entry.name)){
const char *pt = fname;
***************
*** 97,102 ****
--- 98,104 ----
const char *lastpt=NULL; /* Last place we see a . in fname */
int nbpt = 0; /* Number of . in fname */
int upper = 0;
+ int inv_char = 0; /* Invalid characters for a dos filename */
int msdos_len = len;
int base_len;
while (pt < endpt){
***************
*** 105,114 ****
--- 107,119 ----
lastpt = pt;
}else if (*pt >= 'A' && *pt <= 'Z'){
upper = 1;
+ }else if (*pt < '!' || *pt > '~' || (strchr(badchars,*pt) != NULL)){
+ inv_char++;
}
pt++;
}
if (upper
+ || inv_char
|| (nbpt == 0 && len > 8)
|| (nbpt == 1
&& ((int)(lastpt - fname) > 8 || (int)(pt-lastpt) > 4))
***************
*** 139,144 ****
--- 144,151 ----
*pt = '_';
}else if (isupper(*pt)){
*pt += 'a' - 'A';
+ }else if (*pt < '!' || *pt > '~' || (strchr(badchars,*pt) != NULL)){
+ *pt = '#';
}
}
*pt = '\0';
***************
*** 155,161 ****
info->msdos_reject = 0;
}
base_len = nbpt == 1 ? (int)(lastpt - fname) : len;
! if (nbpt <= 1 && (base_len == 3 || base_len == 4)){
/* #Specification: file name / MSDOS devices / mangling
To avoid unreachable file from MsDOS, any MsDOS conforming
file with a basename equal to one of the MsDOS pseudo
--- 162,168 ----
info->msdos_reject = 0;
}
base_len = nbpt == 1 ? (int)(lastpt - fname) : len;
! if (nbpt <= 1 && (base_len == 3 || base_len == 4 || base_len == 6 || base_len == 8)){
/* #Specification: file name / MSDOS devices / mangling
To avoid unreachable file from MsDOS, any MsDOS conforming
file with a basename equal to one of the MsDOS pseudo
***************
*** 172,182 ****
mangled file name.
Here is the list of DOS pseudo devices:
"prn","con",
"lpt1","lpt2","lpt3","lpt4",
"com1","com2","com3","com4",
! "aux"
Is there one missing ?
*/
--- 179,197 ----
mangled file name.
Here is the list of DOS pseudo devices:
+ And some standard ones for common dos programs:
+ "emmxxxx0","xmsxxxx0","setverxx"
+
+
"prn","con",
"lpt1","lpt2","lpt3","lpt4",
"com1","com2","com3","com4",
! "aux","clock$",
!
! And some standard ones for common dos programs:
!
! "emmxxxx0","xmsxxxx0","setverxx"
Is there one missing ?
*/
***************
*** 184,190 ****
"prn","con",
"lpt1","lpt2","lpt3","lpt4",
"com1","com2","com3","com4",
! "aux"
};
char basen[9];
char *ptbasen = basen;
--- 199,206 ----
"prn","con",
"lpt1","lpt2","lpt3","lpt4",
"com1","com2","com3","com4",
! "aux","clock$",
! "emmxxxx0","xmsxxxx0","setverxx"
};
char basen[9];
char *ptbasen = basen;
***************
*** 199,206 ****
for (i=0; i<sizeof(tbdev)/sizeof(tbdev[0]); i++){
if (strcmp(basen,tbdev[i])==0){
info->fake.fname[0] = '-';
! strcpy (info->fake.fname+1,basen);
msdos_len = (int)(ptbasen - basen) + 1;
info->msdos_reject = 1;
break;
}
--- 215,223 ----
for (i=0; i<sizeof(tbdev)/sizeof(tbdev[0]); i++){
if (strcmp(basen,tbdev[i])==0){
info->fake.fname[0] = '-';
! strncpy (info->fake.fname+1,basen,9);
msdos_len = (int)(ptbasen - basen) + 1;
+ if (msdos_len > 8) msdos_len=8;
info->msdos_reject = 1;
break;
}
--
Mail submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
PLEASE remember Keywords: and a short description of the software.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-12-09 21:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-12-09 21:24 umsdos filename patch Chris Hall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox