Introduction to Library Functions puidnetd_puid2str(3)
NAME
puidnetd_puid2str() - convert a PUID to string
SYNOPSIS
#include "puid_types.h"
#include "puidnetd.h"
char *puidnetd_puid2str(puid_t puid, char *abuf, size_t
abufl);
DESCRIPTION
The puidnetd_puid2str() function converts a PUID, stored in
a puid_t variable, to a string, suitable for printing. The
string is formated in "official" PUID format: five digits,
including leading zeroes; followed by a minus sign ('-');
followed by five digits, including leading zeroes.
The function resides in the PUID external library,
libpuidX.a, so a suitable -L option must be supplied
together with -lpuidX when compiling a program that uses
this function.
The PUID to be converted is supplied in the puid argument.
A pointer is returned to a static character buffer that con-
tains the conversion, suitable for printing.
If the caller wishes to save the conversion, the abuf argu-
ment may supply a pointer to the caller's buffer; otherwise
it should contain a NULL character pointer and the abufl
argument should be a zero ('0').
If the caller supplies an abuf argument, the abufl argument
must supply the length of abuf. The length must be no less
than MAX_PUID_DIGITS plus two. (MAX_PUID_DIGITS is defined
in "puid_types.h".)
RETURN VALUES
Puidnetd_puid2str() returns a pointer to the character
buffer containing the PUID, converted to a string, suitable
for printing.
If the caller supplied a non-NULL abuf, and if abufl is too
short, puidnetd_puid2str() returns a NULL character pointer.
EXAMPLES
This example prints the PUID in the variable "p".
#include "puid_types.h"
#include "puidnetd.h"
puid_t p = 10284869;
SunOS 5.8 Last change: 1
Introduction to Library Functions puidnetd_puid2str(3)
printf("PUID = %s\n", puidnetd_puid2str(p, NULL, 0));
PUID = 00102-84869
This example captures the PUID conversion in a caller-supplied
buffer.
#include "puid_types.h"
#include "puidnetd.h"
char mybuf[MAX_PUID_DIGITS+2], *pp;
puid_t p = 10284869;
pp = puidnetd_puid2str(p, mybuf, sizeof(mybuf));
if (!pp)
(Process error.)
AUTHOR
Victor A. Abell <abe@purdue.edu>
SEE ALSO
puidnetd(4).
SunOS 5.8 Last change: 2