From 84645eae86ddff86ca4760ca71b4852673dedd03 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 25 Jun 2003 20:54:21 +0000 Subject: [PATCH] New module 'readlink'. --- ChangeLog | 6 ++++++ MODULES.html.sh | 1 + lib/ChangeLog | 4 ++++ lib/readlink.c | 36 ++++++++++++++++++++++++++++++++++++ m4/ChangeLog | 4 ++++ m4/readlink.m4 | 22 ++++++++++++++++++++++ modules/readlink | 19 +++++++++++++++++++ modules/xreadlink | 1 + 8 files changed, 93 insertions(+) create mode 100644 lib/readlink.c create mode 100644 m4/readlink.m4 create mode 100644 modules/readlink diff --git a/ChangeLog b/ChangeLog index 4c14bfbedd..fa82c5ad37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-06-25 Bruno Haible + + * modules/readlink: New file. + * modules/xreadlink: Depend on it. + * MODULES.html.sh (func_all_modules): Add readlink. + 2003-06-22 Bruno Haible * modules/safe-read: Add m4/ssize_t.m4. diff --git a/MODULES.html.sh b/MODULES.html.sh index 6a059d362c..c1c202d3bc 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -1672,6 +1672,7 @@ func_all_modules () func_module mkstemp func_module mkdtemp func_module poll + func_module readlink func_module stat func_module lstat func_module timespec diff --git a/lib/ChangeLog b/lib/ChangeLog index be7254f81a..ea69c6a5c9 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2003-06-25 Bruno Haible + + * readlink.c: New file. + 2003-06-20 Bruno Haible Assume C89, so PARAMS isn't needed. diff --git a/lib/readlink.c b/lib/readlink.c new file mode 100644 index 0000000000..72d0e04475 --- /dev/null +++ b/lib/readlink.c @@ -0,0 +1,36 @@ +/* Stub for readlink(). + Copyright (C) 2003 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#if HAVE_CONFIG_H +# include +#endif + +#include + +#if !HAVE_READLINK + +/* readlink() substitute for systems that don't have a readlink() function, + such as DJGPP 2.03 and mingw32. */ + +int +readlink (const char *filename, char *buffer, size_t bufsize) +{ + errno = EINVAL; + return -1; +} + +#endif diff --git a/m4/ChangeLog b/m4/ChangeLog index 8656751927..461fef07ea 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2003-06-25 Bruno Haible + + * readlink.m4: New file. + 2003-06-22 Bruno Haible Portability to mingw32. diff --git a/m4/readlink.m4 b/m4/readlink.m4 new file mode 100644 index 0000000000..fd73d49f12 --- /dev/null +++ b/m4/readlink.m4 @@ -0,0 +1,22 @@ +# readlink.m4 serial 1 +dnl Copyright (C) 2003 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +AC_DEFUN([gl_FUNC_READLINK], +[ + AC_CHECK_FUNCS(readlink) + if test $ac_cv_func_readlink = no; then + AC_LIBOBJ(readlink) + gl_PREREQ_READLINK + fi +]) + +# Prerequisites of lib/readlink.c. +AC_DEFUN([gl_PREREQ_READLINE], +[ + : +]) diff --git a/modules/readlink b/modules/readlink new file mode 100644 index 0000000000..8a0acb7d3f --- /dev/null +++ b/modules/readlink @@ -0,0 +1,19 @@ +Description: +readlink() function: read the value of a symbolic link. + +Files: +lib/readlink.c +m4/readlink.m4 + +Depends-on: + +configure.ac: +gl_FUNC_READLINK + +Makefile.am: + +Include: + +Maintainer: +Bruno Haible + diff --git a/modules/xreadlink b/modules/xreadlink index 0d0e08ec87..be4b484e06 100644 --- a/modules/xreadlink +++ b/modules/xreadlink @@ -9,6 +9,7 @@ m4/ssize_t.m4 Depends-on: xalloc +readlink configure.ac: gl_XREADLINK -- 2.30.2