xref: /netbsd-src/lib/libc/stdlib/strtol.c (revision 245e0863216f2e322e734df6d0e4602535807ffa)
1*245e0863Sjoerg /* $NetBSD: strtol.c,v 1.18 2008/08/20 12:42:26 joerg Exp $ */
26dda330eSthorpej 
361f28255Scgd /*-
4*245e0863Sjoerg  * Copyright (c) 2005 The DragonFly Project.  All rights reserved.
5*245e0863Sjoerg  * Copyright (c) 2003 Citrus Project,
6*245e0863Sjoerg  * All rights reserved.
761f28255Scgd  *
861f28255Scgd  * Redistribution and use in source and binary forms, with or without
961f28255Scgd  * modification, are permitted provided that the following conditions
1061f28255Scgd  * are met:
1161f28255Scgd  * 1. Redistributions of source code must retain the above copyright
1261f28255Scgd  *    notice, this list of conditions and the following disclaimer.
1361f28255Scgd  * 2. Redistributions in binary form must reproduce the above copyright
1461f28255Scgd  *    notice, this list of conditions and the following disclaimer in the
1561f28255Scgd  *    documentation and/or other materials provided with the distribution.
1661f28255Scgd  *
17*245e0863Sjoerg  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1861f28255Scgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1961f28255Scgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*245e0863Sjoerg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2161f28255Scgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2261f28255Scgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2361f28255Scgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2461f28255Scgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2561f28255Scgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2661f28255Scgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2761f28255Scgd  * SUCH DAMAGE.
2861f28255Scgd  */
2961f28255Scgd 
30bd906777Schristos #include <sys/cdefs.h>
31*245e0863Sjoerg __RCSID("$NetBSD: strtol.c,v 1.18 2008/08/20 12:42:26 joerg Exp $");
3261f28255Scgd 
33b48252f3Slukem #include <assert.h>
3461f28255Scgd #include <ctype.h>
3561f28255Scgd #include <errno.h>
36e0c0c474Smycroft #include <limits.h>
37*245e0863Sjoerg #include <stdint.h>
3861f28255Scgd #include <stdlib.h>
3961f28255Scgd 
40*245e0863Sjoerg #define	_FUNCNAME	strtol
41*245e0863Sjoerg #define	__INT		long
42*245e0863Sjoerg #define	__INT_MIN	LONG_MIN
43*245e0863Sjoerg #define	__INT_MAX	LONG_MAX
4461f28255Scgd 
45*245e0863Sjoerg #include "_strtol.h"
46