xref: /netbsd-src/lib/libc/stdlib/atoll.c (revision 9e66e6d75e9910b3de5f4ef031995955f69a7dd1)
1*9e66e6d7Sabs /*	$NetBSD: atoll.c,v 1.6 2012/06/25 22:32:45 abs Exp $	*/
2e4d7c2e3Skleink 
3e4d7c2e3Skleink /*
4e4d7c2e3Skleink  * Copyright (c) 1988, 1993
5e4d7c2e3Skleink  *	The Regents of the University of California.  All rights reserved.
6e4d7c2e3Skleink  *
7e4d7c2e3Skleink  * Redistribution and use in source and binary forms, with or without
8e4d7c2e3Skleink  * modification, are permitted provided that the following conditions
9e4d7c2e3Skleink  * are met:
10e4d7c2e3Skleink  * 1. Redistributions of source code must retain the above copyright
11e4d7c2e3Skleink  *    notice, this list of conditions and the following disclaimer.
12e4d7c2e3Skleink  * 2. Redistributions in binary form must reproduce the above copyright
13e4d7c2e3Skleink  *    notice, this list of conditions and the following disclaimer in the
14e4d7c2e3Skleink  *    documentation and/or other materials provided with the distribution.
15eb7c1594Sagc  * 3. Neither the name of the University nor the names of its contributors
16e4d7c2e3Skleink  *    may be used to endorse or promote products derived from this software
17e4d7c2e3Skleink  *    without specific prior written permission.
18e4d7c2e3Skleink  *
19e4d7c2e3Skleink  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20e4d7c2e3Skleink  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21e4d7c2e3Skleink  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22e4d7c2e3Skleink  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23e4d7c2e3Skleink  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24e4d7c2e3Skleink  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25e4d7c2e3Skleink  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26e4d7c2e3Skleink  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27e4d7c2e3Skleink  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28e4d7c2e3Skleink  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29e4d7c2e3Skleink  * SUCH DAMAGE.
30e4d7c2e3Skleink  */
31e4d7c2e3Skleink 
32171d6532Slukem #if HAVE_NBTOOL_CONFIG_H
33171d6532Slukem #include "nbtool_config.h"
34171d6532Slukem #endif
35171d6532Slukem 
36e4d7c2e3Skleink #include <sys/cdefs.h>
37e4d7c2e3Skleink #if defined(LIBC_SCCS) && !defined(lint)
38e4d7c2e3Skleink #if 0
39e4d7c2e3Skleink static char sccsid[] = "from: @(#)atol.c	8.1 (Berkeley) 6/4/93";
40e4d7c2e3Skleink #else
41*9e66e6d7Sabs __RCSID("$NetBSD: atoll.c,v 1.6 2012/06/25 22:32:45 abs Exp $");
42e4d7c2e3Skleink #endif
43e4d7c2e3Skleink #endif /* LIBC_SCCS and not lint */
44e4d7c2e3Skleink 
450bbb5874Suwe #ifdef _LIBC
46e4d7c2e3Skleink #include "namespace.h"
470bbb5874Suwe #endif
480bbb5874Suwe 
49e4d7c2e3Skleink #include <stdlib.h>
50e4d7c2e3Skleink 
510bbb5874Suwe #ifdef _LIBC
52e4d7c2e3Skleink #ifdef __weak_alias
__weak_alias(atoll,_atoll)53e4d7c2e3Skleink __weak_alias(atoll, _atoll)
54e4d7c2e3Skleink #endif
550bbb5874Suwe #endif
56e4d7c2e3Skleink 
570bbb5874Suwe #if !HAVE_ATOLL
584c3c49aeSkleink /* LONGLONG */
59e4d7c2e3Skleink long long int
60*9e66e6d7Sabs atoll(const char *str)
61e4d7c2e3Skleink {
62e4d7c2e3Skleink 	return (strtoll(str, (char **)NULL, 10));
63e4d7c2e3Skleink }
640bbb5874Suwe #endif
65