source: trunk/libs/newlib/src/newlib/libc/stdlib/atoll.c @ 471

Last change on this file since 471 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.9 KB
Line 
1/*
2FUNCTION
3<<atoll>>---convert a string to a long long integer
4
5INDEX
6        atoll
7INDEX
8        _atoll_r
9
10SYNOPSIS
11        #include <stdlib.h>
12        long long atoll(const char *<[str]>);
13        long long _atoll_r(struct _reent *<[ptr]>, const char *<[str]>);
14
15DESCRIPTION
16The function <<atoll>> converts the initial portion of the string
17pointed to by <<*<[str]>>> to a type <<long long>>.  A call to
18atoll(str) in this implementation is equivalent to
19strtoll(str, (char **)NULL, 10) including behavior on error.
20
21The alternate function <<_atoll_r>> is a reentrant version.  The
22extra argument <[reent]> is a pointer to a reentrancy structure.
23
24
25RETURNS
26The converted value.
27
28PORTABILITY
29<<atoll>> is ISO 9899 (C99) and POSIX 1003.1-2001 compatable.
30
31No supporting OS subroutines are required.
32*/
33
34/*
35 * Copyright (c) 1988, 1993
36 *      The Regents of the University of California.  All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 *    notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 *    notice, this list of conditions and the following disclaimer in the
45 *    documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 *    must display the following acknowledgement:
48 *      This product includes software developed by the University of
49 *      California, Berkeley and its contributors.
50 * 4. Neither the name of the University nor the names of its contributors
51 *    may be used to endorse or promote products derived from this software
52 *    without specific prior written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * SUCH DAMAGE.
65 */
66
67#include <stdlib.h>
68#include <stddef.h>
69
70#ifndef _REENT_ONLY
71long long
72atoll (const char *str)
73{
74        return strtoll(str, (char **)NULL, 10);
75}
76#endif /* !_REENT_ONLY */
77
78long long
79_atoll_r (struct _reent *ptr,
80       const char *str)
81{
82        return _strtoll_r(ptr, str, (char **)NULL, 10);
83}
Note: See TracBrowser for help on using the repository browser.