annotate src/mule-mcpath.h @ 161:28f395d8dc7a r20-3b7

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