comparison src/fileio.c @ 316:512e409c26a2 r21-0b56

Import from CVS: tag r21-0b56
author cvs
date Mon, 13 Aug 2007 10:44:46 +0200
parents d1b52dcaa789
children 7c94d56991e1
comparison
equal deleted inserted replaced
315:5e87bc5b1ee4 316:512e409c26a2
452 { 452 {
453 /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */ 453 /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */
454 Bufbyte *res = alloca (MAXPATHLEN + 1); 454 Bufbyte *res = alloca (MAXPATHLEN + 1);
455 if (getdefdir (toupper (*beg) - 'A' + 1, res)) 455 if (getdefdir (toupper (*beg) - 'A' + 1, res))
456 { 456 {
457 if (!IS_DIRECTORY_SEP (res[strlen ((char *) res) - 1])) 457 char *c=((char *) res) + strlen ((char *) res);
458 strcat ((char *) res, "/"); 458 if (!IS_DIRECTORY_SEP (*c))
459 {
460 *c++ = DIRECTORY_SEP;
461 *c = '\0';
462 }
459 beg = res; 463 beg = res;
460 p = beg + strlen ((char *) beg); 464 p = beg + strlen ((char *) beg);
461 } 465 }
462 } 466 }
463 CORRECT_DIR_SEPS (beg);
464 #endif /* WINDOWSNT */ 467 #endif /* WINDOWSNT */
465 return make_string (beg, p - beg); 468 return make_string (beg, p - beg);
466 } 469 }
467 470
468 DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, 1, 1, 0, /* 471 DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, 1, 1, 0, /*
542 { 545 {
543 out[size] = DIRECTORY_SEP; 546 out[size] = DIRECTORY_SEP;
544 out[size + 1] = '\0'; 547 out[size + 1] = '\0';
545 } 548 }
546 } 549 }
547 #ifdef WINDOWSNT
548 CORRECT_DIR_SEPS (out);
549 #endif
550 return out; 550 return out;
551 } 551 }
552 552
553 DEFUN ("file-name-as-directory", Ffile_name_as_directory, 1, 1, 0, /* 553 DEFUN ("file-name-as-directory", Ffile_name_as_directory, 1, 1, 0, /*
554 Return a string representing file FILENAME interpreted as a directory. 554 Return a string representing file FILENAME interpreted as a directory.
606 && !IS_ANY_SEP (dst[slen - 2]) 606 && !IS_ANY_SEP (dst[slen - 2])
607 #endif /* WINDOWSNT */ 607 #endif /* WINDOWSNT */
608 ) 608 )
609 dst[slen - 1] = 0; 609 dst[slen - 1] = 0;
610 #endif /* APOLLO */ 610 #endif /* APOLLO */
611 #ifdef WINDOWSNT
612 CORRECT_DIR_SEPS (dst);
613 #endif /* WINDOWSNT */
614 return 1; 611 return 1;
615 } 612 }
616 613
617 DEFUN ("directory-file-name", Fdirectory_file_name, 1, 1, 0, /* 614 DEFUN ("directory-file-name", Fdirectory_file_name, 1, 1, 0, /*
618 Return the file name of the directory named DIR. 615 Return the file name of the directory named DIR.