From 40be44e2a95cd703e49022c8f8aa0ce5b9b29ea6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 27 Feb 2011 21:46:39 +0200 Subject: [PATCH] Emulate `readlink' for DJGPP versions before 2.04. src/msdos.c (readlink) [DJGPP < 2.04]: New stub function. src/msdos.h: (readlink) [DJGPP < 2.04]: Declare prototype. --- src/ChangeLog | 6 ++++++ src/msdos.c | 12 ++++++++++++ src/msdos.h | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index b49b7a2d3f1..3288a79e9c6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-02-27 Eli Zaretskii + + * msdos.c (readlink) [DJGPP < 2.04]: New stub function. + + * msdos.h: (readlink) [DJGPP < 2.04]: Declare prototype. + 2011-02-26 Eli Zaretskii * s/msdos.h (HAVE_LSTAT): Define for DJGPP >= 2.04. diff --git a/src/msdos.c b/src/msdos.c index 8f0f6776aaa..f6ac1d32b9b 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3922,6 +3922,18 @@ croak (char *badfunc) */ int setpgrp (void) {return 0; } int setpriority (int x, int y, int z) { return 0; } + +#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 4 +ssize_t +readlink (const char *name, char *dummy1, size_t dummy2) +{ + /* `access' is much faster than `stat' on MS-DOS. */ + if (access (name, F_OK) == 0) + errno = EINVAL; + return -1; +} +#endif + #if __DJGPP__ == 2 && __DJGPP_MINOR__ < 2 diff --git a/src/msdos.h b/src/msdos.h index 6b076c1722b..4bbe9b134de 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -40,6 +40,11 @@ void mouse_init (void); void mouse_on (void); void mouse_off (void); void mouse_moveto (int, int); + +#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 4 +int readlink (const char *, char *, size_t); +#endif + #ifndef HAVE_X_WINDOWS /* Dummy types. */ -- 2.39.5