xref: /illumos-gate/usr/src/lib/libc/port/i18n/wstoll.c (revision 41e0a469c3dbc14deb2b200f6ca6f6e00b5865d0)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1986 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #pragma weak _wstoll = wstoll
31 #pragma weak _watoll = watoll
32 
33 #include "lint.h"
34 #include <wchar.h>
35 #include <widec.h>
36 
37 #undef watoll
38 
39 /*
40  * watoll() is defined as a macro in <widec.h> from 4/94.
41  * It was a real function in libc in the earlier releases.
42  * For binary comapatibility of the apps that were compiled
43  * with earlier releases of Solaris 2.x which had watoll,
44  * we provide watoll() as a function here as well.
45  * PSARC opinion: PSARC/1993/121, approved on 3/11/93
46  */
47 long long
48 watoll(const wchar_t *p)
49 {
50 	return (wcstoll(p, NULL, 10));
51 }
52 
53 long long
54 wstoll(const wchar_t *str, wchar_t **ptr, int base)
55 {
56 	return (wcstoll(str, ptr, base));
57 }
58