xref: /netbsd-src/common/lib/libc/stdlib/strtoumax.c (revision a67fde035671e323b0b50374f03950beac2f97f2)
1*a67fde03Sjoerg /* $NetBSD: strtoumax.c,v 1.6 2013/04/16 21:44:06 joerg Exp $ */
27d3d66c9Sthorpej 
3245e0863Sjoerg /*-
4245e0863Sjoerg  * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
5245e0863Sjoerg  * Copyright (c) 2003 Citrus Project,
6245e0863Sjoerg  * All rights reserved.
77d3d66c9Sthorpej  *
87d3d66c9Sthorpej  * Redistribution and use in source and binary forms, with or without
97d3d66c9Sthorpej  * modification, are permitted provided that the following conditions
107d3d66c9Sthorpej  * are met:
117d3d66c9Sthorpej  * 1. Redistributions of source code must retain the above copyright
127d3d66c9Sthorpej  *    notice, this list of conditions and the following disclaimer.
137d3d66c9Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
147d3d66c9Sthorpej  *    notice, this list of conditions and the following disclaimer in the
157d3d66c9Sthorpej  *    documentation and/or other materials provided with the distribution.
167d3d66c9Sthorpej  *
17245e0863Sjoerg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
187d3d66c9Sthorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
197d3d66c9Sthorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20245e0863Sjoerg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
217d3d66c9Sthorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
227d3d66c9Sthorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
237d3d66c9Sthorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
247d3d66c9Sthorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
257d3d66c9Sthorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
267d3d66c9Sthorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
277d3d66c9Sthorpej  * SUCH DAMAGE.
287d3d66c9Sthorpej  */
297d3d66c9Sthorpej 
303ae58345Sjoerg #if HAVE_NBTOOL_CONFIG_H
313ae58345Sjoerg #include "nbtool_config.h"
323ae58345Sjoerg #endif
333ae58345Sjoerg 
347d3d66c9Sthorpej #include <sys/cdefs.h>
35*a67fde03Sjoerg __RCSID("$NetBSD: strtoumax.c,v 1.6 2013/04/16 21:44:06 joerg Exp $");
36331139bdSmatt 
37331139bdSmatt #ifdef _LIBC
38331139bdSmatt #include "namespace.h"
39331139bdSmatt #endif
407d3d66c9Sthorpej 
415577c7fcSoster #if defined(_KERNEL)
425577c7fcSoster #include <sys/param.h>
435577c7fcSoster #include <lib/libkern/libkern.h>
445577c7fcSoster #elif defined(_STANDALONE)
455577c7fcSoster #include <sys/param.h>
465577c7fcSoster #include <lib/libkern/libkern.h>
475577c7fcSoster #include <lib/libsa/stand.h>
485577c7fcSoster #else
497d3d66c9Sthorpej #include <assert.h>
507d3d66c9Sthorpej #include <ctype.h>
517d3d66c9Sthorpej #include <errno.h>
527d3d66c9Sthorpej #include <inttypes.h>
535577c7fcSoster #include <limits.h>
54245e0863Sjoerg #include <stdint.h>
55245e0863Sjoerg #include <stdlib.h>
567d3d66c9Sthorpej #endif
57245e0863Sjoerg 
58245e0863Sjoerg #define	_FUNCNAME	strtoumax
59245e0863Sjoerg #define	__UINT		uintmax_t
60245e0863Sjoerg #define	__UINT_MAX	UINTMAX_MAX
61245e0863Sjoerg 
62245e0863Sjoerg #include "_strtoul.h"
63245e0863Sjoerg 
64331139bdSmatt #ifdef _LIBC
65331139bdSmatt __weak_alias(strtoumax, _strtoumax)
66*a67fde03Sjoerg __weak_alias(strtoumax_l, _strtoumax_l)
677d3d66c9Sthorpej #endif
68