1 .\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. The name of the author may not be used to endorse or promote products
13 .\" derived from this software without specific prior written permission.
15 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17 .\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18 .\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 .\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 .\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 .\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 .\" $OpenBSD: a64l.3,v 1.5 2000/04/20 13:50:01 aaron Exp $
34 .Nd convert between 32-bit integer and radix-64 ASCII string
36 .Fd #include <stdlib.h>
38 .Fn a64l "const char *s"
46 functions are used to maintain numbers stored in radix-64
49 This is a notation by which 32-bit integers
50 can be represented by up to six characters; each character represents a
52 in a radix-64 notation.
54 The characters used to represent digits are
74 function takes a pointer to a null-terminated radix-64 representation
75 and returns a corresponding 32-bit value.
76 If the string pointed to by
78 contains more than six characters,
80 will use the first six.
82 scans the character string from left to right, decoding
83 each character as a 6-bit radix-64 number.
85 larger than 32 bits, the return value will be sign-extended.
88 takes a long integer argument
90 and returns a pointer to the corresponding radix-64 representation.
94 returns a 32-bit representation of
98 is a null pointer or if it contains digits other than those described above.
100 returns \-1 and sets the global variable
107 returns a pointer to a string containing the radix-64 representation of
113 returns a pointer to the empty string.
118 returns a null pointer and sets the global variable
123 The value returned by
125 is a pointer into a static buffer, the contents of which
126 will be overwritten by subsequent calls.
128 The value returned by
130 may be incorrect if the value is too large; for that reason, only strings
131 that resulted from a call to
133 should be used to call
136 If a long integer is larger than 32 bits, only the low-order