comparison src/fileio.c @ 284:558f606b08ae r21-0b40

Import from CVS: tag r21-0b40
author cvs
date Mon, 13 Aug 2007 10:34:13 +0200
parents 7df0dd720c89
children 57709be46d1b
comparison
equal deleted inserted replaced
283:fa3d41851a08 284:558f606b08ae
109 109
110 int disable_auto_save_when_buffer_shrinks; 110 int disable_auto_save_when_buffer_shrinks;
111 111
112 Lisp_Object Qfile_name_handler_alist; 112 Lisp_Object Qfile_name_handler_alist;
113 113
114 Lisp_Object Vpath_separator; 114 Lisp_Object Vdirectory_sep_char;
115 115
116 /* These variables describe handlers that have "already" had a chance 116 /* These variables describe handlers that have "already" had a chance
117 to handle the current operation. 117 to handle the current operation.
118 118
119 Vinhibit_file_name_handlers is a list of file name handlers. 119 Vinhibit_file_name_handlers is a list of file name handlers.
655 DEFUN ("make-temp-name", Fmake_temp_name, 1, 1, 0, /* 655 DEFUN ("make-temp-name", Fmake_temp_name, 1, 1, 0, /*
656 Generate temporary file name starting with PREFIX. 656 Generate temporary file name starting with PREFIX.
657 The Emacs process number forms part of the result, so there is no 657 The Emacs process number forms part of the result, so there is no
658 danger of generating a name being used by another process. 658 danger of generating a name being used by another process.
659 659
660 In addition, this function makes an attempt to choose a name which 660 In addition, this function makes an attempt to choose a name that
661 has no existing file. To make this work, PREFIX should be an 661 does not specify an existing file. To make this work, PREFIX should
662 absolute file name. 662 be an absolute file name.
663 */ 663 */
664 (prefix)) 664 (prefix))
665 { 665 {
666 static char tbl[64] = { 666 static char tbl[64] = {
667 'A','B','C','D','E','F','G','H', 667 'A','B','C','D','E','F','G','H',
1287 memcpy (path, XSTRING_DATA (expanded_name), elen + 1); 1287 memcpy (path, XSTRING_DATA (expanded_name), elen + 1);
1288 /* memset (resolved_path, 0, sizeof (resolved_path)); */ 1288 /* memset (resolved_path, 0, sizeof (resolved_path)); */
1289 1289
1290 /* Try doing it all at once. */ 1290 /* Try doing it all at once. */
1291 /* !!#### Does realpath() Mule-encapsulate? */ 1291 /* !!#### Does realpath() Mule-encapsulate? */
1292 if (!realpath (path, resolved_path)) 1292 if (!xrealpath (path, resolved_path))
1293 { 1293 {
1294 /* Didn't resolve it -- have to do it one component at a time. */ 1294 /* Didn't resolve it -- have to do it one component at a time. */
1295 /* "realpath" is a typically useless, stupid un*x piece of crap. 1295 /* "realpath" is a typically useless, stupid un*x piece of crap.
1296 It claims to return a useful value in the "error" case, but since 1296 It claims to return a useful value in the "error" case, but since
1297 there is no indication provided of how far along the pathname 1297 there is no indication provided of how far along the pathname
1302 p = (char *) memchr (p + 1, '/', elen - (p + 1 - path)); 1302 p = (char *) memchr (p + 1, '/', elen - (p + 1 - path));
1303 if (p) 1303 if (p)
1304 *p = 0; 1304 *p = 0;
1305 1305
1306 /* memset (resolved_path, 0, sizeof (resolved_path)); */ 1306 /* memset (resolved_path, 0, sizeof (resolved_path)); */
1307 if (realpath (path, resolved_path)) 1307 if (xrealpath (path, resolved_path))
1308 { 1308 {
1309 if (p) 1309 if (p)
1310 *p = '/'; 1310 *p = '/';
1311 else 1311 else
1312 break; 1312 break;
2453 } 2453 }
2454 #endif /* !defined(WINDOWSNT) */ 2454 #endif /* !defined(WINDOWSNT) */
2455 } 2455 }
2456 2456
2457 DEFUN ("file-regular-p", Ffile_regular_p, 1, 1, 0, /* 2457 DEFUN ("file-regular-p", Ffile_regular_p, 1, 1, 0, /*
2458 "Return t if file FILENAME is the name of a regular file. 2458 Return t if file FILENAME is the name of a regular file.
2459 This is the sort of file that holds an ordinary stream of data bytes. 2459 This is the sort of file that holds an ordinary stream of data bytes.
2460 */ 2460 */
2461 (filename)) 2461 (filename))
2462 { 2462 {
2463 /* This function can GC. GC checked 1997.04.10. */ 2463 /* This function can GC. GC checked 1997.04.10. */
4303 delete a large chunk of the buffer and don't notice it until too late. 4303 delete a large chunk of the buffer and don't notice it until too late.
4304 Saving the buffer normally turns auto-save back on. 4304 Saving the buffer normally turns auto-save back on.
4305 */ ); 4305 */ );
4306 disable_auto_save_when_buffer_shrinks = 1; 4306 disable_auto_save_when_buffer_shrinks = 1;
4307 4307
4308 DEFVAR_LISP ("path-separator", &Vpath_separator /* 4308 DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char /*
4309 *Directory separator string for built-in functions that return file names. 4309 Directory separator character for built-in functions that return file names.
4310 The value should be either \"/\" or \"\\\". 4310 The value should be either ?/ or ?\ (any other value is treated as ?\).
4311 This variable affects the built-in functions only on Windows,
4312 on other platforms, it is initialized so that Lisp code can find out
4313 what the normal separator is.
4311 */ ); 4314 */ );
4312 Vpath_separator = build_string("X"); 4315 Vdirectory_sep_char = make_char ('/');
4313 (XSTRING_DATA (Vpath_separator))[0] = DIRECTORY_SEP; 4316 }
4314 }