Mercurial > hg > xemacs-beta
comparison src/sysfile.h @ 2526:902d5bd9b75c
[xemacs-hg @ 2005-01-28 02:36:11 by ben]
Support symlinks under Windows
nt.c, fileio.c: Fix sync comments.
config.h.in, dired-msw.c, emacs.c, event-msw.c, fileio.c, glyphs.c, lisp.h, nt.c, process-nt.c, realpath.c, sound.c, symsinit.h, sysdep.c, sysfile.h, syswindows.h, win32.c: Add support for treating shortcuts under Windows as symbolic links.
Enabled with mswindows-shortcuts-are-links (t by default). Rewrite
lots of places to use PATHNAME_CONVERT_OUT, which is moved to
sysfile.h. Add PATHNAME_RESOLVE_LINKS, which only does things
under Windows.
Add profiling section for expand_file_name calls.
nt.c, sysdep.c: Unicode-ize.
realpath.c: Renamed from readlink_and_correct_case. Fix some problems with
Windows implementation due to incorrect understanding of workings
of the function.
sound.c, ntplay.c, sound.h: Rename play_sound_file to nt_play_sound_file and pass
internally-formatted data to it to avoid converting out and back
again.
text.h: is_c -> is_ascii.
author | ben |
---|---|
date | Fri, 28 Jan 2005 02:36:28 +0000 |
parents | ab71ad6ff3dd |
children | facf3239ba30 |
comparison
equal
deleted
inserted
replaced
2525:52f00344a629 | 2526:902d5bd9b75c |
---|---|
235 #undef S_ISMPC | 235 #undef S_ISMPC |
236 #undef S_ISNWK | 236 #undef S_ISNWK |
237 #undef S_ISREG | 237 #undef S_ISREG |
238 #undef S_ISSOCK | 238 #undef S_ISSOCK |
239 #endif /* STAT_MACROS_BROKEN. */ | 239 #endif /* STAT_MACROS_BROKEN. */ |
240 | |
241 #ifdef WIN32_NATIVE | |
242 /* This is the standard value for S_IFLNK. All of the S_... flags that | |
243 exist in the MSVCRT have standard values, so their bit tests will | |
244 magically work. */ | |
245 #define S_IFLNK 0120000 | |
246 #endif | |
240 | 247 |
241 #if !defined(S_ISBLK) && defined(S_IFBLK) | 248 #if !defined(S_ISBLK) && defined(S_IFBLK) |
242 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | 249 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) |
243 #endif | 250 #endif |
244 #if !defined(S_ISCHR) && defined(S_IFCHR) | 251 #if !defined(S_ISCHR) && defined(S_IFCHR) |
374 int qxe_eaccess (const Ibyte *path, int mode); | 381 int qxe_eaccess (const Ibyte *path, int mode); |
375 int qxe_lstat (const Ibyte *path, struct stat *buf); | 382 int qxe_lstat (const Ibyte *path, struct stat *buf); |
376 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); | 383 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); |
377 int qxe_fstat (int fd, struct stat *buf); | 384 int qxe_fstat (int fd, struct stat *buf); |
378 int qxe_stat (const Ibyte *path, struct stat *buf); | 385 int qxe_stat (const Ibyte *path, struct stat *buf); |
379 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path []); | 386 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path [], |
387 Boolint links_only); | |
380 | 388 |
381 /* encapsulations: file-manipulation calls */ | 389 /* encapsulations: file-manipulation calls */ |
382 | 390 |
383 int qxe_chmod (const Ibyte *path, mode_t mode); | 391 int qxe_chmod (const Ibyte *path, mode_t mode); |
384 | 392 |
396 | 404 |
397 /* definition in filemode.c | 405 /* definition in filemode.c |
398 must be declared here to ensure that struct stat is properly formed | 406 must be declared here to ensure that struct stat is properly formed |
399 on systems like SCO 3.2v5 */ | 407 on systems like SCO 3.2v5 */ |
400 void filemodestring (struct stat *, char *); | 408 void filemodestring (struct stat *, char *); |
409 | |
410 #ifdef WIN32_ANY | |
411 extern int mswindows_shortcuts_are_symlinks; | |
412 #endif | |
401 | 413 |
402 #endif /* emacs */ | 414 #endif /* emacs */ |
403 | 415 |
404 | 416 |
405 #ifndef HAVE_H_ERRNO | 417 #ifndef HAVE_H_ERRNO |
505 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP) | 517 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP) |
506 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c) | 518 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c) |
507 | 519 |
508 #endif /* WIN32_ANY */ | 520 #endif /* WIN32_ANY */ |
509 | 521 |
522 #if defined (WIN32_NATIVE) | |
523 #define PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
524 do \ | |
525 { \ | |
526 if (mswindows_shortcuts_are_symlinks) \ | |
527 { \ | |
528 Ibyte *_prl_path_ = (Ibyte *) (path); \ | |
529 Ibyte _prl_path2_[PATH_MAX_INTERNAL]; \ | |
530 \ | |
531 if (!qxe_realpath (_prl_path_, _prl_path2_, 1)) \ | |
532 (pathout) = _prl_path_; \ | |
533 else \ | |
534 IBYTE_STRING_TO_ALLOCA (_prl_path2_, pathout); \ | |
535 } \ | |
536 else (pathout) = (Ibyte *) (path); \ | |
537 } while (0) | |
538 #else | |
539 #define PATHNAME_RESOLVE_LINKS(path, pathout) ((pathout) = (Ibyte *) (path)) | |
540 #endif | |
541 | |
542 #define LISP_PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
543 PATHNAME_RESOLVE_LINKS (XSTRING_DATA (path), pathout) | |
544 | |
545 /* The documentation in VC++ claims that the pathname library functions | |
546 accept strings in the current locale-specific encoding, but that's | |
547 false, because they just call the native Win32 routines directly, which | |
548 always use the system-default encoding (which is what Qmswindows_tstr | |
549 will give us when not XEUNICODE_P). */ | |
550 #ifdef WIN32_NATIVE | |
551 # define PATHNAME_CONVERT_OUT(path, pathout) \ | |
552 do \ | |
553 { \ | |
554 const Ibyte *_pco_path_; \ | |
555 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ | |
556 C_STRING_TO_TSTR (_pco_path_, pathout); \ | |
557 } while (0) | |
558 #else | |
559 # define PATHNAME_CONVERT_OUT(path, pathout) \ | |
560 C_STRING_TO_EXTERNAL (path, pathout, Qfile_name) | |
561 #endif | |
562 | |
563 #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \ | |
564 PATHNAME_CONVERT_OUT (XSTRING_DATA (path), pathout) | |
565 | |
510 #endif /* emacs */ | 566 #endif /* emacs */ |
511 | 567 |
512 #endif /* INCLUDED_sysfile_h_ */ | 568 #endif /* INCLUDED_sysfile_h_ */ |