atoll.c revision 251069
1178172Simp/* 2206714Sjmallett * Copyright (c) 1988, 1993 3178172Simp * The Regents of the University of California. All rights reserved. 4178172Simp * 5178172Simp * Copyright (c) 2011 The FreeBSD Foundation 6178172Simp * All rights reserved. 7178172Simp * Portions of this software were developed by David Chisnall 8178172Simp * under sponsorship from the FreeBSD Foundation. 9178172Simp * 10178172Simp * Redistribution and use in source and binary forms, with or without 11178172Simp * modification, are permitted provided that the following conditions 12178172Simp * are met: 13178172Simp * 1. Redistributions of source code must retain the above copyright 14178172Simp * notice, this list of conditions and the following disclaimer. 15178172Simp * 2. Redistributions in binary form must reproduce the above copyright 16178172Simp * notice, this list of conditions and the following disclaimer in the 17178172Simp * documentation and/or other materials provided with the distribution. 18178172Simp * 3. Neither the name of the University nor the names of its contributors 19178172Simp * may be used to endorse or promote products derived from this software 20178172Simp * without specific prior written permission. 21178172Simp * 22178172Simp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23178172Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24178172Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25178172Simp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26178172Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27178172Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28178172Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29178172Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30206714Sjmallett * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31178172Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32217944Sjchandra * SUCH DAMAGE. 33217944Sjchandra */ 34217944Sjchandra 35217944Sjchandra#include <sys/cdefs.h> 36217944Sjchandra__FBSDID("$FreeBSD: head/lib/libc/stdlib/atoll.c 251069 2013-05-28 20:57:40Z emaste $"); 37178172Simp 38217944Sjchandra#include <stdlib.h> 39178172Simp#include <xlocale.h> 40217944Sjchandra 41217944Sjchandralong long 42217944Sjchandraatoll(str) 43217944Sjchandra const char *str; 44255289Sglebius{ 45255289Sglebius return strtoll(str, (char **)NULL, 10); 46255289Sglebius} 47255289Sglebius 48255289Sglebiuslong long 49255289Sglebiusatoll_l(str, locale) 50255289Sglebius const char *str; 51255289Sglebius locale_t locale; 52255289Sglebius{ 53255289Sglebius return strtoll_l(str, (char **)NULL, 10, locale); 54255289Sglebius} 55255289Sglebius