INN commit: trunk (11 files)

INN Commit Russ_Allbery at isc.org
Thu Mar 26 19:14:45 UTC 2009


    Date: Thursday, March 26, 2009 @ 12:14:45
  Author: iulius
Revision: 8393

Remove the replacement for a missing strerror function.  Modern systems
have it (only ULTRIX is reported not to).

The test suite does not work on a few systems (the wording of the reply
to strerror(0) is not standardized).

Modified:
  trunk/LICENSE
  trunk/MANIFEST
  trunk/configure.ac
  trunk/include/clibrary.h
  trunk/lib/Makefile
  trunk/support/mkmanifest
  trunk/tests/Makefile
  trunk/tests/TESTS
  trunk/tests/lib/	(properties)
Deleted:
  trunk/lib/strerror.c
  trunk/tests/lib/strerror-t.c

------------------------+
 LICENSE                |    3 --
 MANIFEST               |    2 -
 configure.ac           |    2 -
 include/clibrary.h     |    3 --
 lib/Makefile           |    4 ---
 lib/strerror.c         |   57 -----------------------------------------------
 support/mkmanifest     |    1 
 tests/Makefile         |    8 ------
 tests/TESTS            |    1 
 tests/lib/strerror-t.c |   29 -----------------------
 10 files changed, 4 insertions(+), 106 deletions(-)

Modified: LICENSE
===================================================================
--- LICENSE	2009-03-23 19:35:22 UTC (rev 8392)
+++ LICENSE	2009-03-26 19:14:45 UTC (rev 8393)
@@ -33,8 +33,7 @@
    backends/shrinkfile.c, frontends/scanspool.in, lib/alloca.c,
    lib/concat.c, lib/hstrerror.c, lib/inet_aton.c, lib/inet_ntoa.c,
    lib/memcmp.c, lib/pread.c, lib/pwrite.c, lib/setenv.c, lib/seteuid.c,
-   lib/strerror.c, lib/strlcat.c and lib/strlcpy.c are in the public 
-   domain.
+   lib/strlcat.c and lib/strlcpy.c are in the public domain.
 
    lib/snprintf.c may be used for any purpose as long as the author's
    notice remains intact in all source code distributions.

Modified: MANIFEST
===================================================================
--- MANIFEST	2009-03-23 19:35:22 UTC (rev 8392)
+++ MANIFEST	2009-03-26 19:14:45 UTC (rev 8393)
@@ -519,7 +519,6 @@
 lib/setproctitle.c                    setproctitle replacement
 lib/snprintf.c                        snprintf and vsnprintf replacement
 lib/strcasecmp.c                      Case-insenstive string comparison (BSD)
-lib/strerror.c                        String representation of errno
 lib/strlcat.c                         strlcat replacement
 lib/strlcpy.c                         strlcpy replacement
 lib/strspn.c                          Skip bytes in a string (BSD)
@@ -861,7 +860,6 @@
 tests/lib/setenv-t.c                  Tests for lib/setenv.c
 tests/lib/setenv.t                    Wrapper for setenv tests
 tests/lib/snprintf-t.c                Tests for lib/snprintf.c
-tests/lib/strerror-t.c                Tests for lib/strerror.c
 tests/lib/strlcat-t.c                 Tests for lib/strlcat.c
 tests/lib/strlcpy-t.c                 Tests for lib/strlcpy.c
 tests/lib/tst-t.c                     Tests for lib/tst.c

Modified: configure.ac
===================================================================
--- configure.ac	2009-03-23 19:35:22 UTC (rev 8392)
+++ configure.ac	2009-03-26 19:14:45 UTC (rev 8393)
@@ -498,7 +498,7 @@
 dnl If we can't find any of the following, we have replacements for them.
 AC_REPLACE_FUNCS(asprintf getaddrinfo getnameinfo getpagesize hstrerror \
                  inet_aton inet_ntop mkstemp pread pwrite seteuid strcasecmp \
-                 strerror strlcat strlcpy strspn setenv symlink)
+                 strlcat strlcpy strspn setenv symlink)
 
 dnl Probe for fseeko and ftello, which take off_t instead of int.
 if test x"$inn_enable_largefiles" = xyes ; then

Modified: include/clibrary.h
===================================================================
--- include/clibrary.h	2009-03-23 19:35:22 UTC (rev 8392)
+++ include/clibrary.h	2009-03-26 19:14:45 UTC (rev 8393)
@@ -132,9 +132,6 @@
 extern int              snprintf(char *, size_t, const char *, ...)
     __attribute__((__format__(printf, 3, 4)));
 #endif
