1*df83713dSchristos /* $NetBSD: strtoi.c,v 1.1.1.1 2020/06/15 01:52:54 christos Exp $ */ 2*df83713dSchristos 3*df83713dSchristos /*- 4*df83713dSchristos * Copyright (c) 2005 The DragonFly Project. All rights reserved. 5*df83713dSchristos * Copyright (c) 2003 Citrus Project, 6*df83713dSchristos * All rights reserved. 7*df83713dSchristos * 8*df83713dSchristos * Redistribution and use in source and binary forms, with or without 9*df83713dSchristos * modification, are permitted provided that the following conditions 10*df83713dSchristos * are met: 11*df83713dSchristos * 1. Redistributions of source code must retain the above copyright 12*df83713dSchristos * notice, this list of conditions and the following disclaimer. 13*df83713dSchristos * 2. Redistributions in binary form must reproduce the above copyright 14*df83713dSchristos * notice, this list of conditions and the following disclaimer in the 15*df83713dSchristos * documentation and/or other materials provided with the distribution. 16*df83713dSchristos * 17*df83713dSchristos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18*df83713dSchristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19*df83713dSchristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20*df83713dSchristos * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21*df83713dSchristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22*df83713dSchristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23*df83713dSchristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24*df83713dSchristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25*df83713dSchristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26*df83713dSchristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27*df83713dSchristos * SUCH DAMAGE. 28*df83713dSchristos * 29*df83713dSchristos * Created by Kamil Rytarowski, based on ID: 30*df83713dSchristos * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp 31*df83713dSchristos */ 32*df83713dSchristos #ifdef HAVE_CONFIG_H 33*df83713dSchristos #include "config.h" 34*df83713dSchristos #endif 35*df83713dSchristos 36*df83713dSchristos #include <sys/cdefs.h> 37*df83713dSchristos __RCSID("$NetBSD: strtoi.c,v 1.1.1.1 2020/06/15 01:52:54 christos Exp $"); 38*df83713dSchristos 39*df83713dSchristos #if defined(_KERNEL) 40*df83713dSchristos #include <sys/param.h> 41*df83713dSchristos #include <sys/types.h> 42*df83713dSchristos #include <lib/libkern/libkern.h> 43*df83713dSchristos #elif defined(_STANDALONE) 44*df83713dSchristos #include <sys/param.h> 45*df83713dSchristos #include <sys/types.h> 46*df83713dSchristos #include <lib/libkern/libkern.h> 47*df83713dSchristos #include <lib/libsa/stand.h> 48*df83713dSchristos #else 49*df83713dSchristos #include <stddef.h> 50*df83713dSchristos #include <assert.h> 51*df83713dSchristos #include <errno.h> 52*df83713dSchristos #include <inttypes.h> 53*df83713dSchristos #endif 54*df83713dSchristos 55*df83713dSchristos #define _FUNCNAME strtoi 56*df83713dSchristos #define __TYPE intmax_t 57*df83713dSchristos #define __WRAPPED strtoimax 58*df83713dSchristos 59*df83713dSchristos #if !HAVE_STRTOI 60*df83713dSchristos #include "_strtoi.h" 61*df83713dSchristos #endif 62