aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2011-02-25 12:05:36 -0800
committerPaul Eggert2011-02-25 12:05:36 -0800
commit36f13e1667c66073ef18c4ee3394865c3b7c6cbb (patch)
treebe36845ff1a7ffadcfa590589d099fb681d019ba /lib
parent4394ee04741d5fe2fd4cc7a7ee821e1f8a3f2d32 (diff)
downloademacs-36f13e1667c66073ef18c4ee3394865c3b7c6cbb.tar.gz
emacs-36f13e1667c66073ef18c4ee3394865c3b7c6cbb.zip
Simplify symlink portability workaround.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.in20
-rw-r--r--lib/dosname.h53
-rw-r--r--lib/gnulib.mk7
-rw-r--r--lib/stat.c1
4 files changed, 71 insertions, 10 deletions
diff --git a/lib/Makefile.in b/lib/Makefile.in
index e9b9f2eb86e..04ee541a09c 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -50,10 +50,10 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
50subdir = lib 50subdir = lib
51ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 51ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
52am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ 52am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
53 $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/dos.m4 \ 53 $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \
54 $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/filemode.m4 \ 54 $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \
55 $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ 55 $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
56 $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ 56 $(top_srcdir)/m4/gnulib-common.m4 \
57 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ 57 $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \
58 $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \ 58 $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \
59 $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \ 59 $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \
@@ -604,12 +604,12 @@ BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \
604 $(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \ 604 $(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \
605 warn-on-use.h 605 warn-on-use.h
606EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ 606EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \
607 md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ 607 md5.c md5.h dosname.h ftoastr.c ftoastr.h filemode.c \
608 getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ 608 filemode.h getloadavg.c getopt.c getopt.in.h getopt1.c \
609 intprops.h lstat.c mktime-internal.h mktime.c readlink.c \ 609 getopt_int.h intprops.h lstat.c mktime-internal.h mktime.c \
610 stat.c stdbool.in.h stddef.in.h stdint.in.h stdlib.in.h \ 610 readlink.c stat.c stdbool.in.h stddef.in.h stdint.in.h \
611 strftime.c strftime.h symlink.c sys_stat.in.h time.in.h \ 611 stdlib.in.h strftime.c strftime.h symlink.c sys_stat.in.h \
612 time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h 612 time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h
613MOSTLYCLEANDIRS = sys 613MOSTLYCLEANDIRS = sys
614MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ 614MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \
615 c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ 615 c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \
diff --git a/lib/dosname.h b/lib/dosname.h
new file mode 100644
index 00000000000..acdd03b156e
--- /dev/null
+++ b/lib/dosname.h
@@ -0,0 +1,53 @@
1/* File names on MS-DOS/Windows systems.
2
3 Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 From Paul Eggert and Jim Meyering. */
19
20#ifndef _DOSNAME_H
21#define _DOSNAME_H
22
23#if (defined _WIN32 || defined __WIN32__ || \
24 defined __MSDOS__ || defined __CYGWIN__ || \
25 defined __EMX__ || defined __DJGPP__)
26 /* This internal macro assumes ASCII, but all hosts that support drive
27 letters use ASCII. */
28# define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a' \
29 <= 'z' - 'a')
30# define FILE_SYSTEM_PREFIX_LEN(Filename) \
31 (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
32# ifndef __CYGWIN__
33# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
34# endif
35# define ISSLASH(C) ((C) == '/' || (C) == '\\')
36#else
37# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
38# define ISSLASH(C) ((C) == '/')
39#endif
40
41#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
42# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
43#endif
44
45#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
46# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
47# else
48# define IS_ABSOLUTE_FILE_NAME(F) \
49 (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
50#endif
51#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
52
53#endif /* DOSNAME_H_ */
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 1d918ff5fae..b5fd4a358db 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -78,6 +78,13 @@ EXTRA_libgnu_a_SOURCES += md5.c
78 78
79## end gnulib module crypto/md5 79## end gnulib module crypto/md5
80 80
81## begin gnulib module dosname
82
83
84EXTRA_DIST += dosname.h
85
86## end gnulib module dosname
87
81## begin gnulib module dtoastr 88## begin gnulib module dtoastr
82 89
83libgnu_a_SOURCES += dtoastr.c 90libgnu_a_SOURCES += dtoastr.c
diff --git a/lib/stat.c b/lib/stat.c
index f16d9144afc..cbc9100fd4d 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf)
37#include <limits.h> 37#include <limits.h>
38#include <stdbool.h> 38#include <stdbool.h>
39#include <string.h> 39#include <string.h>
40#include "dosname.h"
40 41
41/* Store information about NAME into ST. Work around bugs with 42/* Store information about NAME into ST. Work around bugs with
42 trailing slashes. Mingw has other bugs (such as st_ino always 43 trailing slashes. Mingw has other bugs (such as st_ino always