changeset 4405:55fc591dca07

New module 'readlink'.
author Bruno Haible <bruno@clisp.org>
date Wed, 25 Jun 2003 20:54:21 +0000
parents d53571cbde51
children e865175b5d4f
files ChangeLog MODULES.html.sh lib/ChangeLog lib/readlink.c m4/ChangeLog m4/readlink.m4 modules/readlink modules/xreadlink
diffstat 8 files changed, 93 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-25  Bruno Haible  <bruno@clisp.org>
+
+	* modules/readlink: New file.
+	* modules/xreadlink: Depend on it.
+	* MODULES.html.sh (func_all_modules): Add readlink.
+
 2003-06-22  Bruno Haible  <bruno@clisp.org>
 
 	* modules/safe-read: Add m4/ssize_t.m4.
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -1672,6 +1672,7 @@
   func_module mkstemp
   func_module mkdtemp
   func_module poll
+  func_module readlink
   func_module stat
   func_module lstat
   func_module timespec
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-25  Bruno Haible  <bruno@clisp.org>
+
+	* readlink.c: New file.
+
 2003-06-20  Bruno Haible  <bruno@clisp.org>
 
 	Assume C89, so PARAMS isn't needed.
new file mode 100644
--- /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 <config.h>
+#endif
+
+#include <errno.h>
+
+#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
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,7 @@
+2003-06-25  Bruno Haible  <bruno@clisp.org>
+
+	* readlink.m4: New file.
+
 2003-06-22  Bruno Haible  <bruno@clisp.org>
 
 	Portability to mingw32.
new file mode 100644
--- /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],
+[
+  :
+])
new file mode 100644
--- /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
+
--- a/modules/xreadlink
+++ b/modules/xreadlink
@@ -9,6 +9,7 @@
 
 Depends-on:
 xalloc
+readlink
 
 configure.ac:
 gl_XREADLINK