xref: /minix3/lib/libc/stdlib/a64l.3 (revision 2fe8fb192fe7e8720e3e7a77f928da545e872a6a)
1*2fe8fb19SBen Gras.\" $NetBSD: a64l.3,v 1.10 2010/05/06 18:55:34 jruoho Exp $
2*2fe8fb19SBen Gras.\"
3*2fe8fb19SBen Gras.\" Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
4*2fe8fb19SBen Gras.\" All rights reserved.
5*2fe8fb19SBen Gras.\"
6*2fe8fb19SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation
7*2fe8fb19SBen Gras.\" by Klaus Klein.
8*2fe8fb19SBen Gras.\"
9*2fe8fb19SBen Gras.\" Redistribution and use in source and binary forms, with or without
10*2fe8fb19SBen Gras.\" modification, are permitted provided that the following conditions
11*2fe8fb19SBen Gras.\" are met:
12*2fe8fb19SBen Gras.\" 1. Redistributions of source code must retain the above copyright
13*2fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer.
14*2fe8fb19SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright
15*2fe8fb19SBen Gras.\"    notice, this list of conditions and the following disclaimer in the
16*2fe8fb19SBen Gras.\"    documentation and/or other materials provided with the distribution.
17*2fe8fb19SBen Gras.\"
18*2fe8fb19SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19*2fe8fb19SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20*2fe8fb19SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21*2fe8fb19SBen Gras.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22*2fe8fb19SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23*2fe8fb19SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24*2fe8fb19SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25*2fe8fb19SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26*2fe8fb19SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27*2fe8fb19SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28*2fe8fb19SBen Gras.\" POSSIBILITY OF SUCH DAMAGE.
29*2fe8fb19SBen Gras.\"
30*2fe8fb19SBen Gras.Dd May 6, 2010
31*2fe8fb19SBen Gras.Dt A64L 3
32*2fe8fb19SBen Gras.Os
33*2fe8fb19SBen Gras.Sh NAME
34*2fe8fb19SBen Gras.Nm a64l ,
35*2fe8fb19SBen Gras.Nm l64a ,
36*2fe8fb19SBen Gras.Nm l64a_r
37*2fe8fb19SBen Gras.Nd "convert between a long integer and a base-64 ASCII string"
38*2fe8fb19SBen Gras.Sh LIBRARY
39*2fe8fb19SBen Gras.Lb libc
40*2fe8fb19SBen Gras.Sh SYNOPSIS
41*2fe8fb19SBen Gras.In stdlib.h
42*2fe8fb19SBen Gras.Ft long
43*2fe8fb19SBen Gras.Fn a64l "const char *s"
44*2fe8fb19SBen Gras.Ft char *
45*2fe8fb19SBen Gras.Fn l64a "long int l"
46*2fe8fb19SBen Gras.Ft int
47*2fe8fb19SBen Gras.Fn l64a_r "long int l" "char *buffer" "int buflen"
48*2fe8fb19SBen Gras.Sh DESCRIPTION
49*2fe8fb19SBen GrasThe
50*2fe8fb19SBen Gras.Fn a64l
51*2fe8fb19SBen Grasand
52*2fe8fb19SBen Gras.Fn l64a
53*2fe8fb19SBen Grasfunctions convert between a long integer and its base-64 ASCII string
54*2fe8fb19SBen Grasrepresentation.
55*2fe8fb19SBen Gras.Pp
56*2fe8fb19SBen GrasThe characters used to represent ``digits'' are
57*2fe8fb19SBen Gras`.' for 0,
58*2fe8fb19SBen Gras`/' for 1,
59*2fe8fb19SBen Gras`0' - `9' for 2 - 11,
60*2fe8fb19SBen Gras`A' - `Z' for 12 - 37, and
61*2fe8fb19SBen Gras`a' - `z' for 38 - 63.
62*2fe8fb19SBen Gras.Pp
63*2fe8fb19SBen Gras.Fn a64l
64*2fe8fb19SBen Grastakes a pointer to a NUL-terminated base-64 ASCII string
65*2fe8fb19SBen Grasrepresentation,
66*2fe8fb19SBen Gras.Fa s ,
67*2fe8fb19SBen Grasand returns the corresponding long integer value.
68*2fe8fb19SBen Gras.Pp
69*2fe8fb19SBen Gras.Fn l64a
70*2fe8fb19SBen Grastakes a long integer value,
71*2fe8fb19SBen Gras.Fa l ,
72*2fe8fb19SBen Grasand returns a pointer to the corresponding NUL-terminated base-64
73*2fe8fb19SBen GrasASCII string representation.
74*2fe8fb19SBen Gras.Pp
75*2fe8fb19SBen Gras.Fn l64a_r
76*2fe8fb19SBen Grasperforms a conversion identical to that of
77*2fe8fb19SBen Gras.Fn l64a
78*2fe8fb19SBen Grasand stores the resulting representation in the memory area pointed to by
79*2fe8fb19SBen Gras.Fa buffer ,
80*2fe8fb19SBen Grasconsuming at most
81*2fe8fb19SBen Gras.Fa buflen
82*2fe8fb19SBen Grascharacters including the terminating NUL character.
83*2fe8fb19SBen Gras.Sh RETURN VALUES
84*2fe8fb19SBen GrasOn successful completion,
85*2fe8fb19SBen Gras.Fn a64l
86*2fe8fb19SBen Grasreturns the long integer value corresponding to the input string.
87*2fe8fb19SBen GrasIf the string pointed to by
88*2fe8fb19SBen Gras.Fa s
89*2fe8fb19SBen Grasis an empty string,
90*2fe8fb19SBen Gras.Fn a64l
91*2fe8fb19SBen Grasreturns a value of 0L.
92*2fe8fb19SBen Gras.Pp
93*2fe8fb19SBen Gras.Fn l64a
94*2fe8fb19SBen Grasreturns a pointer to the base-64 ASCII string representation corresponding to
95*2fe8fb19SBen Grasthe input value.
96*2fe8fb19SBen GrasIf
97*2fe8fb19SBen Gras.Fa l
98*2fe8fb19SBen Grasis 0L,
99*2fe8fb19SBen Gras.Fn l64a
100*2fe8fb19SBen Grasreturns a pointer to an empty string.
101*2fe8fb19SBen Gras.Pp
102*2fe8fb19SBen GrasOn successful completion,
103*2fe8fb19SBen Gras.Fn l64a_r
104*2fe8fb19SBen Grasreturns 0; if
105*2fe8fb19SBen Gras.Fa buffer
106*2fe8fb19SBen Grasis of insufficient length, -1 is returned.
107*2fe8fb19SBen Gras.Sh SEE ALSO
108*2fe8fb19SBen Gras.Xr strtol 3
109*2fe8fb19SBen Gras.Sh STANDARDS
110*2fe8fb19SBen GrasThe
111*2fe8fb19SBen Gras.Fn a64l
112*2fe8fb19SBen Grasand
113*2fe8fb19SBen Gras.Fn l64a
114*2fe8fb19SBen Grasfunctions conform to
115*2fe8fb19SBen Gras.St -xpg4.2
116*2fe8fb19SBen Grasand
117*2fe8fb19SBen Gras.St -p1003.1-2004 .
118*2fe8fb19SBen GrasThe
119*2fe8fb19SBen Gras.Fn l64a_r
120*2fe8fb19SBen Grasfunction conforms to
121*2fe8fb19SBen Gras.St -svid4 ,
122*2fe8fb19SBen GrasMultithreading Extension.
123*2fe8fb19SBen Gras.Sh BUGS
124*2fe8fb19SBen GrasThe
125*2fe8fb19SBen Gras.Fn l64a
126*2fe8fb19SBen Grasfunction is not reentrant.
127*2fe8fb19SBen GrasThe value returned by it points into a static buffer area;
128*2fe8fb19SBen Grassubsequent calls to
129*2fe8fb19SBen Gras.Fn la64a
130*2fe8fb19SBen Grasmay overwrite this buffer.
131*2fe8fb19SBen GrasIn multi-threaded applications,
132*2fe8fb19SBen Gras.Fn l64a_r
133*2fe8fb19SBen Grasshould be used instead.
134