summaryrefslogtreecommitdiff
path: root/man3/a64l.3
blob: 9002d03dc94c700a68489519492f5408bc95f599 (plain)
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
.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\"
.\" Corrected, aeb, 2002-05-30
.\"
.TH A64L 3 2010-09-20 "" "Linux Programmer's Manual"
.SH NAME
a64l, l64a \- convert between long and base-64
.SH SYNOPSIS
.B #include <stdlib.h>
.sp
.BI "long a64l(char *" str64 );
.sp
.BI "char *l64a(long " value );
.sp
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.sp
.BR a64l (),
.BR l64a ():
.br
.RS 4
.ad l
_SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.RE
.ad
.SH DESCRIPTION
These functions provide a conversion between 32-bit long integers
and little-endian base-64 ASCII strings (of length zero to six).
If the string used as argument for
.BR a64l ()
has length greater than six, only the first six bytes are used.
If the type
.I long
has more than 32 bits, then
.BR l64a ()
uses only the low order 32 bits of
.IR value ,
and
.BR a64l ()
sign-extends its 32-bit result.
.LP
The 64 digits in the base-64 system are:
.RS
.nf

\&\(aq.\(aq	represents a 0
\&\(aq/\(aq	represents a 1
0-9	represent  2-11
A-Z	represent 12-37
a-z	represent 38-63

.fi
.RE
So 123 = 59*64^0 + 1*64^1 = "v/".
.SH CONFORMING TO
POSIX.1-2001.
.SH NOTES
The value returned by
.BR l64a ()
may be a pointer to a static buffer, possibly overwritten
by later calls.
.LP
The behavior of
.BR l64a ()
is undefined when
.I value
is negative.
If
.I value
is zero, it returns an empty string.
.LP
These functions are broken in glibc before 2.2.5
(puts most significant digit first).
.LP
This is not the encoding used by
.BR uuencode (1).
.SH SEE ALSO
.BR uuencode (1),
.\" .BR itoa (3),
.BR strtoul (3)