[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] stpncpy and AIX
From: |
Bruno Haible |
Subject: |
[Bug-gnulib] stpncpy and AIX |
Date: |
Thu, 25 Sep 2003 14:26:48 +0200 |
User-agent: |
KMail/1.5 |
AIX 4 has a function stpncpy, which does not work like the one in gnulib.
Here is a patch which disables the use of the system function stpncpy
on all platforms except glibc.
Any objections?
2002-03-09 Bruno Haible <address@hidden>
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. Otherwise name
the function gnu_stpncpy.
*** lib/stpncpy.h 29 Jan 2003 16:47:25 -0000 1.1
--- lib/stpncpy.h 25 Sep 2003 12:23:51 -0000
***************
*** 18,35 ****
#ifndef _STPNCPY_H
#define _STPNCPY_H
- #if HAVE_STPNCPY
-
- /* Get stpncpy() declaration. */
#include <string.h>
! #else
!
! #include <stddef.h>
/* Copy no more than N characters of SRC to DST, returning the address of
the last character written into DST. */
! extern char *stpncpy (char *dst, const char *src, size_t n);
#endif
--- 18,33 ----
#ifndef _STPNCPY_H
#define _STPNCPY_H
#include <string.h>
! #ifndef __GNU_LIBRARY__
/* Copy no more than N characters of SRC to DST, returning the address of
the last character written into DST. */
! /* When not using the GNU libc we use the stpncpy implementation we
! provide here. */
! extern char *gnu_stpncpy (char *dst, const char *src, size_t n);
! #define stpncpy(Dst, Src, N) gnu_stpncpy (Dst, Src, N)
#endif
*** lib/stpncpy.c 12 Sep 2003 18:24:51 -0000 1.2
--- lib/stpncpy.c 25 Sep 2003 12:23:51 -0000
***************
*** 1,4 ****
! /* Copyright (C) 1993, 1995-1997, 2002-2003 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library.
Bugs can be reported to address@hidden
--- 1,4 ----
! /* 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 address@hidden
***************
*** 27,32 ****
--- 27,41 ----
/* Specification. */
#include "stpncpy.h"
+ #ifndef __GNU_LIBRARY__
+
+ #ifndef _LIBC
+ /* 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
# define __stpncpy stpncpy
#endif
***************
*** 92,95 ****
--- 101,106 ----
}
#ifdef weak_alias
weak_alias (__stpncpy, stpncpy)
+ #endif
+
#endif
- [Bug-gnulib] stpncpy and AIX,
Bruno Haible <=