xref: /netbsd-src/common/lib/libc/stdlib/strtoul.c (revision 5577c7fceb0a6dc892994fc5e1aa7693a09cba10)
1*5577c7fcSoster /* $NetBSD: strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp $ */
237c9f0a6Schristos 
3245e0863Sjoerg /*-
4245e0863Sjoerg  * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
5245e0863Sjoerg  * Copyright (c) 2003 Citrus Project,
6245e0863Sjoerg  * All rights reserved.
737c9f0a6Schristos  *
837c9f0a6Schristos  * Redistribution and use in source and binary forms, with or without
937c9f0a6Schristos  * modification, are permitted provided that the following conditions
1037c9f0a6Schristos  * are met:
1137c9f0a6Schristos  * 1. Redistributions of source code must retain the above copyright
1237c9f0a6Schristos  *    notice, this list of conditions and the following disclaimer.
1337c9f0a6Schristos  * 2. Redistributions in binary form must reproduce the above copyright
1437c9f0a6Schristos  *    notice, this list of conditions and the following disclaimer in the
1537c9f0a6Schristos  *    documentation and/or other materials provided with the distribution.
1637c9f0a6Schristos  *
17245e0863Sjoerg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1837c9f0a6Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1937c9f0a6Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20245e0863Sjoerg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2137c9f0a6Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2237c9f0a6Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2337c9f0a6Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2437c9f0a6Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2537c9f0a6Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2637c9f0a6Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2737c9f0a6Schristos  * SUCH DAMAGE.
2837c9f0a6Schristos  */
2937c9f0a6Schristos 
3037c9f0a6Schristos #include <sys/cdefs.h>
31*5577c7fcSoster __RCSID("$NetBSD: strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp $");
3237c9f0a6Schristos 
33*5577c7fcSoster #if defined(_KERNEL)
34*5577c7fcSoster #include <sys/param.h>
35*5577c7fcSoster #include <lib/libkern/libkern.h>
36*5577c7fcSoster #elif defined(_STANDALONE)
37*5577c7fcSoster #include <sys/param.h>
38*5577c7fcSoster #include <lib/libkern/libkern.h>
39*5577c7fcSoster #include <lib/libsa/stand.h>
40*5577c7fcSoster #else
4137c9f0a6Schristos #include <assert.h>
4237c9f0a6Schristos #include <ctype.h>
4337c9f0a6Schristos #include <errno.h>
4437c9f0a6Schristos #include <limits.h>
45245e0863Sjoerg #include <stdint.h>
4637c9f0a6Schristos #include <stdlib.h>
4737c9f0a6Schristos #endif
4837c9f0a6Schristos 
49245e0863Sjoerg #define	_FUNCNAME	strtoul
50245e0863Sjoerg #define	__UINT		unsigned long int
51245e0863Sjoerg #define	__UINT_MAX	ULONG_MAX
5237c9f0a6Schristos 
53245e0863Sjoerg #include "_strtoul.h"
54