From 0f7bb05d28a57975fca586d7b3aa5e72edf56897 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Feb 2011 21:48:31 +0200 Subject: [PATCH] Implement stubs of `readlink' and `symlink' for MS-Windows. src/w32.c (symlink, readlink): New stub functions. nt/inc/unistd.h (readlink, symlink): Declare prototypes. --- nt/ChangeLog | 4 ++++ nt/inc/unistd.h | 8 ++++++++ src/ChangeLog | 4 ++++ src/w32.c | 19 +++++++++++++++++++ 4 files changed, 35 insertions(+) diff --git a/nt/ChangeLog b/nt/ChangeLog index bfaba610bf2..e55fc52a487 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2011-02-27 Eli Zaretskii + + * inc/unistd.h (readlink, symlink): Declare prototypes. + 2011-02-26 Eli Zaretskii * config.nt (nlink_t): Define. diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h index 7e77f95da4c..fb1f1c4b3bf 100644 --- a/nt/inc/unistd.h +++ b/nt/inc/unistd.h @@ -1,2 +1,10 @@ /* Fake unistd.h: config.h already provides most of the relevant things. */ +#ifndef _UNISTD_H +#define _UNISTD_H + +extern ssize_t readlink (const char *, char *, size_t); +extern int symlink (char const *, char const *); + +#endif /* _UNISTD_H */ + diff --git a/src/ChangeLog b/src/ChangeLog index 1929c3fc98a..f3710495c4a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2011-02-27 Eli Zaretskii + + * w32.c (symlink, readlink): New stub functions. + 2011-02-27 Paul Eggert * scroll.c (CHECK_BOUNDS): #define only if GLYPH_DEBUG. diff --git a/src/w32.c b/src/w32.c index d4f68544c1d..ae2373be46e 100644 --- a/src/w32.c +++ b/src/w32.c @@ -3613,6 +3613,25 @@ utime (const char *name, struct utimbuf *times) return 0; } + +/* Symlink-related functions that always fail. Used in fileio.c to + avoid #ifdef's. */ +int +symlink (char const *dummy1, char const *dummy2) +{ + errno = ENOSYS; + return -1; +} + +ssize_t +readlink (const char *name, char *dummy1, size_t dummy2) +{ + /* `access' is much faster than `stat' on MS-Windows. */ + if (sys_access (name, 0) == 0) + errno = EINVAL; + return -1; +} + /* Support for browsing other processes and their attributes. See process.c for the Lisp bindings. */ -- 2.39.2