* modules/chdir-long (Depends-on): Add memrchr.
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Feb 2005 20:38:14 +0000 (20:38 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Feb 2005 20:38:14 +0000 (20:38 +0000)
* modules/memrchr (Files): Add lib/memrchr.h.
(Include): "memrchr.h".
* lib/memrchr.h: New file.
* lib/chdir-long.c: Include it.
* lib/memrchr.c [!defined _LIBC]: Include it rather than <string.h>
Don't bother including stddef.h.
* m4/memrchr.m4 (gl_FUNC_MEMRCHR): Add AC_LIBSOURCES, for memrchr.h.

ChangeLog
lib/ChangeLog
lib/chdir-long.c
lib/memrchr.c
lib/memrchr.h [new file with mode: 0644]
m4/ChangeLog
m4/memrchr.m4
modules/chdir-long
modules/memrchr

index 0699106a4a757c139bed9cdd388ac7d74a93d0d7..840fc3157901a3131ca333765c934a325c709b18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * modules/chdir-long (Depends-on): Add memrchr.
+       * modules/memrchr (Files): Add lib/memrchr.h.
+       (Include): "memrchr.h".
+
 2005-01-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        Sync from coreutils.
index 9164b78929685031385407c433072c85fde1d666..2982b480bfcc6f9224f2e450ce006b881bf92378 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * memrchr.h: New file.
+       * chdir-long.c: Include it.
+       * memrchr.c [!defined _LIBC]: Include it rather than <string.h>
+       Don't bother including stddef.h.
+
 2005-02-03  Sergey Poznyakoff  <gray@Mirddin.farlep.net>
 
        * argp-help.c (__argp_help): Create a fake struct argp_state and
index 6c8d79f7a84da5aaf65c7225e3a2ffd89056b423..4702432a7ddcf943575ecf03b8e6d10adfedb3f2 100644 (file)
@@ -30,6 +30,7 @@
 #include <assert.h>
 #include <limits.h>
 
+#include "memrchr.h"
 #include "openat.h"
 
 #ifndef O_DIRECTORY
index e34d65ed04e1a951efdb4ba5e9414fbba90b9ed1..ae8dabcd09080a07c75fff93da33ccd23fc25c9a 100644 (file)
@@ -1,7 +1,7 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
-   Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004 Free
-   Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 1996, 1997, 1999, 2000, 2003, 2004, 2005
+   Free Software Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
    with help from Dan Sahlin (dan@sics.se) and
 # include <config.h>
 #endif
 
-#include <string.h>
-
-#include <stddef.h>
-
 #if defined _LIBC
+# include <string.h>
 # include <memcopy.h>
 #else
+# include "memrchr.h"
 # define reg_char char
 #endif
 
diff --git a/lib/memrchr.h b/lib/memrchr.h
new file mode 100644 (file)
index 0000000..6a8e815
--- /dev/null
@@ -0,0 +1,27 @@
+/* memrchr -- Find the last occurrence of a byte in a memory block.
+
+   Copyright (C) 2005 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_DECL_MEMRCHR
+# include <string.h>
+#else
+# include <stddef.h>
+
+/* Search backwards through a block for a byte (specified as an int).  */
+void *memrchr (void const *, int, size_t);
+
+#endif
index 7a5e35cd280ccde720fb24d4a29daf2f1f1fde8b..d02029b19b526b1054b7841489f7fb91874a047c 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * memrchr.m4 (gl_FUNC_MEMRCHR): Add AC_LIBSOURCES, for memrchr.h.
+
 2005-01-28  Paul Eggert  <eggert@cs.ucla.edu>
 
        Sync from coreutils.
index 06a9b1ee7ec76d1a40ce92f3f084e8e5e54ac88f..8ce7d9e4678c8f73530869f7a11a0f115ae5d8b6 100644 (file)
@@ -1,11 +1,13 @@
-# memrchr.m4 serial 3
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# memrchr.m4 serial 4
+dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_MEMRCHR],
 [
+  AC_LIBSOURCES([memrchr.c, memrchr.h])
+
   dnl Persuade glibc <string.h> to declare memrchr().
   AC_REQUIRE([AC_GNU_SOURCE])
 
index c82f5fcbec0c23ccdac1116cdea908e2a323c2a1..a069cf9590a4cb8a331cf9215f2028a03164fca4 100644 (file)
@@ -8,6 +8,7 @@ m4/chdir-long.m4
 
 Depends-on:
 openat
+memrchr
 
 configure.ac:
 gl_FUNC_CHDIR_LONG
index eccad32aa57ab5dd415aa22e7e16d3f30092878e..618c389517c5422e6ca25a3d8f40ce59b22e8458 100644 (file)
@@ -3,6 +3,7 @@ memrchr() function: scan memory for a byte, from the right end.
 
 Files:
 lib/memrchr.c
+lib/memrchr.h
 m4/memrchr.m4
 
 Depends-on:
@@ -13,10 +14,10 @@ gl_FUNC_MEMRCHR
 Makefile.am:
 
 Include:
+"memrchr.h"
 
 License:
 LGPL
 
 Maintainer:
 Jim Meyering, glibc
-