70
|
1 /* Support for Non-ASCII Path Name
|
|
2 Copyright (C) 1985, 1986, 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Mule 2.3. Not in FSF. */
|
|
23
|
|
24 /* This part cannot be surround with #ifdef emacs, because it is needed */
|
|
25 /* during generate xmakefile. */
|
|
26 #ifndef MCPATH
|
|
27 # define MCPATH
|
|
28 #endif /* !MCPATH */
|
|
29
|
|
30 /* not to confuse while compiling etc/*.c */
|
|
31 #ifdef emacs
|
|
32 #ifdef MCPATH
|
|
33 # ifndef _MCPATH_H /* enable to include twice */
|
|
34
|
|
35 #if 1
|
|
36
|
|
37 /* !!! This page is copied from dired.c except that DIRENTRY is
|
|
38 changed to SYSTEM_DIRENTRY. Don't modify this page. */
|
|
39
|
|
40 #include <stdio.h>
|
|
41 #include <sys/types.h>
|
|
42 #include <sys/stat.h>
|
|
43
|
|
44 /* The d_nameln member of a struct dirent includes the '\0' character
|
|
45 on some systems, but not on others. What's worse, you can't tell
|
|
46 at compile-time which one it will be, since it really depends on
|
|
47 the sort of system providing the filesystem you're reading from,
|
|
48 not the system you are running on. Paul Eggert
|
|
49 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
|
|
50 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
|
|
51 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
|
|
52
|
|
53 Since applying strlen to the name always works, we'll just do that. */
|
|
54 #define NAMLEN(p) strlen (p->d_name)
|
|
55
|
|
56 #ifdef SYSV_SYSTEM_DIR
|
|
57
|
|
58 #include <dirent.h>
|
|
59 #define SYSTEM_DIRENTRY struct dirent
|
|
60
|
|
61 #else /* not SYSV_SYSTEM_DIR */
|
|
62
|
|
63 #ifdef NONSYSTEM_DIR_LIBRARY
|
|
64 #include "ndir.h"
|
|
65 #else /* not NONSYSTEM_DIR_LIBRARY */
|
|
66 #ifdef MSDOS
|
|
67 #include <dirent.h>
|
|
68 #else
|
|
69 #include <sys/dir.h>
|
|
70 #endif
|
|
71 #endif /* not NONSYSTEM_DIR_LIBRARY */
|
|
72
|
|
73 #ifndef MSDOS
|
|
74 #define SYSTEM_DIRENTRY struct direct
|
|
75
|
|
76 extern DIR *opendir ();
|
|
77 extern struct direct *readdir ();
|
|
78
|
|
79 #endif /* not MSDOS */
|
|
80 #endif /* not SYSV_SYSTEM_DIR */
|
|
81 #endif
|
|
82
|
|
83 /* maximum buffer size to do conversion. */
|
|
84 #define MCPATH_BUFSIZ(s) (((s) * 3) + 256)
|
|
85 #define MC_MAXPATHLEN MCPATH_BUFSIZ (MAXPATHLEN)
|
|
86
|
|
87 #define DIRENTRY struct mcpath_direntry
|
|
88 struct mcpath_direntry
|
|
89 {
|
|
90 /* emacs 19.28 uses d_ino and d_name. */
|
|
91 #ifndef MSDOS
|
|
92 int d_ino;
|
|
93 #endif /* not MSDOS */
|
|
94 unsigned char d_name [MCPATH_BUFSIZ (MAXNAMLEN) + 1];
|
|
95 };
|