-#if !HAVE_STRERROR
-extern const char *     strerror(int);
-#endif
 #if !HAVE_STRLCAT || !HAVE_DECL_STRLCAT
 extern size_t           strlcat(char *, const char *, size_t);
 #endif

Modified: lib/Makefile
===================================================================
--- lib/Makefile	2009-03-23 19:35:22 UTC (rev 8392)
+++ lib/Makefile	2009-03-26 19:14:45 UTC (rev 8393)
@@ -21,7 +21,7 @@
 EXTRA_SOURCES = alloca.c fseeko.c ftello.c getaddrinfo.c getnameinfo.c \
 		getpagesize.c hstrerror.c inet_aton.c inet_ntoa.c memcmp.c \
 		mkstemp.c pread.c pwrite.c setenv.c setproctitle.c \
-		strcasecmp.c strerror.c strlcat.c strlcpy.c strspn.c \
+		strcasecmp.c strlcat.c strlcpy.c strspn.c \
 		strtok.c symlink.c
 
 OBJECTS       = $(LIBOBJS) $(ALLOCA) $(SOURCES:.c=.o)
@@ -352,8 +352,6 @@
 strcasecmp.o: strcasecmp.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h
-strerror.o: strerror.c ../include/config.h ../include/inn/defines.h \
-  ../include/inn/system.h ../include/inn/options.h
 strlcat.o: strlcat.c ../include/config.h ../include/inn/defines.h \
   ../include/inn/system.h ../include/inn/options.h ../include/clibrary.h \
   ../include/config.h

Deleted: lib/strerror.c
===================================================================
--- lib/strerror.c	2009-03-23 19:35:22 UTC (rev 8392)
+++ lib/strerror.c	2009-03-26 19:14:45 UTC (rev 8393)
@@ -1,57 +0,0 @@
-/*  $Id$
-**
-**  Replacement for a missing strerror.
-**
-**  Written by Russ Allbery <rra at stanford.edu>
-**  This work is hereby placed in the public domain by its author.
-**
-**  Provides the same functionality as the standard library routine strerror
-**  for those platforms that don't have it (e.g. Ultrix).  Assume that we
-**  have sys_nerr and sys_errlist available to use instead.  Calling
-**  strerror should be thread-safe unless it is called for an unknown errno.
-*/
-
-#include "config.h"
-
-/* Our declarations of sys_nerr and sys_errlist may conflict with the ones
-   provided by stdio.h from glibc.  This trick hides the declarations in the
-   system header from the compiler while we test.  (The conflicts are just
-   whether or not to const, so there are no negative effects from using our
-   declarations.) */
-#if TESTING
-# define sys_nerr       hidden_sys_nerr
-# define sys_errlist    hidden_sys_errlist
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-
-#if TESTING
-# undef sys_nerr
-# undef sys_errlist
-#endif
-
-extern const int sys_nerr;
-extern const char *sys_errlist[];
-
-/* If we're running the test suite, rename strerror to avoid conflicts with
-   the system version. */
-#if TESTING
-# define strerror test_strerror
-const char *test_strerror(int);
-int snprintf(char *, size_t, const char *, ...);
-#endif
-
-const char *
-strerror(int error)
-{
-    static char buff[32];
-    int oerrno;
-
-    if (error >= 0 && error < sys_nerr)
-        return sys_errlist[error];
-    oerrno = errno;
-    snprintf(buff, sizeof(buff), "Error code %d", error);
-    errno = oerrno;
-    return buff;
-}

Modified: support/mkmanifest
===================================================================
--- support/mkmanifest	2009-03-23 19:35:22 UTC (rev 8392)
+++ support/mkmanifest	2009-03-26 19:14:45 UTC (rev 8393)
@@ -289,7 +289,6 @@
 tests/lib/qio.t
 tests/lib/setenv.tr
 tests/lib/snprintf.t
-tests/lib/strerror.t
 tests/lib/strlcat.t
 tests/lib/strlcpy.t
 tests/lib/tst.t

Modified: tests/Makefile
===================================================================
--- tests/Makefile	2009-03-23 19:35:22 UTC (rev 8392)
+++ tests/Makefile	2009-03-26 19:14:45 UTC (rev 8393)
@@ -16,7 +16,7 @@
 	lib/hashtab.t lib/hex.t lib/hstrerror.t lib/inet_aton.t \
 	lib/inet_ntoa.t lib/inet_ntop.t lib/innconf.t lib/list.t lib/md5.t \
 	lib/memcmp.t lib/messages.t lib/mkstemp.t lib/network.t lib/pread.t \
