comparison src/fileio.c @ 15313:0fad77a676b7

(Fexpand_file_name) [WINDOWSNT]: Don't strip trailing / when newdir is just "//". (Ffile_name_directory) [WINDOWSNT]: Return Qnil if filename is a partial UNC name such as "//foo".
author Richard M. Stallman <rms@gnu.org>
date Sat, 01 Jun 1996 02:23:06 +0000
parents b2c682fcd3ef
children 6fd4e01fd332
comparison
equal deleted inserted replaced
15312:d425f28aff41 15313:0fad77a676b7
346 #endif 346 #endif
347 ) p--; 347 ) p--;
348 348
349 if (p == beg) 349 if (p == beg)
350 return Qnil; 350 return Qnil;
351 #ifdef WINDOWSNT
352 /* We can consider the partial UNC name //machine to be a
353 directory name, but not just // on its own. */
354 if (p == beg + 1 && IS_DIRECTORY_SEP (p[-1]))
355 return Qnil;
356 #endif
351 #ifdef DOS_NT 357 #ifdef DOS_NT
352 /* Expansion of "c:" to drive and default directory. */ 358 /* Expansion of "c:" to drive and default directory. */
353 if (p == beg + 2 && beg[1] == ':') 359 if (p == beg + 2 && beg[1] == ':')
354 { 360 {
355 /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */ 361 /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */
1250 } 1256 }
1251 #endif /* DOS_NT */ 1257 #endif /* DOS_NT */
1252 1258
1253 if (newdir) 1259 if (newdir)
1254 { 1260 {
1255 /* Get rid of any slash at the end of newdir. */ 1261 /* Get rid of any slash at the end of newdir, unless newdir is
1262 just // (an incomplete UNC name). */
1256 length = strlen (newdir); 1263 length = strlen (newdir);
1257 if (IS_DIRECTORY_SEP (newdir[length - 1])) 1264 if (IS_DIRECTORY_SEP (newdir[length - 1])
1265 #ifdef WINDOWSNT
1266 && !(length == 2 && IS_DIRECTORY_SEP (newdir[0]))
1267 #endif
1268 )
1258 { 1269 {
1259 unsigned char *temp = (unsigned char *) alloca (length); 1270 unsigned char *temp = (unsigned char *) alloca (length);
1260 bcopy (newdir, temp, length - 1); 1271 bcopy (newdir, temp, length - 1);
1261 temp[length - 1] = 0; 1272 temp[length - 1] = 0;
1262 newdir = temp; 1273 newdir = temp;