Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 48:56c54cf7c5b6 r19-16b90
Import from CVS: tag r19-16b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:56:04 +0200 |
parents | 6a22abad6937 |
children | ee648375d8d6 |
comparison
equal
deleted
inserted
replaced
47:11c6df210d7f | 48:56c54cf7c5b6 |
---|---|
408 Given a Unix syntax file name, returns a string ending in slash; | 408 Given a Unix syntax file name, returns a string ending in slash; |
409 on VMS, perhaps instead a string ending in `:', `]' or `>'. | 409 on VMS, perhaps instead a string ending in `:', `]' or `>'. |
410 */ | 410 */ |
411 (file)) | 411 (file)) |
412 { | 412 { |
413 /* This function can call lisp */ | 413 /* This function can GC. GC checked 1997.04.06. */ |
414 Bufbyte *beg; | 414 Bufbyte *beg; |
415 Bufbyte *p; | 415 Bufbyte *p; |
416 Lisp_Object handler; | 416 Lisp_Object handler; |
417 | 417 |
418 CHECK_STRING (file); | 418 CHECK_STRING (file); |
476 this is everything after the last slash, | 476 this is everything after the last slash, |
477 or the entire name if it contains no slash. | 477 or the entire name if it contains no slash. |
478 */ | 478 */ |
479 (file)) | 479 (file)) |
480 { | 480 { |
481 /* This function can call lisp */ | 481 /* This function can GC. GC checked 1997.04.06. */ |
482 Bufbyte *beg, *p, *end; | 482 Bufbyte *beg, *p, *end; |
483 Lisp_Object handler; | 483 Lisp_Object handler; |
484 | 484 |
485 CHECK_STRING (file); | 485 CHECK_STRING (file); |
486 | 486 |
512 The `call-process' and `start-process' functions use this function to | 512 The `call-process' and `start-process' functions use this function to |
513 get a current directory to run processes in. | 513 get a current directory to run processes in. |
514 */ | 514 */ |
515 (filename)) | 515 (filename)) |
516 { | 516 { |
517 /* This function can call lisp */ | 517 /* This function can GC. GC checked 1997.04.06. */ |
518 Lisp_Object handler; | 518 Lisp_Object handler; |
519 | 519 |
520 /* If the file name has special constructs in it, | 520 /* If the file name has special constructs in it, |
521 call the corresponding file handler. */ | 521 call the corresponding file handler. */ |
522 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory); | 522 handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory); |
612 For a Unix-syntax file name, just appends a slash. | 612 For a Unix-syntax file name, just appends a slash. |
613 On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. | 613 On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc. |
614 */ | 614 */ |
615 (file)) | 615 (file)) |
616 { | 616 { |
617 /* This function can call lisp */ | 617 /* This function can GC. GC checked 1997.04.06. */ |
618 char *buf; | 618 char *buf; |
619 Lisp_Object handler; | 619 Lisp_Object handler; |
620 | 620 |
621 CHECK_STRING (file); | 621 CHECK_STRING (file); |
622 | 622 |
798 On VMS, given a VMS-syntax directory name such as \"[X.Y]\", | 798 On VMS, given a VMS-syntax directory name such as \"[X.Y]\", |
799 it returns a file name such as \"[X]Y.DIR.1\". | 799 it returns a file name such as \"[X]Y.DIR.1\". |
800 */ | 800 */ |
801 (directory)) | 801 (directory)) |
802 { | 802 { |
803 /* This function can call lisp */ | 803 /* This function can GC. GC checked 1997.04.06. */ |
804 char *buf; | 804 char *buf; |
805 Lisp_Object handler; | 805 Lisp_Object handler; |
806 | 806 |
807 CHECK_STRING (directory); | 807 CHECK_STRING (directory); |
808 | 808 |
866 An initial `~USER/' expands to USER's home directory. | 866 An initial `~USER/' expands to USER's home directory. |
867 See also the function `substitute-in-file-name'. | 867 See also the function `substitute-in-file-name'. |
868 */ | 868 */ |
869 (name, defalt)) | 869 (name, defalt)) |
870 { | 870 { |
871 /* This function can call lisp */ | 871 /* This function can GC. GC checked 1997.04.06. */ |
872 Bufbyte *nm; | 872 Bufbyte *nm; |
873 | 873 |
874 Bufbyte *newdir, *p, *o; | 874 Bufbyte *newdir, *p, *o; |
875 int tlen; | 875 int tlen; |
876 Bufbyte *target; | 876 Bufbyte *target; |
888 int drive = -1; | 888 int drive = -1; |
889 int relpath = 0; | 889 int relpath = 0; |
890 Bufbyte *tmp, *defdir; | 890 Bufbyte *tmp, *defdir; |
891 #endif /* DOS_NT */ | 891 #endif /* DOS_NT */ |
892 Lisp_Object handler; | 892 Lisp_Object handler; |
893 struct gcpro gcpro1; | |
894 | 893 |
895 CHECK_STRING (name); | 894 CHECK_STRING (name); |
896 | 895 |
897 /* If the file name has special constructs in it, | 896 /* If the file name has special constructs in it, |
898 call the corresponding file handler. */ | 897 call the corresponding file handler. */ |
1396 No component of the resulting pathname will be a symbolic link, as | 1395 No component of the resulting pathname will be a symbolic link, as |
1397 in the realpath() function. | 1396 in the realpath() function. |
1398 */ | 1397 */ |
1399 (filename, defalt)) | 1398 (filename, defalt)) |
1400 { | 1399 { |
1401 /* This function can call lisp */ | 1400 /* This function can GC. GC checked 1997.04.06. */ |
1402 struct gcpro gcpro1; | |
1403 Lisp_Object expanded_name; | 1401 Lisp_Object expanded_name; |
1404 Lisp_Object handler; | 1402 Lisp_Object handler; |
1403 struct gcpro gcpro1; | |
1405 | 1404 |
1406 CHECK_STRING (filename); | 1405 CHECK_STRING (filename); |
1407 | 1406 |
1408 expanded_name = Fexpand_file_name (filename, defalt); | 1407 expanded_name = Fexpand_file_name (filename, defalt); |
1409 | 1408 |
1523 On VMS, `$' substitution is not done; this function does little and only | 1522 On VMS, `$' substitution is not done; this function does little and only |
1524 duplicates what `expand-file-name' does. | 1523 duplicates what `expand-file-name' does. |
1525 */ | 1524 */ |
1526 (string)) | 1525 (string)) |
1527 { | 1526 { |
1528 /* This function can call lisp */ | 1527 /* This function can GC. GC checked 1997.04.06. */ |
1529 Bufbyte *nm; | 1528 Bufbyte *nm; |
1530 | 1529 |
1531 Bufbyte *s, *p, *o, *x, *endp; | 1530 Bufbyte *s, *p, *o, *x, *endp; |
1532 Bufbyte *target = 0; | 1531 Bufbyte *target = 0; |
1533 int total = 0; | 1532 int total = 0; |
1826 last-modified time as the old one. (This works on only some systems.) | 1825 last-modified time as the old one. (This works on only some systems.) |
1827 A prefix arg makes KEEP-TIME non-nil. | 1826 A prefix arg makes KEEP-TIME non-nil. |
1828 */ | 1827 */ |
1829 (filename, newname, ok_if_already_exists, keep_time)) | 1828 (filename, newname, ok_if_already_exists, keep_time)) |
1830 { | 1829 { |
1831 /* This function can call lisp */ | 1830 /* This function can GC. GC checked 1997.04.06. */ |
1832 int ifd, ofd, n; | 1831 int ifd, ofd, n; |
1833 char buf[16 * 1024]; | 1832 char buf[16 * 1024]; |
1834 struct stat st, out_st; | 1833 struct stat st, out_st; |
1835 Lisp_Object handler; | 1834 Lisp_Object handler; |
1836 int speccount = specpdl_depth (); | 1835 int speccount = specpdl_depth (); |
1992 DEFUN ("make-directory-internal", Fmake_directory_internal, 1, 1, 0, /* | 1991 DEFUN ("make-directory-internal", Fmake_directory_internal, 1, 1, 0, /* |
1993 Create a directory. One argument, a file name string. | 1992 Create a directory. One argument, a file name string. |
1994 */ | 1993 */ |
1995 (dirname)) | 1994 (dirname)) |
1996 { | 1995 { |
1997 /* This function can call lisp */ | 1996 /* This function can GC. GC checked 1997.04.06 */ |
1998 char dir [MAXPATHLEN]; | 1997 char dir [MAXPATHLEN]; |
1999 Lisp_Object handler; | 1998 Lisp_Object handler; |
2000 struct gcpro gcpro1; | 1999 struct gcpro gcpro1; |
2001 | 2000 |
2002 CHECK_STRING (dirname); | 2001 CHECK_STRING (dirname); |
2036 DEFUN ("delete-directory", Fdelete_directory, 1, 1, "FDelete directory: ", /* | 2035 DEFUN ("delete-directory", Fdelete_directory, 1, 1, "FDelete directory: ", /* |
2037 Delete a directory. One argument, a file name or directory name string. | 2036 Delete a directory. One argument, a file name or directory name string. |
2038 */ | 2037 */ |
2039 (dirname)) | 2038 (dirname)) |
2040 { | 2039 { |
2041 /* This function can call lisp */ | 2040 /* This function can GC. GC checked 1997.04.06. */ |
2042 Lisp_Object handler; | 2041 Lisp_Object handler; |
2043 struct gcpro gcpro1; | 2042 struct gcpro gcpro1; |
2044 | 2043 |
2045 CHECK_STRING (dirname); | 2044 CHECK_STRING (dirname); |
2046 | 2045 |
2063 Delete specified file. One argument, a file name string. | 2062 Delete specified file. One argument, a file name string. |
2064 If file has multiple names, it continues to exist with the other names. | 2063 If file has multiple names, it continues to exist with the other names. |
2065 */ | 2064 */ |
2066 (filename)) | 2065 (filename)) |
2067 { | 2066 { |
2068 /* This function can call lisp */ | 2067 /* This function can GC. GC checked 1997.04.06. */ |
2069 Lisp_Object handler; | 2068 Lisp_Object handler; |
2070 struct gcpro gcpro1; | 2069 struct gcpro gcpro1; |
2071 | 2070 |
2072 CHECK_STRING (filename); | 2071 CHECK_STRING (filename); |
2073 filename = Fexpand_file_name (filename, Qnil); | 2072 filename = Fexpand_file_name (filename, Qnil); |
2092 /* Delete file FILENAME, returning 1 if successful and 0 if failed. */ | 2091 /* Delete file FILENAME, returning 1 if successful and 0 if failed. */ |
2093 | 2092 |
2094 int | 2093 int |
2095 internal_delete_file (Lisp_Object filename) | 2094 internal_delete_file (Lisp_Object filename) |
2096 { | 2095 { |
2097 /* This function can call lisp */ | 2096 /* This function can GC. GC checked 1997.04.06. */ |
2098 return NILP (condition_case_1 (Qt, Fdelete_file, filename, | 2097 return NILP (condition_case_1 (Qt, Fdelete_file, filename, |
2099 internal_delete_file_1, Qnil)); | 2098 internal_delete_file_1, Qnil)); |
2100 } | 2099 } |
2101 | 2100 |
2102 DEFUN ("rename-file", Frename_file, 2, 3, | 2101 DEFUN ("rename-file", Frename_file, 2, 3, |
2108 A number as third arg means request confirmation if NEWNAME already exists. | 2107 A number as third arg means request confirmation if NEWNAME already exists. |
2109 This is what happens in interactive use with M-x. | 2108 This is what happens in interactive use with M-x. |
2110 */ | 2109 */ |
2111 (filename, newname, ok_if_already_exists)) | 2110 (filename, newname, ok_if_already_exists)) |
2112 { | 2111 { |
2113 /* This function can call lisp */ | 2112 /* This function can GC. GC checked 1997.04.06. */ |
2114 Lisp_Object handler; | 2113 Lisp_Object handler; |
2115 struct gcpro gcpro1, gcpro2; | 2114 struct gcpro gcpro1, gcpro2; |
2116 | 2115 |
2117 GCPRO2 (filename, newname); | 2116 GCPRO2 (filename, newname); |
2118 CHECK_STRING (filename); | 2117 CHECK_STRING (filename); |
2201 A number as third arg means request confirmation if NEWNAME already exists. | 2200 A number as third arg means request confirmation if NEWNAME already exists. |
2202 This is what happens in interactive use with M-x. | 2201 This is what happens in interactive use with M-x. |
2203 */ | 2202 */ |
2204 (filename, newname, ok_if_already_exists)) | 2203 (filename, newname, ok_if_already_exists)) |
2205 { | 2204 { |
2206 /* This function can call lisp */ | 2205 /* This function can GC. GC checked 1997.04.06. */ |
2207 Lisp_Object handler; | 2206 Lisp_Object handler; |
2208 struct gcpro gcpro1, gcpro2; | 2207 struct gcpro gcpro1, gcpro2; |
2209 | 2208 |
2210 GCPRO2 (filename, newname); | 2209 GCPRO2 (filename, newname); |
2211 CHECK_STRING (filename); | 2210 CHECK_STRING (filename); |
2258 A number as third arg means request confirmation if LINKNAME already exists. | 2257 A number as third arg means request confirmation if LINKNAME already exists. |
2259 This happens for interactive use with M-x. | 2258 This happens for interactive use with M-x. |
2260 */ | 2259 */ |
2261 (filename, linkname, ok_if_already_exists)) | 2260 (filename, linkname, ok_if_already_exists)) |
2262 { | 2261 { |
2263 /* This function can call lisp */ | 2262 /* This function can GC. GC checked 1997.06.04. */ |
2264 Lisp_Object handler; | 2263 Lisp_Object handler; |
2265 struct gcpro gcpro1, gcpro2; | 2264 struct gcpro gcpro1, gcpro2; |
2266 | 2265 |
2267 GCPRO2 (filename, linkname); | 2266 GCPRO2 (filename, linkname); |
2268 CHECK_STRING (filename); | 2267 CHECK_STRING (filename); |