-	lib/pwrite.t lib/qio.t lib/snprintf.t lib/strerror.t lib/strlcat.t \
+	lib/pwrite.t lib/qio.t lib/snprintf.t lib/strlcat.t \
 	lib/strlcpy.t lib/tst.t lib/uwildmat.t lib/vector.t lib/wire.t \
 	lib/xwrite.t nnrpd/auth-ext.t overview/api.t overview/buffindexed.t \
 	overview/tradindexed.t overview/xref.t util/innbind.t
@@ -206,12 +206,6 @@
 lib/snprintf.t: lib/snprintf.o lib/snprintf-t.o libtest.o $(LIBINN)
 	$(LINK) lib/snprintf.o lib/snprintf-t.o libtest.o $(LIBINN)
 
-lib/strerror.o: ../lib/strerror.c
-	$(CC) $(CFLAGS) -DTESTING -c -o $@ ../lib/strerror.c
-
-lib/strerror.t: lib/strerror.o lib/strerror-t.o libtest.o $(LIBINN)
-	$(LINK) lib/strerror.o lib/strerror-t.o libtest.o $(LIBINN)
-
 lib/strlcat.o: ../lib/strlcat.c
 	$(CC) $(CFLAGS) -DTESTING -c -o $@ ../lib/strlcat.c
 

Modified: tests/TESTS
===================================================================
--- tests/TESTS	2009-03-23 19:35:22 UTC (rev 8392)
+++ tests/TESTS	2009-03-26 19:14:45 UTC (rev 8393)
@@ -32,7 +32,6 @@
 lib/qio
 lib/setenv
 lib/snprintf
-lib/strerror
 lib/strlcat
 lib/strlcpy
 lib/tst


Property changes on: trunk/tests/lib
___________________________________________________________________
Name: svn:ignore
   - .libs
.pure
asprintf.t
buffer.t
concat.t
conffile.t
confparse.t
date.t
dispatch.t
getaddrinfo.t
getnameinfo.t
hash.t
hashtab.t
hex.t
hstrerror.t
inet_aton.t
inet_ntoa.t
inet_ntop.t
innconf.t
list.t
md5.t
memcmp.t
messages.t
mkstemp.t
network.t
pread.t
pwrite.t
qio.t
setenv.tr
snprintf.t
strerror.t
strlcat.t
strlcpy.t
tst.t
uwildmat.t
vector.t
wire.t
xmalloc
xwrite.t

   + .libs
.pure
asprintf.t
buffer.t
concat.t
conffile.t
confparse.t
date.t
dispatch.t
getaddrinfo.t
getnameinfo.t
hash.t
hashtab.t
hex.t
hstrerror.t
inet_aton.t
inet_ntoa.t
inet_ntop.t
innconf.t
list.t
md5.t
memcmp.t
messages.t
mkstemp.t
network.t
pread.t
pwrite.t
qio.t
setenv.tr
snprintf.t
strlcat.t
strlcpy.t
tst.t
uwildmat.t
vector.t
wire.t
xmalloc
xwrite.t


Deleted: tests/lib/strerror-t.c
===================================================================
--- tests/lib/strerror-t.c	2009-03-23 19:35:22 UTC (rev 8392)
+++ tests/lib/strerror-t.c	2009-03-26 19:14:45 UTC (rev 8393)
@@ -1,29 +0,0 @@
-/* $Id$ */
-/* strerror test suite. */
-
-#include "config.h"
-#include "clibrary.h"
-#include <errno.h>
-
-#include "libtest.h"
-
-const char *test_strerror(int);
-
-int
-main(void)
-{
-    test_init(5);
-
-#if HAVE_STRERROR
-    ok_string(1, strerror(EACCES), test_strerror(EACCES));
-    ok_string(2, strerror(0), test_strerror(0));
-#else
-    ok(1, strerror(EACCES) != NULL);
-    ok(2, strerror(0) != NULL);
-#endif
-    ok_string(3, "Error code 77777", test_strerror(77777));
-    ok_string(4, "Error code -4000", test_strerror(-4000));
-    ok_string(5, "Error code -100000", test_strerror(-100000));
-
-    return 0;
-}




More information about the inn-committers mailing list