8fbf3d50e3
PR: 191174 Submitted by: Franco Fichtner <franco at lastsummer.de>
188 lines
4.8 KiB
Groff
188 lines
4.8 KiB
Groff
.\" Copyright (c) 2005 Tom Rhodes
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" Portions of this text are reprinted and reproduced in electronic form
|
|
.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
|
|
.\" Portable Operating System Interface (POSIX), The Open Group Base
|
|
.\" Specifications Issue 6, Copyright (C) 2001-2004 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.
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd November 20, 2005
|
|
.Dt A64L 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm a64l ,
|
|
.Nm l64a ,
|
|
.Nm l64a_r
|
|
.Nd "convert between a long integer and a base-64 ASCII string"
|
|
.Sh LIBRARY
|
|
.Lb libc
|
|
.Sh SYNOPSIS
|
|
.In stdlib.h
|
|
.Ft long
|
|
.Fn a64l "const char *s"
|
|
.Ft char *
|
|
.Fn l64a "long int l"
|
|
.Ft int
|
|
.Fn l64a_r "long int l" "char *buffer" "int buflen"
|
|
.Sh DESCRIPTION
|
|
These functions are used to maintain numbers stored in radix-64
|
|
.Tn 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 long contains more than 32 bits, only the low-order
|
|
32 bits are used for these operations.
|
|
.Pp
|
|
The characters used to represent
|
|
.Dq digits
|
|
are
|
|
.Ql .\&
|
|
for 0,
|
|
.Ql /
|
|
for 1,
|
|
.Ql 0
|
|
-
|
|
.Ql 9
|
|
for 2 - 11,
|
|
.Ql A
|
|
-
|
|
.Ql Z
|
|
for 12 - 37, and
|
|
.Ql a
|
|
-
|
|
.Ql z
|
|
for 38 - 63.
|
|
.Pp
|
|
The
|
|
.Fn a64l
|
|
function takes a pointer to a radix-64 representation, in which the first
|
|
digit is the least significant, and returns a corresponding
|
|
.Vt long
|
|
value.
|
|
If the string pointed to by
|
|
.Fa s
|
|
contains more than six characters,
|
|
.Fn a64l
|
|
uses the first six.
|
|
If the first six characters of the string contain a null terminator,
|
|
.Fn a64l
|
|
uses only characters preceding the null terminator.
|
|
The
|
|
.Fn a64l
|
|
function scans 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 long contains more than 32 bits, the resulting value is
|
|
sign-extended.
|
|
The behavior of
|
|
.Fn a64l
|
|
is unspecified if
|
|
.Fa s
|
|
is a null pointer or the string pointed to by
|
|
.Fa s
|
|
was not generated by a previous call to
|
|
.Fn l64a .
|
|
.Pp
|
|
The
|
|
.Fn l64a
|
|
function takes a
|
|
.Vt long
|
|
argument and returns a pointer to the corresponding
|
|
radix-64 representation.
|
|
The behavior of
|
|
.Fn l64a
|
|
is unspecified if value is negative.
|
|
.Pp
|
|
The value returned by
|
|
.Fn l64a
|
|
is a pointer into a static buffer.
|
|
Subsequent calls to
|
|
.Fn l64a
|
|
may overwrite the buffer.
|
|
.Pp
|
|
The
|
|
.Fn l64a_r
|
|
function performs a conversion identical to that of
|
|
.Fn l64a
|
|
and stores the resulting representation in the memory area pointed to by
|
|
.Fa buffer ,
|
|
consuming at most
|
|
.Fa buflen
|
|
characters including the terminating
|
|
.Dv NUL
|
|
character.
|
|
.Sh RETURN VALUES
|
|
On successful completion,
|
|
.Fn a64l
|
|
returns the
|
|
.Vt long
|
|
value resulting from conversion of the input string.
|
|
If a string pointed to by
|
|
.Fa s
|
|
is an empty string,
|
|
.Fn a64l
|
|
returns 0.
|
|
.Pp
|
|
The
|
|
.Fn l64a
|
|
function returns a pointer to the radix-64 representation.
|
|
If value is 0,
|
|
.Fn l64a
|
|
returns a pointer to an empty string.
|
|
.Sh SEE ALSO
|
|
.Xr strtoul 3
|
|
.Sh HISTORY
|
|
The
|
|
.Fn a64l ,
|
|
.Fn l64a ,
|
|
and
|
|
.Fn l64a_r
|
|
functions are derived from
|
|
.Nx
|
|
with modifications.
|
|
They appeared in
|
|
.Fx 6.1 .
|
|
.Sh AUTHORS
|
|
The
|
|
.Fn a64l ,
|
|
.Fn l64a ,
|
|
and
|
|
.Fn l64a_r
|
|
functions
|
|
were added to
|
|
.Fx
|
|
by
|
|
.An Tom Rhodes Aq Mt trhodes@FreeBSD.org .
|
|
Almost all of this manual page came from the
|
|
.Tn POSIX
|
|
standard.
|