Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 361:7347b34c275b r21-1-10
Import from CVS: tag r21-1-10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:58:40 +0200 |
parents | 8e84bee8ddd0 |
children | 972bbb6d6ca2 |
comparison
equal
deleted
inserted
replaced
360:0f00b38cfccb | 361:7347b34c275b |
---|---|
1372 goto toolong; | 1372 goto toolong; |
1373 resolved_path[rlen] = '/'; | 1373 resolved_path[rlen] = '/'; |
1374 resolved_path[rlen + 1] = 0; | 1374 resolved_path[rlen + 1] = 0; |
1375 rlen = rlen + 1; | 1375 rlen = rlen + 1; |
1376 } | 1376 } |
1377 return make_ext_string ((Bufbyte *) resolved_path, rlen, FORMAT_BINARY); | 1377 return make_ext_string ((Bufbyte *) resolved_path, rlen, FORMAT_FILENAME); |
1378 } | 1378 } |
1379 | 1379 |
1380 toolong: | 1380 toolong: |
1381 errno = ENAMETOOLONG; | 1381 errno = ENAMETOOLONG; |
1382 goto lose; | 1382 goto lose; |
2066 | 2066 |
2067 UNGCPRO; | 2067 UNGCPRO; |
2068 return Qnil; | 2068 return Qnil; |
2069 } | 2069 } |
2070 | 2070 |
2071 #ifdef S_IFLNK | |
2072 DEFUN ("make-symbolic-link", Fmake_symbolic_link, 2, 3, | 2071 DEFUN ("make-symbolic-link", Fmake_symbolic_link, 2, 3, |
2073 "FMake symbolic link to file: \nFMake symbolic link to file %s: \np", /* | 2072 "FMake symbolic link to file: \nFMake symbolic link to file %s: \np", /* |
2074 Make a symbolic link to FILENAME, named LINKNAME. Both args strings. | 2073 Make a symbolic link to FILENAME, named LINKNAME. Both args strings. |
2075 Signals a `file-already-exists' error if a file LINKNAME already exists | 2074 Signals a `file-already-exists' error if a file LINKNAME already exists |
2076 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. | 2075 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil. |
2078 This happens for interactive use with M-x. | 2077 This happens for interactive use with M-x. |
2079 */ | 2078 */ |
2080 (filename, linkname, ok_if_already_exists)) | 2079 (filename, linkname, ok_if_already_exists)) |
2081 { | 2080 { |
2082 /* This function can GC. GC checked 1997.06.04. */ | 2081 /* This function can GC. GC checked 1997.06.04. */ |
2082 /* XEmacs change: run handlers even if local machine doesn't have symlinks */ | |
2083 Lisp_Object handler; | 2083 Lisp_Object handler; |
2084 struct gcpro gcpro1, gcpro2; | 2084 struct gcpro gcpro1, gcpro2; |
2085 | 2085 |
2086 GCPRO2 (filename, linkname); | 2086 GCPRO2 (filename, linkname); |
2087 CHECK_STRING (filename); | 2087 CHECK_STRING (filename); |
2105 handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link); | 2105 handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link); |
2106 if (!NILP (handler)) | 2106 if (!NILP (handler)) |
2107 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, | 2107 RETURN_UNGCPRO (call4 (handler, Qmake_symbolic_link, filename, |
2108 linkname, ok_if_already_exists)); | 2108 linkname, ok_if_already_exists)); |
2109 | 2109 |
2110 #ifdef S_IFLNK | |
2110 if (NILP (ok_if_already_exists) | 2111 if (NILP (ok_if_already_exists) |
2111 || INTP (ok_if_already_exists)) | 2112 || INTP (ok_if_already_exists)) |
2112 barf_or_query_if_file_exists (linkname, "make it a link", | 2113 barf_or_query_if_file_exists (linkname, "make it a link", |
2113 INTP (ok_if_already_exists), 0); | 2114 INTP (ok_if_already_exists), 0); |
2114 | 2115 |
2117 (char *) XSTRING_DATA (linkname))) | 2118 (char *) XSTRING_DATA (linkname))) |
2118 { | 2119 { |
2119 report_file_error ("Making symbolic link", | 2120 report_file_error ("Making symbolic link", |
2120 list2 (filename, linkname)); | 2121 list2 (filename, linkname)); |
2121 } | 2122 } |
2123 #endif /* S_IFLNK */ | |
2124 | |
2122 UNGCPRO; | 2125 UNGCPRO; |
2123 return Qnil; | 2126 return Qnil; |
2124 } | 2127 } |
2125 #endif /* S_IFLNK */ | |
2126 | 2128 |
2127 #ifdef HPUX_NET | 2129 #ifdef HPUX_NET |
2128 | 2130 |
2129 DEFUN ("sysnetunam", Fsysnetunam, 2, 2, 0, /* | 2131 DEFUN ("sysnetunam", Fsysnetunam, 2, 2, 0, /* |
2130 Open a network connection to PATH using LOGIN as the login string. | 2132 Open a network connection to PATH using LOGIN as the login string. |
2347 Otherwise returns nil. | 2349 Otherwise returns nil. |
2348 */ | 2350 */ |
2349 (filename)) | 2351 (filename)) |
2350 { | 2352 { |
2351 /* This function can GC. GC checked 1997.04.10. */ | 2353 /* This function can GC. GC checked 1997.04.10. */ |
2354 /* XEmacs change: run handlers even if local machine doesn't have symlinks */ | |
2352 #ifdef S_IFLNK | 2355 #ifdef S_IFLNK |
2353 char *buf; | 2356 char *buf; |
2354 int bufsize; | 2357 int bufsize; |
2355 int valsize; | 2358 int valsize; |
2356 Lisp_Object val; | 2359 Lisp_Object val; |
2360 #endif | |
2357 Lisp_Object handler; | 2361 Lisp_Object handler; |
2358 struct gcpro gcpro1; | 2362 struct gcpro gcpro1; |
2359 | 2363 |
2360 CHECK_STRING (filename); | 2364 CHECK_STRING (filename); |
2361 filename = Fexpand_file_name (filename, Qnil); | 2365 filename = Fexpand_file_name (filename, Qnil); |
2366 handler = Ffind_file_name_handler (filename, Qfile_symlink_p); | 2370 handler = Ffind_file_name_handler (filename, Qfile_symlink_p); |
2367 UNGCPRO; | 2371 UNGCPRO; |
2368 if (!NILP (handler)) | 2372 if (!NILP (handler)) |
2369 return call2 (handler, Qfile_symlink_p, filename); | 2373 return call2 (handler, Qfile_symlink_p, filename); |
2370 | 2374 |
2375 #ifdef S_IFLNK | |
2371 bufsize = 100; | 2376 bufsize = 100; |
2372 while (1) | 2377 while (1) |
2373 { | 2378 { |
2374 buf = xnew_array_and_zero (char, bufsize); | 2379 buf = xnew_array_and_zero (char, bufsize); |
2375 valsize = readlink ((char *) XSTRING_DATA (filename), | 2380 valsize = readlink ((char *) XSTRING_DATA (filename), |
4200 DEFSUBR (Fmake_directory_internal); | 4205 DEFSUBR (Fmake_directory_internal); |
4201 DEFSUBR (Fdelete_directory); | 4206 DEFSUBR (Fdelete_directory); |
4202 DEFSUBR (Fdelete_file); | 4207 DEFSUBR (Fdelete_file); |
4203 DEFSUBR (Frename_file); | 4208 DEFSUBR (Frename_file); |
4204 DEFSUBR (Fadd_name_to_file); | 4209 DEFSUBR (Fadd_name_to_file); |
4205 #ifdef S_IFLNK | |
4206 DEFSUBR (Fmake_symbolic_link); | 4210 DEFSUBR (Fmake_symbolic_link); |
4207 #endif /* S_IFLNK */ | |
4208 #ifdef HPUX_NET | 4211 #ifdef HPUX_NET |
4209 DEFSUBR (Fsysnetunam); | 4212 DEFSUBR (Fsysnetunam); |
4210 #endif /* HPUX_NET */ | 4213 #endif /* HPUX_NET */ |
4211 DEFSUBR (Ffile_name_absolute_p); | 4214 DEFSUBR (Ffile_name_absolute_p); |
4212 DEFSUBR (Ffile_exists_p); | 4215 DEFSUBR (Ffile_exists_p); |