Commit 0f3264c8 authored by Mark Andrews's avatar Mark Andrews
Browse files

2335. [port] sunos: libbind and *printf() support for long long.

                        [RT #17513]
parent 6372b6a6
2335. [port] sunos: libbind and *printf() support for long long.
[RT #17513]
2334. [bug] Bad REQUIRES in fromstruct_in_naptr(), off by one
bug in fromstruct_txt(). [RT #17609]
......
......@@ -508,6 +508,9 @@ Building
on your system, and some require Perl; see bin/tests/system/README
for details.
SunOS 4 requires "printf" to be installed to make the shared
libraries. sh-utils-1.16 provides a "printf" which compiles
on SunOS 4.
Documentation
......
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: strerror.c,v 1.5 2005/04/27 04:56:12 sra Exp $";
static const char rcsid[] = "$Id: strerror.c,v 1.6 2008/02/18 03:49:08 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
......@@ -60,12 +60,14 @@ isc_strerror(int num) {
static char ebuf[40] = UPREFIX; /*%< 64-bit number + slop */
u_int errnum;
char *p, *t;
#ifndef USE_SYSERROR_LIST
const char *ret;
#endif
char tmp[40];
errnum = num; /*%< convert to unsigned */
#ifdef USE_SYSERROR_LIST
if (errnum < sys_nerr)
if (errnum < (u_int)sys_nerr)
return (sys_errlist[errnum]);
#else
#undef strerror
......
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: strtoul.c,v 1.3 2005/04/27 04:56:12 sra Exp $";
static const char rcsid[] = "$Id: strtoul.c,v 1.4 2008/02/18 03:49:08 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
......@@ -70,7 +70,7 @@ strtoul(const char *nptr, char **endptr, int base) {
* See strtol for comments as to the logic used.
*/
do {
c = *(unsigned char *)s++;
c = *(const unsigned char *)s++;
} while (isspace(c));
if (c == '-') {
neg = 1;
......@@ -87,7 +87,7 @@ strtoul(const char *nptr, char **endptr, int base) {
base = c == '0' ? 8 : 10;
cutoff = (u_long)ULONG_MAX / (u_long)base;
cutlim = (u_long)ULONG_MAX % (u_long)base;
for (acc = 0, any = 0;; c = *(unsigned char*)s++) {
for (acc = 0, any = 0;; c = *(const unsigned char*)s++) {
if (isdigit(c))
c -= '0';
else if (isalpha(c))
......@@ -96,7 +96,7 @@ strtoul(const char *nptr, char **endptr, int base) {
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
else {
any = 1;
......@@ -110,7 +110,7 @@ strtoul(const char *nptr, char **endptr, int base) {
} else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = (char *)(any ? s - 1 : nptr);
DE_CONST((any ? s - 1 : nptr), *endptr);
return (acc);
}
......
......@@ -5,6 +5,7 @@
#undef HAVE_STROPTS_H
#undef HAVE_SYS_TIMERS_H
#undef HAVE_SYS_SELECT_H
#undef HAVE_MEMORY_H
#undef SYS_CDEFS_H
#undef _POSIX_PTHREAD_SEMANTICS
#undef POSIX_GETPWUID_R
......@@ -13,6 +14,11 @@
#undef POSIX_GETGRNAM_R
#undef HAVE_MEMMOVE
#undef HAVE_MEMCHR
#undef SPRINTF_CHAR
#undef VSPRINTF_CHAR
#undef USE_SYSERROR_LIST
#undef NEED_STRTOUL
#undef NEED_SUN4PROTOS
#undef NEED_SETGROUPENT
#undef NEED_GETGROUPLIST
......
This diff is collapsed.
......@@ -13,7 +13,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
AC_REVISION($Revision: 1.130 $)
AC_REVISION($Revision: 1.131 $)
AC_INIT(resolv/herror.c)
AC_PREREQ(2.13)
......@@ -169,7 +169,7 @@ AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/timers.h stropts.h)
AC_CHECK_HEADERS(fcntl.h db.h paths.h sys/time.h unistd.h sys/sockio.h sys/select.h sys/timers.h stropts.h memory.h)
AC_C_CONST
AC_C_INLINE
......@@ -461,6 +461,7 @@ AC_SUBST(WANT_THREADS_OBJS)
AC_CHECK_FUNC(strlcat, AC_DEFINE(HAVE_STRLCAT))
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE))
AC_CHECK_FUNC(memchr, AC_DEFINE(HAVE_MEMCHR))
AC_CHECK_FUNC(strtoul, , AC_DEFINE(NEED_STRTOUL))
AC_CHECK_FUNC(if_nametoindex,
[USE_IFNAMELINKID="#define USE_IFNAMELINKID 1"],
......@@ -490,6 +491,16 @@ AC_CHECK_FUNC(strerror, [NEED_STRERROR="#undef NEED_STRERROR"],
[NEED_STRERROR="#define NEED_STRERROR 1"])
AC_SUBST(NEED_STRERROR)
if test -n "$NEED_STRERROR"
then
AC_MSG_CHECKING([for extern char * sys_errlist[]])
AC_TRY_LINK([ extern int sys_nerr; extern char *sys_errlist[]; ],
[ const char *p = sys_errlist[0]; ],
AC_MSG_RESULT(yes)
AC_DEFINE(USE_SYSERROR_LIST),
AC_MSG_RESULT(no))
fi
#
# flockfile is usually provided by pthreads, but we may want to use it
# even if compiled with --disable-threads.
......@@ -1050,6 +1061,7 @@ case "$host" in
*-qnx*) PORT_DIR="port/qnx";;
*-rhapsody*) PORT_DIR="port/rhapsody";;
*-sunos4*)
AC_DEFINE(NEED_SUN4PROTOS)
PORT_NONBLOCK="#define PORT_NONBLOCK O_NDELAY"
PORT_DIR="port/sunos";;
*-solaris2.[[01234]])
......@@ -1246,6 +1258,38 @@ found_rt_iflist
AC_CHECK_FUNC(strsep,
[ISC_PLATFORM_NEEDSTRSEP="#undef ISC_PLATFORM_NEEDSTRSEP"],
[ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"])
AC_MSG_CHECKING(for char *sprintf)
AC_TRY_COMPILE([
#include <stdio.h>
],
[ char buf[2]; return(*sprintf(buf,"x"));],
AC_DEFINE(SPRINTF_CHAR)
AC_MSG_RESULT(yes)
,
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for char *vsprintf)
case $host in
*sunos4*) # not decared in any header file.
AC_DEFINE(VSPRINTF_CHAR)
AC_MSG_RESULT(yes)
;;
*)
AC_TRY_COMPILE([
#include <stdio.h>
],
[ char buf[2]; return(*vsprintf(buf,"x"));],
AC_DEFINE(VSPRINTF_CHAR)
AC_MSG_RESULT(yes)
,
AC_MSG_RESULT(no)
)
;;
esac
AC_CHECK_FUNC(vsnprintf,
[ISC_PLATFORM_NEEDVSNPRINTF="#undef ISC_PLATFORM_NEEDVSNPRINTF"],
[ISC_EXTRA_OBJS="$ISC_EXTRA_OBJS print.$O"
......@@ -1256,12 +1300,7 @@ AC_SUBST(ISC_PLATFORM_NEEDVSNPRINTF)
AC_SUBST(ISC_EXTRA_OBJS)
AC_SUBST(ISC_EXTRA_SRCS)
AC_CHECK_FUNC(strerror,
[USE_SYSERROR_LIST="#undef USE_SYSERROR_LIST"],
[USE_SYSERROR_LIST="#define USE_SYSERROR_LIST 1"])
AC_SUBST(USE_SYSERROR_LIST)
#
# Determine the printf format characters to use when printing
# values of type isc_int64_t. We make the assumption that platforms
# where a "long long" is the same size as a "long" (e.g., Alpha/OSF1)
......
......@@ -16,7 +16,7 @@
*/
/*
* $Id: misc.h,v 1.5 2005/04/27 04:56:18 sra Exp $
* $Id: misc.h,v 1.6 2008/02/18 03:49:08 marka Exp $
*/
#ifndef _ISC_MISC_H
......@@ -25,6 +25,7 @@
/*! \file */
#include <stdio.h>
#include <sys/types.h>
#define bitncmp __bitncmp
/*#define isc_movefile __isc_movefile */
......
......@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
static const char rcsid[] = "$Id: irp.c,v 1.9 2006/03/09 23:57:56 marka Exp $";
static const char rcsid[] = "$Id: irp.c,v 1.10 2008/02/18 03:49:08 marka Exp $";
#endif
/* Imports */
......@@ -48,6 +48,12 @@ static const char rcsid[] = "$Id: irp.c,v 1.9 2006/03/09 23:57:56 marka Exp $";
#include "port_after.h"
#ifdef VSPRINTF_CHAR
# define VSPRINTF(x) strlen(vsprintf/**/x)
#else
# define VSPRINTF(x) ((size_t)vsprintf x)
#endif
/* Forward. */
static void irp_close(struct irs_acc *);
......@@ -528,7 +534,7 @@ irs_irp_send_command(struct irp_p *pvt, const char *fmt, ...) {
}
va_start(ap, fmt);
todo = vsprintf(buffer, fmt, ap);
todo = VSPRINTF((buffer, fmt, ap));
va_end(ap);
if (todo > (int)sizeof(buffer) - 3) {
syslog(LOG_CRIT, "memory overrun in irs_irp_send_command()");
......
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ctl_clnt.c,v 1.9 2007/05/18 06:22:03 marka Exp $";
static const char rcsid[] = "$Id: ctl_clnt.c,v 1.10 2008/02/18 03:49:08 marka Exp $";
#endif /* not lint */
/*
......@@ -38,6 +38,9 @@ static const char rcsid[] = "$Id: ctl_clnt.c,v 1.9 2007/05/18 06:22:03 marka Exp
#include <string.h>
#include <time.h>
#include <unistd.h>
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#include <isc/assertions.h>
#include <isc/ctl.h>
......
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ctl_srvr.c,v 1.8 2006/12/07 04:46:27 marka Exp $";
static const char rcsid[] = "$Id: ctl_srvr.c,v 1.9 2008/02/18 03:49:08 marka Exp $";
#endif /* not lint */
/*
......@@ -40,6 +40,9 @@ static const char rcsid[] = "$Id: ctl_srvr.c,v 1.8 2006/12/07 04:46:27 marka Exp
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
#include <isc/assertions.h>
#include <isc/ctl.h>
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: port_after.h.in,v 1.55 2008/01/23 02:15:56 tbox Exp $ */
/* $Id: port_after.h.in,v 1.56 2008/02/18 03:49:08 marka Exp $ */
#ifndef port_after_h
#define port_after_h
......@@ -41,6 +41,10 @@
@NEED_DAEMON@
@NEED_STRSEP@
@NEED_STRERROR@
#ifdef NEED_STRERROR
const char *isc_strerror(int);
#define strerror isc_strerror
#endif
@HAS_INET6_STRUCTS@
@HAVE_SIN6_SCOPE_ID@
@NEED_IN6ADDR_ANY@
......@@ -49,7 +53,6 @@
@NEED_GETTIMEOFDAY@
@HAVE_STRNDUP@
@USE_FIONBIO_IOCTL@
@USE_SYSERROR_LIST@
@INNETGR_ARGS@
@SETNETGRENT_ARGS@
@USE_IFNAMELINKID@
......@@ -438,4 +441,80 @@ setnetgrent_r(const char *netgroup, NGR_R_ENT_ARGS);
NGR_R_SET_RETURN
setnetgrent_r(const char *netgroup);
#endif
#ifdef NEED_STRTOUL
unsigned long strtoul(const char *, char **, int);
#endif
#ifdef NEED_SUN4PROTOS
#include <stdarg.h>
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ int
#endif
struct sockaddr;
struct iovec;
struct timeval;
struct timezone;
int fprintf(FILE *, const char *, ...);
int getsockname(int, struct sockaddr *, int *);
int getpeername(int, struct sockaddr *, int *);
int socket(int, int, int);
int connect(int, const struct sockaddr *, int);
int writev(int, struct iovec *, int);
int readv(int, struct iovec *, int);
int send(int, const char *, int, int);
void bzero(char *, int);
int recvfrom(int, char *, int, int, struct sockaddr *, int *);
int syslog(int, const char *, ... );
int printf(const char *, ...);
__SIZE_TYPE__ fread(void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
__SIZE_TYPE__ fwrite(const void *, __SIZE_TYPE__, __SIZE_TYPE__, FILE *);
int fclose(FILE *);
int ungetc(int, FILE *);
int scanf(const char *, ...);
int sscanf(const char *, const char *, ... );
int tolower(int);
int toupper(int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, int);
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
#ifdef gettimeofday
#undef gettimeofday
int gettimeofday(struct timeval *, struct timezone *);
#define gettimeofday isc__gettimeofday
#else
int gettimeofday(struct timeval *, struct timezone *);
#endif
long strtol(const char*, char **, int);
int fseek(FILE *, long, int);
int setsockopt(int, int, int, const char *, int);
int bind(int, const struct sockaddr *, int);
void bcopy(char *, char *, int);
int fputc(char, FILE *);
int listen(int, int);
int accept(int, struct sockaddr *, int *);
int getsockopt(int, int, int, char *, int *);
int vfprintf(FILE *, const char *, va_list);
int fflush(FILE *);
int fgetc(FILE *);
int fputs(const char *, FILE *);
int fchown(int, int, int);
void setbuf(FILE *, char *);
int gethostname(char *, int);
int rename(const char *, const char *);
time_t time(time_t *);
int fscanf(FILE *, const char *, ...);
int sscanf(const char *, const char *, ...);
int ioctl(int, int, caddr_t);
void perror(const char *);
#if !defined(__USE_FIXED_PROTOTYPES__) && !defined(__cplusplus) && !defined(__STRICT_ANSI__)
/*
* 'gcc -ansi' changes the prototype for vsprintf().
* Use this prototype when 'gcc -ansi' is not in effect.
*/
char *vsprintf(char *, const char *, va_list);
#endif
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment