Subject: Re: standards/33126: POSIX, inttypes.h missing struct and functions
To: None <standards-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Takehiko NOZAKI <th-nozaki@netwrk.co.jp>
List: netbsd-bugs
Date: 03/22/2006 12:55:01
The following reply was made to PR standards/33126; it has been noted by GNATS.

From: Takehiko NOZAKI <th-nozaki@netwrk.co.jp>
To: gnats-bugs@netbsd.org
Cc: murray@river-styx.org
Subject: Re: standards/33126: POSIX, inttypes.h missing struct and functions
Date: Wed, 22 Mar 2006 22:04:58 +0900

 --Multipart_Wed_Mar_22_22:04:58_2006-1
 Content-Type: text/plain; charset=US-ASCII
 
 hi, all.
 
 > >Fix:
 > Use FreeBSD's code...
 > The following patch adds the structure and functions to <inttypes.h>.
 > I would suggest using the following four files from FreeBSD and putting
 > them into our lib/libc/stdlib directory appropriately.
 >    FreeBSD/src/lib/libc/stdlib/imaxabs.3
 >    FreeBSD/src/lib/libc/stdlib/imaxabs.c
 >    FreeBSD/src/lib/libc/stdlib/imaxdiv.3
 >    FreeBSD/src/lib/libc/stdlib/imaxdiv.c
 > The files will of course need a little adjustment.
 
 how about templete'ize abs/div family?
 see attached imaxdiv.patch.
 
 very truly yours.
 --
 Takehiko NOZAKI <tnozaki@netbsd.org>
 
 
 --Multipart_Wed_Mar_22_22:04:58_2006-1
 Content-Type: application/octet-stream; type=patch
 Content-Disposition: attachment; filename="imaxdiv.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: include/inttypes.h
 ===================================================================
 RCS file: /cvsroot/src/include/inttypes.h,v
 retrieving revision 1.4
 diff -u -r1.4 inttypes.h
 --- include/inttypes.h	18 Apr 2005 19:47:51 -0000	1.4
 +++ include/inttypes.h	22 Mar 2006 12:38:59 -0000
 @@ -48,6 +48,11 @@
  #undef	_BSD_WCHAR_T_
  #endif
  
 +typedef struct {
 +	intmax_t	quot;	/* Quotient. */
 +	intmax_t	rem;	/* Remainder. */
 +} imaxdiv_t;
 +
  __BEGIN_DECLS
  intmax_t	strtoimax(const char * __restrict,
  		    char ** __restrict, int);
 Index: lib/libc/include/namespace.h
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/include/namespace.h,v
 retrieving revision 1.110
 diff -u -r1.110 namespace.h
 --- lib/libc/include/namespace.h	26 Jan 2006 12:37:11 -0000	1.110
 +++ lib/libc/include/namespace.h	22 Mar 2006 12:40:12 -0000
 @@ -351,6 +351,8 @@
  #define if_indextoname		_if_indextoname
  #define if_nameindex		_if_nameindex
  #define if_nametoindex		_if_nametoindex
 +#define	imaxabs			_imaxabs
 +#define	imaxdiv			_imaxdiv
  #define in6addr_any		_in6addr_any
  #define in6addr_linklocal_allnodes	_in6addr_linklocal_allnodes
  #define in6addr_linklocal_allrouters	_in6addr_linklocal_allrouters
 Index: lib/libc/stdlib/Makefile.inc
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/Makefile.inc,v
 retrieving revision 1.63
 diff -u -r1.63 Makefile.inc
 --- lib/libc/stdlib/Makefile.inc	25 Jan 2006 15:43:01 -0000	1.63
 +++ lib/libc/stdlib/Makefile.inc	22 Mar 2006 12:40:23 -0000
 @@ -16,7 +16,7 @@
  	seed48.c setenv.c srand48.c strsuftoll.c \
  	strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c strtoull.c \
  	strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c \
 -	unsetenv.c strfmon.c
 +	unsetenv.c strfmon.c imaxabs.c imaxdiv.c
  
  # machine-dependent stdlib sources
  # m-d Makefile.inc must include sources for:
 Index: lib/libc/stdlib/_abs_template.h
 ===================================================================
 RCS file: lib/libc/stdlib/_abs_template.h
 diff -N lib/libc/stdlib/_abs_template.h
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ lib/libc/stdlib/_abs_template.h	22 Mar 2006 12:40:28 -0000
 @@ -0,0 +1,45 @@
 +/* $NetBSD$ */
 +
 +/*-
 + * Copyright (c) 1990, 1993
 + *	The Regents of the University of California.  All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + * 3. Neither the name of the University nor the names of its contributors
 + *    may be used to endorse or promote products derived from this software
 + *    without specific prior written permission.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * Original version ID:
 + * @(#)abs.c 8.1 (Berkeley) 6/4/93
 + * NetBSD: abs.c,v 1.7 2003/08/07 16:43:37 agc Exp
 + */
 +
 +/*
 + * function template for abs, labs, llabs, qabs and imaxabs
 + */
 +
 +_INTTYPE
 +_FUNCNAME(j)
 +	_INTTYPE j;
 +{
 +	return(j < 0 ? -j : j);
 +}
 Index: lib/libc/stdlib/_div_template.h
 ===================================================================
 RCS file: lib/libc/stdlib/_div_template.h
 diff -N lib/libc/stdlib/_div_template.h
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ lib/libc/stdlib/_div_template.h	22 Mar 2006 12:40:28 -0000
 @@ -0,0 +1,79 @@
 +/*	$NetBSD$	*/
 +
 +/*
 + * Copyright (c) 1990, 1993
 + *	The Regents of the University of California.  All rights reserved.
 + *
 + * This code is derived from software contributed to Berkeley by
 + * Chris Torek.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + * 3. Neither the name of the University nor the names of its contributors
 + *    may be used to endorse or promote products derived from this software
 + *    without specific prior written permission.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + *
 + * Original version ID:
 + * @(#)div.c 8.1 (Berkeley) 6/4/93
 + * NetBSD: div.c,v 1.7 2003/08/07 16:43:39 agc Exp
 + */
 +
 +/*
 + * function template for div, ldiv, lldiv, qabs and imaxdiv
 + */
 +
 +_DIVTYPE
 +_FUNCNAME(num, denom)
 +	_INTTYPE num, denom;
 +{
 +	_DIVTYPE r;
 +
 +	r.quot = num / denom;
 +	r.rem = num % denom;
 +	/*
 +	 * The ANSI standard says that |r.quot| <= |n/d|, where
 +	 * n/d is to be computed in infinite precision.  In other
 +	 * words, we should always truncate the quotient towards
 +	 * 0, never -infinity.
 +	 *
 +	 * Machine division and remainer may work either way when
 +	 * one or both of n or d is negative.  If only one is
 +	 * negative and r.quot has been truncated towards -inf,
 +	 * r.rem will have the same sign as denom and the opposite
 +	 * sign of num; if both are negative and r.quot has been
 +	 * truncated towards -inf, r.rem will be positive (will
 +	 * have the opposite sign of num).  These are considered
 +	 * `wrong'.
 +	 *
 +	 * If both are num and denom are positive, r will always
 +	 * be positive.
 +	 *
 +	 * This all boils down to:
 +	 *	if num >= 0, but r.rem < 0, we got the wrong answer.
 +	 * In that case, to get the right answer, add 1 to r.quot and
 +	 * subtract denom from r.rem.
 +	 */
 +	if (num >= 0 && r.rem < 0) {
 +		r.quot++;
 +		r.rem -= denom;
 +	}
 +	return (r);
 +}
 Index: lib/libc/stdlib/abs.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/abs.c,v
 retrieving revision 1.7
 diff -u -r1.7 abs.c
 --- lib/libc/stdlib/abs.c	7 Aug 2003 16:43:37 -0000	1.7
 +++ lib/libc/stdlib/abs.c	22 Mar 2006 12:40:28 -0000
 @@ -40,9 +40,7 @@
  
  #include <stdlib.h>
  
 -int
 -abs(j)
 -	int j;
 -{
 -	return(j < 0 ? -j : j);
 -}
 +#define	_INTTYPE	int
 +#define	_FUNCNAME	abs
 +
 +#include "_abs_template.h"
 Index: lib/libc/stdlib/div.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/div.c,v
 retrieving revision 1.7
 diff -u -r1.7 div.c
 --- lib/libc/stdlib/div.c	7 Aug 2003 16:43:39 -0000	1.7
 +++ lib/libc/stdlib/div.c	22 Mar 2006 12:40:28 -0000
 @@ -43,40 +43,8 @@
  
  #include <stdlib.h>		/* div_t */
  
 -div_t
 -div(num, denom)
 -	int num, denom;
 -{
 -	div_t r;
 +#define	_DIVTYPE	div_t
 +#define	_FUNCNAME	div
 +#define	_INTTYPE	int
  
 -	r.quot = num / denom;
 -	r.rem = num % denom;
 -	/*
 -	 * The ANSI standard says that |r.quot| <= |n/d|, where
 -	 * n/d is to be computed in infinite precision.  In other
 -	 * words, we should always truncate the quotient towards
 -	 * 0, never -infinity.
 -	 *
 -	 * Machine division and remainer may work either way when
 -	 * one or both of n or d is negative.  If only one is
 -	 * negative and r.quot has been truncated towards -inf,
 -	 * r.rem will have the same sign as denom and the opposite
 -	 * sign of num; if both are negative and r.quot has been
 -	 * truncated towards -inf, r.rem will be positive (will
 -	 * have the opposite sign of num).  These are considered
 -	 * `wrong'.
 -	 *
 -	 * If both are num and denom are positive, r will always
 -	 * be positive.
 -	 *
 -	 * This all boils down to:
 -	 *	if num >= 0, but r.rem < 0, we got the wrong answer.
 -	 * In that case, to get the right answer, add 1 to r.quot and
 -	 * subtract denom from r.rem.
 -	 */
 -	if (num >= 0 && r.rem < 0) {
 -		r.quot++;
 -		r.rem -= denom;
 -	}
 -	return (r);
 -}
 +#include "_div_template.h"
 Index: lib/libc/stdlib/imaxabs.c
 ===================================================================
 RCS file: lib/libc/stdlib/imaxabs.c
 diff -N lib/libc/stdlib/imaxabs.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ lib/libc/stdlib/imaxabs.c	22 Mar 2006 12:40:28 -0000
 @@ -0,0 +1,47 @@
 +/*	$NetBSD$	*/
 +
 +/*-
 + * Copyright (c) 1990, 1993
 + *	The Regents of the University of California.  All rights reserved.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + * 3. Neither the name of the University nor the names of its contributors
 + *    may be used to endorse or promote products derived from this software
 + *    without specific prior written permission.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + */
 +
 +#include <sys/cdefs.h>
 +#if defined(LIBC_SCCS) && !defined(lint)
 +__RCSID("$NetBSD$");
 +#endif /* LIBC_SCCS and not lint */
 +
 +#include "namespace.h"
 +#include <inttypes.h>
 +
 +#ifdef __weak_alias
 +__weak_alias(imaxabs, _imaxabs)
 +#endif
 +
 +#define	_INTTYPE	intmax_t
 +#define	_FUNCNAME	imaxabs
 +
 +#include "_abs_template.h"
 Index: lib/libc/stdlib/imaxdiv.c
 ===================================================================
 RCS file: lib/libc/stdlib/imaxdiv.c
 diff -N lib/libc/stdlib/imaxdiv.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
 +++ lib/libc/stdlib/imaxdiv.c	22 Mar 2006 12:40:28 -0000
 @@ -0,0 +1,51 @@
 +/*	$NetBSD$	*/
 +
 +/*
 + * Copyright (c) 1990, 1993
 + *	The Regents of the University of California.  All rights reserved.
 + *
 + * This code is derived from software contributed to Berkeley by
 + * Chris Torek.
 + *
 + * Redistribution and use in source and binary forms, with or without
 + * modification, are permitted provided that the following conditions
 + * are met:
 + * 1. Redistributions of source code must retain the above copyright
 + *    notice, this list of conditions and the following disclaimer.
 + * 2. Redistributions in binary form must reproduce the above copyright
 + *    notice, this list of conditions and the following disclaimer in the
 + *    documentation and/or other materials provided with the distribution.
 + * 3. Neither the name of the University nor the names of its contributors
 + *    may be used to endorse or promote products derived from this software
 + *    without specific prior written permission.
 + *
 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 + * SUCH DAMAGE.
 + */
 +
 +#include <sys/cdefs.h>
 +#if defined(LIBC_SCCS) && !defined(lint)
 +__RCSID("$NetBSD$");
 +#endif /* LIBC_SCCS and not lint */
 +
 +#include "namespace.h"
 +#include <inttypes.h>		/* imaxdiv_t */
 +
 +#ifdef __weak_alias
 +__weak_alias(imaxdiv, _imaxdiv)
 +#endif
 +
 +#define	_DIVTYPE	imaxdiv_t
 +#define	_FUNCNAME	imaxdiv
 +#define	_INTTYPE	intmax_t
 +
 +#include "_div_template.h"
 Index: lib/libc/stdlib/labs.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/labs.c,v
 retrieving revision 1.7
 diff -u -r1.7 labs.c
 --- lib/libc/stdlib/labs.c	7 Aug 2003 16:43:41 -0000	1.7
 +++ lib/libc/stdlib/labs.c	22 Mar 2006 12:40:31 -0000
 @@ -40,9 +40,7 @@
  
  #include <stdlib.h>
  
 -long
 -labs(j)
 -	long j;
 -{
 -	return(j < 0 ? -j : j);
 -}
 +#define	_INTTYPE	long
 +#define	_FUNCNAME	labs
 +
 +#include "_abs_template.h"
 Index: lib/libc/stdlib/ldiv.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/ldiv.c,v
 retrieving revision 1.7
 diff -u -r1.7 ldiv.c
 --- lib/libc/stdlib/ldiv.c	7 Aug 2003 16:43:41 -0000	1.7
 +++ lib/libc/stdlib/ldiv.c	22 Mar 2006 12:40:31 -0000
 @@ -43,19 +43,8 @@
  
  #include <stdlib.h>		/* ldiv_t */
  
 -ldiv_t
 -ldiv(num, denom)
 -	long num, denom;
 -{
 -	ldiv_t r;
 +#define	_DIVTYPE	ldiv_t
 +#define	_FUNCNAME	ldiv
 +#define	_INTTYPE	long
  
 -	/* see div.c for comments */
 -
 -	r.quot = num / denom;
 -	r.rem = num % denom;
 -	if (num >= 0 && r.rem < 0) {
 -		r.quot++;
 -		r.rem -= denom;
 -	}
 -	return (r);
 -}
 +#include "_div_template.h"
 Index: lib/libc/stdlib/llabs.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/llabs.c,v
 retrieving revision 1.3
 diff -u -r1.3 llabs.c
 --- lib/libc/stdlib/llabs.c	7 Aug 2003 16:43:41 -0000	1.3
 +++ lib/libc/stdlib/llabs.c	22 Mar 2006 12:40:31 -0000
 @@ -45,10 +45,7 @@
  __weak_alias(llabs, _llabs)
  #endif
  
 -/* LONGLONG */
 -long long int
 -llabs(j)
 -	long long int j;
 -{
 -	return (j < 0 ? -j : j);
 -}
 +#define	_INTTYPE	/* LONGLONG */ long long int
 +#define	_FUNCNAME	llabs
 +
 +#include "_abs_template.h"
 Index: lib/libc/stdlib/lldiv.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/lldiv.c,v
 retrieving revision 1.3
 diff -u -r1.3 lldiv.c
 --- lib/libc/stdlib/lldiv.c	7 Aug 2003 16:43:41 -0000	1.3
 +++ lib/libc/stdlib/lldiv.c	22 Mar 2006 12:40:31 -0000
 @@ -48,20 +48,8 @@
  __weak_alias(lldiv, _lldiv)
  #endif
  
 -/* LONGLONG */
 -lldiv_t
 -lldiv(num, denom)
 -	long long int num, denom;
 -{
 -	lldiv_t r;
 +#define	_DIVTYPE	lldiv_t
 +#define	_FUNCNAME	lldiv
 +#define	_INTTYPE	/* LONGLONG */ long long int
  
 -	/* see div.c for comments */
 -
 -	r.quot = num / denom;
 -	r.rem = num % denom;
 -	if (num >= 0 && r.rem < 0) {
 -		r.quot++;
 -		r.rem -= denom;
 -	}
 -	return (r);
 -}
 +#include "_div_template.h"
 Index: lib/libc/stdlib/qabs.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/qabs.c,v
 retrieving revision 1.6
 diff -u -r1.6 qabs.c
 --- lib/libc/stdlib/qabs.c	7 Aug 2003 16:43:42 -0000	1.6
 +++ lib/libc/stdlib/qabs.c	22 Mar 2006 12:40:31 -0000
 @@ -45,9 +45,7 @@
  __weak_alias(qabs,_qabs)
  #endif
  
 -quad_t
 -qabs(j)
 -	quad_t j;
 -{
 -	return(j < 0 ? -j : j);
 -}
 +#define	_INTTYPE	quad_t
 +#define	_FUNCNAME	qabs
 +
 +#include "_abs_template.h"
 Index: lib/libc/stdlib/qdiv.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/stdlib/qdiv.c,v
 retrieving revision 1.6
 diff -u -r1.6 qdiv.c
 --- lib/libc/stdlib/qdiv.c	7 Aug 2003 16:43:42 -0000	1.6
 +++ lib/libc/stdlib/qdiv.c	22 Mar 2006 12:40:31 -0000
 @@ -48,19 +48,8 @@
  __weak_alias(qdiv,_qdiv)
  #endif
  
 -qdiv_t
 -qdiv(num, denom)
 -	quad_t num, denom;
 -{
 -	qdiv_t r;
 +#define	_DIVTYPE	qdiv_t
 +#define	_FUNCNAME	qdiv
 +#define	_INTTYPE	quad_t
  
 -	/* see div.c for comments */
 -
 -	r.quot = num / denom;
 -	r.rem = num % denom;
 -	if (num >= 0 && r.rem < 0) {
 -		r.quot++;
 -		r.rem -= denom;
 -	}
 -	return (r);
 -}
 +#include "_div_template.h"
 
 --Multipart_Wed_Mar_22_22:04:58_2006-1
 Content-Type: text/plain; charset=US-ASCII
 
 
 
 
 --Multipart_Wed_Mar_22_22:04:58_2006-1--