xref: /netbsd-src/lib/libc/stdlib/a64l.3 (revision dc306354b0b29af51801a7632f1e95265a68cd81)
1.\" $NetBSD: a64l.3,v 1.2 1998/06/14 17:54:59 kleink Exp $
2.\"
3.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Klaus Klein.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd June 14, 1998
38.Dt A64L 3
39.Os NetBSD 1.0
40.Sh NAME
41.Nm a64l ,
42.Nm l64a
43.Nd convert between a long integer and a base-64 ASCII string
44.Sh LIBRARY
45.Lb libc
46.Sh SYNOPSIS
47.Fd #include <stdlib.h>
48.Ft long
49.Fn a64l "const char *s"
50.Ft char *
51.Fn l64a "long l"
52.Sh DESCRIPTION
53The
54.Fn a64l
55and
56.Fn l64a
57functions convert between a long integer and its base-64 ASCII string
58representation.
59.Pp
60The characters used to represent ``digits'' are
61`.' for 0,
62`/' for 1,
63`0' - `9' for 2 - 11,
64`A' - `Z' for 12 - 37, and
65`a' - `z' for 38 - 63.
66.Pp
67.Fn a64l
68takes a pointer to a NUL-terminated base-64 ASCII string
69representation,
70.Fa s ,
71and returns the corresponding long integer value.
72.Pp
73.Fn l64a
74takes a long integer value,
75.Fa l ,
76and returns a pointer to the corresponding NUL-terminated base-64
77ASCII string representation.
78.Sh RETURN VALUES
79On successful completion,
80.Fn a64l
81returns the long integer value corresponding to the input string.
82If the string pointed to by
83.Fa s
84is an empty string,
85.Fn a64l
86returns a value of 0L.
87.Pp
88.Fn l64a
89returns a pointer to the base-64 ASCII string representation corresponding to
90the input value.
91If
92.Fa l
93is 0L,
94.Fn l64a
95returns a pointer to an empty string.
96.Sh SEE ALSO
97.Xr strtol 3
98.Sh BUGS
99The
100.Fn l64a
101function is not reentrant.  The value returned by it points into a
102static buffer area; subsequent calls to
103.Fn la64a
104may overwrite this buffer.
105