diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c index 50abfd8988b..5814e2794e5 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -382,8 +382,11 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.") | |||
| 382 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' | 382 | && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' |
| 383 | #endif /* VMS */ | 383 | #endif /* VMS */ |
| 384 | #ifdef DOS_NT | 384 | #ifdef DOS_NT |
| 385 | /* only recognise drive specifier at beginning */ | 385 | /* only recognise drive specifier at the beginning */ |
| 386 | && !(p[-1] == ':' && p == beg + 2) | 386 | && !(p[-1] == ':' |
| 387 | /* handle the "/:d:foo" and "/:foo" cases correctly */ | ||
| 388 | && ((p == beg + 2 && !IS_DIRECTORY_SEP (*beg)) | ||
| 389 | || (p == beg + 4 && IS_DIRECTORY_SEP (*beg)))) | ||
| 387 | #endif | 390 | #endif |
| 388 | ) p--; | 391 | ) p--; |
| 389 | 392 | ||
| @@ -391,11 +394,20 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.") | |||
| 391 | return Qnil; | 394 | return Qnil; |
| 392 | #ifdef DOS_NT | 395 | #ifdef DOS_NT |
| 393 | /* Expansion of "c:" to drive and default directory. */ | 396 | /* Expansion of "c:" to drive and default directory. */ |
| 394 | if (p == beg + 2 && beg[1] == ':') | 397 | if (p[-1] == ':') |
| 395 | { | 398 | { |
| 396 | /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */ | 399 | /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */ |
| 397 | unsigned char *res = alloca (MAXPATHLEN + 1); | 400 | unsigned char *res = alloca (MAXPATHLEN + 1); |
| 398 | if (getdefdir (toupper (*beg) - 'A' + 1, res)) | 401 | unsigned char *r = res; |
| 402 | |||
| 403 | if (p == beg + 4 && IS_DIRECTORY_SEP (*beg) && beg[1] == ':') | ||
| 404 | { | ||
| 405 | strncpy (res, beg, 2); | ||
| 406 | beg += 2; | ||
| 407 | r += 2; | ||
| 408 | } | ||
| 409 | |||
| 410 | if (getdefdir (toupper (*beg) - 'A' + 1, r)) | ||
| 399 | { | 411 | { |
| 400 | if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) | 412 | if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) |
| 401 | strcat (res, "/"); | 413 | strcat (res, "/"); |
| @@ -440,7 +452,9 @@ or the entire name if it contains no slash.") | |||
| 440 | #endif /* VMS */ | 452 | #endif /* VMS */ |
| 441 | #ifdef DOS_NT | 453 | #ifdef DOS_NT |
| 442 | /* only recognise drive specifier at beginning */ | 454 | /* only recognise drive specifier at beginning */ |
| 443 | && !(p[-1] == ':' && p == beg + 2) | 455 | && !(p[-1] == ':' |
| 456 | /* handle the "/:d:foo" case correctly */ | ||
| 457 | && (p == beg + 2 || (p == beg + 4 && IS_DIRECTORY_SEP (*beg)))) | ||
| 444 | #endif | 458 | #endif |
| 445 | ) | 459 | ) |
| 446 | p--; | 460 | p--; |