diff options
| author | Richard M. Stallman | 1994-07-09 19:10:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-07-09 19:10:16 +0000 |
| commit | a5a1cc0608d5ca7a36c4551425ebef3d30df15ca (patch) | |
| tree | dbd97ae661a6e14fab49e8e2db915f66d2338be4 /src | |
| parent | 95227eb203372118f4e9d1318c3c003807f28cd8 (diff) | |
| download | emacs-a5a1cc0608d5ca7a36c4551425ebef3d30df15ca.tar.gz emacs-a5a1cc0608d5ca7a36c4551425ebef3d30df15ca.zip | |
(Ffile_name_directory, Ffile_name_nondirectory,
file_name_as_directory, directory_file_name, Fexpand_file_name,
Ffile_name_absolute_p, Fsubstitute_in_file_name) [MSDOS]:
Allow backslashed file names.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c index 1446eaf4033..7d907bc46d7 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -290,7 +290,7 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.") | |||
| 290 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' | 290 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' |
| 291 | #endif /* VMS */ | 291 | #endif /* VMS */ |
| 292 | #ifdef MSDOS | 292 | #ifdef MSDOS |
| 293 | && p[-1] != ':' | 293 | && p[-1] != ':' && p[-1] != '\\' |
| 294 | #endif | 294 | #endif |
| 295 | ) p--; | 295 | ) p--; |
| 296 | 296 | ||
| @@ -345,7 +345,7 @@ or the entire name if it contains no slash.") | |||
| 345 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' | 345 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' |
| 346 | #endif /* VMS */ | 346 | #endif /* VMS */ |
| 347 | #ifdef MSDOS | 347 | #ifdef MSDOS |
| 348 | && p[-1] != ':' | 348 | && p[-1] != ':' && p[-1] != '\\' |
| 349 | #endif | 349 | #endif |
| 350 | ) p--; | 350 | ) p--; |
| 351 | 351 | ||
| @@ -443,7 +443,7 @@ file_name_as_directory (out, in) | |||
| 443 | #else /* not VMS */ | 443 | #else /* not VMS */ |
| 444 | /* For Unix syntax, Append a slash if necessary */ | 444 | /* For Unix syntax, Append a slash if necessary */ |
| 445 | #ifdef MSDOS | 445 | #ifdef MSDOS |
| 446 | if (out[size] != ':' && out[size] != '/') | 446 | if (out[size] != ':' && out[size] != '/' && out[size] != '\\') |
| 447 | #else | 447 | #else |
| 448 | if (out[size] != '/') | 448 | if (out[size] != '/') |
| 449 | #endif | 449 | #endif |
| @@ -623,9 +623,11 @@ directory_file_name (src, dst) | |||
| 623 | But leave "/" unchanged; do not change it to "". */ | 623 | But leave "/" unchanged; do not change it to "". */ |
| 624 | strcpy (dst, src); | 624 | strcpy (dst, src); |
| 625 | if (slen > 1 | 625 | if (slen > 1 |
| 626 | && dst[slen - 1] == '/' | ||
| 627 | #ifdef MSDOS | 626 | #ifdef MSDOS |
| 627 | && (dst[slen - 1] == '/' || dst[slen - 1] == '/') | ||
| 628 | && dst[slen - 2] != ':' | 628 | && dst[slen - 2] != ':' |
| 629 | #else | ||
| 630 | && dst[slen - 1] == '/' | ||
| 629 | #endif | 631 | #endif |
| 630 | ) | 632 | ) |
| 631 | dst[slen - 1] = 0; | 633 | dst[slen - 1] = 0; |
| @@ -764,7 +766,10 @@ See also the function `substitute-in-file-name'.") | |||
| 764 | nm = XSTRING (name)->data; | 766 | nm = XSTRING (name)->data; |
| 765 | 767 | ||
| 766 | #ifdef MSDOS | 768 | #ifdef MSDOS |
| 767 | /* firstly, strip drive name. */ | 769 | /* First map all backslashes to slashes. */ |
| 770 | dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); | ||
| 771 | |||
| 772 | /* Now strip drive name. */ | ||
| 768 | { | 773 | { |
| 769 | unsigned char *colon = rindex (nm, ':'); | 774 | unsigned char *colon = rindex (nm, ':'); |
| 770 | if (colon) | 775 | if (colon) |
| @@ -1487,6 +1492,10 @@ duplicates what `expand-file-name' does.") | |||
| 1487 | CHECK_STRING (string, 0); | 1492 | CHECK_STRING (string, 0); |
| 1488 | 1493 | ||
| 1489 | nm = XSTRING (string)->data; | 1494 | nm = XSTRING (string)->data; |
| 1495 | #ifdef MSDOS | ||
| 1496 | dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); | ||
| 1497 | substituted = !strcmp (nm, XSTRING (string)->data); | ||
| 1498 | #endif | ||
| 1490 | endp = nm + XSTRING (string)->size; | 1499 | endp = nm + XSTRING (string)->size; |
| 1491 | 1500 | ||
| 1492 | /* If /~ or // appears, discard everything through first slash. */ | 1501 | /* If /~ or // appears, discard everything through first slash. */ |
| @@ -2139,7 +2148,7 @@ On Unix, this is a name starting with a `/' or a `~'.") | |||
| 2139 | && ptr[1] != '.') | 2148 | && ptr[1] != '.') |
| 2140 | #endif /* VMS */ | 2149 | #endif /* VMS */ |
| 2141 | #ifdef MSDOS | 2150 | #ifdef MSDOS |
| 2142 | || (*ptr != 0 && ptr[1] == ':' && ptr[2] == '/') | 2151 | || (*ptr != 0 && ptr[1] == ':' && (ptr[2] == '/' || ptr[2] == '\\')) |
| 2143 | #endif | 2152 | #endif |
| 2144 | ) | 2153 | ) |
| 2145 | return Qt; | 2154 | return Qt; |