xref: /freebsd/lib/libc/stdlib/atoll.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
18a16b7a1SPedro F. Giffuni /*-
28a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
38a16b7a1SPedro F. Giffuni  *
459d01330SAndrey A. Chernov  * Copyright (c) 1988, 1993
559d01330SAndrey A. Chernov  *	The Regents of the University of California.  All rights reserved.
659d01330SAndrey A. Chernov  *
73c87aa1dSDavid Chisnall  * Copyright (c) 2011 The FreeBSD Foundation
8*5b5fa75aSEd Maste  *
93c87aa1dSDavid Chisnall  * Portions of this software were developed by David Chisnall
103c87aa1dSDavid Chisnall  * under sponsorship from the FreeBSD Foundation.
113c87aa1dSDavid Chisnall  *
1259d01330SAndrey A. Chernov  * Redistribution and use in source and binary forms, with or without
1359d01330SAndrey A. Chernov  * modification, are permitted provided that the following conditions
1459d01330SAndrey A. Chernov  * are met:
1559d01330SAndrey A. Chernov  * 1. Redistributions of source code must retain the above copyright
1659d01330SAndrey A. Chernov  *    notice, this list of conditions and the following disclaimer.
1759d01330SAndrey A. Chernov  * 2. Redistributions in binary form must reproduce the above copyright
1859d01330SAndrey A. Chernov  *    notice, this list of conditions and the following disclaimer in the
1959d01330SAndrey A. Chernov  *    documentation and/or other materials provided with the distribution.
203fb3b97cSEd Maste  * 3. Neither the name of the University nor the names of its contributors
2159d01330SAndrey A. Chernov  *    may be used to endorse or promote products derived from this software
2259d01330SAndrey A. Chernov  *    without specific prior written permission.
2359d01330SAndrey A. Chernov  *
2459d01330SAndrey A. Chernov  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2559d01330SAndrey A. Chernov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2659d01330SAndrey A. Chernov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2759d01330SAndrey A. Chernov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2859d01330SAndrey A. Chernov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2959d01330SAndrey A. Chernov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3059d01330SAndrey A. Chernov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3159d01330SAndrey A. Chernov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3259d01330SAndrey A. Chernov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3359d01330SAndrey A. Chernov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3459d01330SAndrey A. Chernov  * SUCH DAMAGE.
3559d01330SAndrey A. Chernov  */
3659d01330SAndrey A. Chernov 
3759d01330SAndrey A. Chernov #include <stdlib.h>
383c87aa1dSDavid Chisnall #include <xlocale.h>
3959d01330SAndrey A. Chernov 
4059d01330SAndrey A. Chernov long long
atoll(const char * str)41f98e0c9dSCraig Rodrigues atoll(const char *str)
4259d01330SAndrey A. Chernov {
43f7388e0dSAndrey A. Chernov 	return strtoll(str, (char **)NULL, 10);
4459d01330SAndrey A. Chernov }
453c87aa1dSDavid Chisnall 
463c87aa1dSDavid Chisnall long long
atoll_l(const char * str,locale_t locale)47f98e0c9dSCraig Rodrigues atoll_l(const char *str, locale_t locale)
483c87aa1dSDavid Chisnall {
493c87aa1dSDavid Chisnall 	return strtoll_l(str, (char **)NULL, 10, locale);
503c87aa1dSDavid Chisnall }
51