Mercurial > emacs
comparison src/fileio.c @ 15324:6fd4e01fd332
(DRIVE_LETTER): [DOS_NT] New macro.
(expand_file_name): Apply DRIVE_LETTER macro to drive names.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 03 Jun 1996 21:16:17 +0000 |
parents | 0fad77a676b7 |
children | 26b996fc0cfb |
comparison
equal
deleted
inserted
replaced
15323:af013b84d1ad | 15324:6fd4e01fd332 |
---|---|
100 } while (0) | 100 } while (0) |
101 /* On Windows, drive letters must be alphabetic - on DOS, the Netware | 101 /* On Windows, drive letters must be alphabetic - on DOS, the Netware |
102 redirector allows the six letters between 'Z' and 'a' as well. */ | 102 redirector allows the six letters between 'Z' and 'a' as well. */ |
103 #ifdef MSDOS | 103 #ifdef MSDOS |
104 #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') | 104 #define IS_DRIVE(x) ((x) >= 'A' && (x) <= 'z') |
105 #define DRIVE_LETTER(x) (x) | |
105 #endif | 106 #endif |
106 #ifdef WINDOWSNT | 107 #ifdef WINDOWSNT |
107 #define IS_DRIVE(x) isalpha (x) | 108 #define IS_DRIVE(x) isalpha (x) |
109 extern Lisp_Object Vwin32_downcase_file_names; | |
110 #define DRIVE_LETTER(x) (NILP (Vwin32_downcase_file_names) ? (x) : tolower (x)) | |
108 #endif | 111 #endif |
109 #endif | 112 #endif |
110 | 113 |
111 #ifdef VMS | 114 #ifdef VMS |
112 #include <file.h> | 115 #include <file.h> |
1063 #endif | 1066 #endif |
1064 /* drive must be set, so this is okay */ | 1067 /* drive must be set, so this is okay */ |
1065 if (strcmp (nm - 2, XSTRING (name)->data) != 0) | 1068 if (strcmp (nm - 2, XSTRING (name)->data) != 0) |
1066 { | 1069 { |
1067 name = make_string (nm - 2, p - nm + 2); | 1070 name = make_string (nm - 2, p - nm + 2); |
1068 XSTRING (name)->data[0] = drive; | 1071 XSTRING (name)->data[0] = DRIVE_LETTER (drive); |
1069 XSTRING (name)->data[1] = ':'; | 1072 XSTRING (name)->data[1] = ':'; |
1070 } | 1073 } |
1071 return name; | 1074 return name; |
1072 #else /* not DOS_NT */ | 1075 #else /* not DOS_NT */ |
1073 if (nm == XSTRING (name)->data) | 1076 if (nm == XSTRING (name)->data) |
1157 } | 1160 } |
1158 if (!newdir) | 1161 if (!newdir) |
1159 { | 1162 { |
1160 /* Either nm starts with /, or drive isn't mounted. */ | 1163 /* Either nm starts with /, or drive isn't mounted. */ |
1161 newdir = alloca (4); | 1164 newdir = alloca (4); |
1162 newdir[0] = drive; | 1165 newdir[0] = DRIVE_LETTER (drive); |
1163 newdir[1] = ':'; | 1166 newdir[1] = ':'; |
1164 newdir[2] = '/'; | 1167 newdir[2] = '/'; |
1165 newdir[3] = 0; | 1168 newdir[3] = 0; |
1166 } | 1169 } |
1167 } | 1170 } |
1405 if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1]))) | 1408 if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1]))) |
1406 #endif /* WINDOWSNT */ | 1409 #endif /* WINDOWSNT */ |
1407 { | 1410 { |
1408 if (!drive) abort (); | 1411 if (!drive) abort (); |
1409 target -= 2; | 1412 target -= 2; |
1410 target[0] = drive; | 1413 target[0] = DRIVE_LETTER (drive); |
1411 target[1] = ':'; | 1414 target[1] = ':'; |
1412 } | 1415 } |
1413 CORRECT_DIR_SEPS (target); | 1416 CORRECT_DIR_SEPS (target); |
1414 #endif /* DOS_NT */ | 1417 #endif /* DOS_NT */ |
1415 | 1418 |