xref: /illumos-gate/usr/src/lib/libc/port/i18n/wstoll.c (revision 643e2e74e1c00e6b3d1896a6a67dbdb7308135c3)
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 ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #pragma weak _wstoll = wstoll
33 #pragma weak _watoll = watoll
34 
35 #include "lint.h"
36 #include <wchar.h>
37 #include <widec.h>
38 
39 #undef watoll
40 
41 /*
42  * watoll() is defined as a macro in <widec.h> from 4/94.
43  * It was a real function in libc in the earlier releases.
44  * For binary comapatibility of the apps that were compiled
45  * with earlier releases of Solaris 2.x which had watoll,
46  * we provide watoll() as a function here as well.
47  * PSARC opinion: PSARC/1993/121, approved on 3/11/93
48  */
49 long long
50 watoll(const wchar_t *p)
51 {
52 	return (wcstoll(p, NULL, 10));
53 }
54 
55 long long
56 wstoll(const wchar_t *str, wchar_t **ptr, int base)
57 {
58 	return (wcstoll(str, ptr, base));
59 }
60