summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-03-09 03:40:18 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:07:48 +0200
commit460180a063bd67c309c99ccecff037023e43dcdb (patch)
tree331eebc303a212078c2393d3b1c2045e4dc488d9 /lib
parent5844b139c6c699565f5297c8f32cf1bbf38521db (diff)
downloadexternal_gettext-460180a063bd67c309c99ccecff037023e43dcdb.zip
external_gettext-460180a063bd67c309c99ccecff037023e43dcdb.tar.gz
external_gettext-460180a063bd67c309c99ccecff037023e43dcdb.tar.bz2
AIX 4.3.3 has an incompatible stpncpy().
Diffstat (limited to 'lib')
-rw-r--r--lib/ChangeLog10
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/stpncpy.c13
-rw-r--r--lib/stpncpy.h14
4 files changed, 29 insertions, 10 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 371e4f2..d23a99e 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,13 @@
+2002-03-09 Bruno Haible <bruno@clisp.org>
+
+ Portability to AIX 4.3.3.
+ * stpncpy.h (gnu_stpncpy): Renamed from stpncpy.
+ (stpncpy): Define as an alias.
+ * stpncpy.c: Compile nothing on glibc systems is set. Otherwise name
+ the function gnu_stpncpy.
+ * Makefile.am (LIBADD_SOURCE): Remove stpncpy.h, stpncpy.c.
+ (libgettextlib_la_SOURCES): Add stpncpy.h, stpncpy.c.
+
2002-03-04 Bruno Haible <bruno@clisp.org>
Portability to AIX 4.3.3.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a566bd8..c16c7fd 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -52,6 +52,7 @@ libgettextlib_la_SOURCES = \
progname.h progname.c \
safe-read.h safe-read.c \
sh-quote.h sh-quote.c \
+ stpncpy.h stpncpy.c \
strtoul.c \
tmpdir.h tmpdir.c \
ucs4-utf8.h ucs4-utf16.h \
@@ -71,7 +72,6 @@ LIBADD_SOURCE = \
setenv.h setenv.c unsetenv.c \
libstdarg.h \
stpcpy.h stpcpy.c \
- stpncpy.h stpncpy.c \
strcase.h strcasecmp.c strncasecmp.c \
strcspn.c \
strpbrk.h strpbrk.c \
diff --git a/lib/stpncpy.c b/lib/stpncpy.c
index c489f76..cb34e08 100644
--- a/lib/stpncpy.c
+++ b/lib/stpncpy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995-1997, 2002 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.
@@ -24,10 +24,19 @@
# include <config.h>
#endif
+/* Specification. */
+#include "stpncpy.h"
+
+#ifndef __GNU_LIBRARY__
+
#ifdef _LIBC
# include <string.h>
#else
# include <sys/types.h>
+/* We cannot generally use the name 'stpncpy' since AIX 4 defines an unusable
+ variant of the function but we cannot use it. */
+# undef stpncpy
+# define stpncpy gnu_stpncpy
#endif
#ifndef weak_alias
@@ -99,3 +108,5 @@ __stpncpy (dest, src, n)
#ifdef weak_alias
weak_alias (__stpncpy, stpncpy)
#endif
+
+#endif
diff --git a/lib/stpncpy.h b/lib/stpncpy.h
index 0c4df53..2b1e680 100644
--- a/lib/stpncpy.h
+++ b/lib/stpncpy.h
@@ -1,5 +1,5 @@
/* String copying.
- Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 2001-2002 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
@@ -26,16 +26,14 @@
# endif
#endif
-#if HAVE_STPNCPY
-
-/* Get stpncpy() declaration. */
#include <string.h>
-#else
-
-#include <stddef.h>
+#ifndef __GNU_LIBRARY__
-extern char *stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
+/* When not using the GNU libc we use the stpncpy implementation we
+ provide here. */
+extern char *gnu_stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
+#define stpncpy(Dst, Src, N) gnu_stpncpy (Dst, Src, N)
#endif