1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "A64L" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" a64l
.SH NAME
a64l, l64a \- convert between a 32-bit integer and a radix-64 ASCII
string
.SH SYNOPSIS
.LP
\fB#include <stdlib.h>
.br
.sp
long a64l(const char *\fP\fIs\fP\fB);
.br
char *l64a(long\fP \fIvalue\fP\fB); \fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
These functions maintain numbers stored in radix-64 ASCII characters.
This is a notation by which 32-bit integers can be
represented by up to six characters; each character represents a digit
in radix-64 notation. If the type \fBlong\fP contains more
than 32 bits, only the low-order 32 bits shall be used for these operations.
.LP
The characters used to represent digits are \fB'.'\fP (dot) for 0,
\fB'/'\fP for 1, \fB'0'\fP through \fB'9'\fP for
[2,11], \fB'A'\fP through \fB'Z'\fP for [12,37], and \fB'a'\fP through
\fB'z'\fP for [38,63].
.LP
The \fIa64l\fP() function shall take a pointer to a radix-64 representation,
in which the first digit is the least significant,
and return the corresponding \fBlong\fP value. If the string pointed
to by \fIs\fP contains more than six characters,
\fIa64l\fP() shall use the first six. If the first six characters
of the string contain a null terminator, \fIa64l\fP() shall use
only characters preceding the null terminator. The \fIa64l\fP() function
shall scan the character string from left to right with
the least significant digit on the left, decoding each character as
a 6-bit radix-64 number. If the type \fBlong\fP contains more
than 32 bits, the resulting value is sign-extended. The behavior of
\fIa64l\fP() is unspecified if \fIs\fP is a null pointer or
the string pointed to by \fIs\fP was not generated by a previous call
to \fIl64a\fP().
.LP
The \fIl64a\fP() function shall take a \fBlong\fP argument and return
a pointer to the corresponding radix-64 representation.
The behavior of \fIl64a\fP() is unspecified if \fIvalue\fP is negative.
.LP
The value returned by \fIl64a\fP() may be a pointer into a static
buffer. Subsequent calls to \fIl64a\fP() may overwrite the
buffer.
.LP
The \fIl64a\fP() function need not be reentrant. A function that is
not required to be reentrant is not required to be
thread-safe.
.SH RETURN VALUE
.LP
Upon successful completion, \fIa64l\fP() shall return the \fBlong\fP
value resulting from conversion of the input string. If a
string pointed to by \fIs\fP is an empty string, \fIa64l\fP() shall
return 0L.
.LP
The \fIl64a\fP() function shall return a pointer to the radix-64 representation.
If \fIvalue\fP is 0L, \fIl64a\fP() shall
return a pointer to an empty string.
.SH ERRORS
.LP
No errors are defined.
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.LP
None.
.SH APPLICATION USAGE
.LP
If the type \fBlong\fP contains more than 32 bits, the result of \fIa64l\fP(\fIl64a\fP(\fIx\fP))
is \fIx\fP in the
low-order 32 bits.
.SH RATIONALE
.LP
This is not the same encoding as used by either encoding variant of
the \fIuuencode\fP
utility.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIstrtoul\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001,
\fI<stdlib.h>\fP, the Shell and Utilities volume of IEEE\ Std\ 1003.1-2001,
\fIuuencode\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
|