Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pmnumberstr(3) [centos man page]

PMNUMBERSTR(3)						     Library Functions Manual						    PMNUMBERSTR(3)

NAME
pmNumberStr, pmNumberStr_r - fixed width output format for numbers C SYNOPSIS
#include <pcp/pmapi.h> const char *pmNumberStr(double value); char *pmNumberStr_r(double value, char *buf, int buflen); cc ... -lpcp DESCRIPTION
pmNumberStr returns the address of a 8-byte buffer that holds a null-byte terminated representation of value suitable for output with fixed width fields. The pmNumberStr_r function does the same, but stores the result in a user-supplied buffer buf of length buflen, which should have room for at least 8 bytes. The value is scaled using multipliers in powers of ``one thousand'' (the decimal ``kilo'') and has a bias that provides greater precision for positive numbers as opposed to negative numbers. The format depends on the sign and magnitude of value as follows (d represents a decimal digit): +----------------------------------+---------+ | value range | format | +----------------------------------+---------+ | > 999995000000000 | inf? | |999995000000000 - 999995000000 | ddd.ddT | | 999995000000 - 999995000 | ddd.ddG | | 999995000 - 999995 | ddd.ddM | | 999995 - 999.995 | ddd.ddK | | 999.995 - 0.005 | ddd.dd | | 0.005 - -0.005 | 0.00 | | -0.005 - -99.95 | -dd.dd | | -99.995 - -99995 | -dd.ddK | | -99995 - -99995000 | -dd.ddM | | -99995000 - -99995000000 | -dd.ddG | | -99995000000 - -99995000000000 | -dd.ddT | | < -99995000000000 | -inf? | +----------------------------------+---------+ At the boundary points of the ranges, the chosen format will retain the maximum number of significant digits. NOTES
pmNumberStr returns a pointer to a static buffer and hence is not thread-safe. Multi-threaded applications should use pmNumberStr_r instead. SEE ALSO
printf(3) Performance Co-Pilot PCP PMNUMBERSTR(3)

Check Out this Related Man Page

inet_ntop(3XNET)				   X/Open Networking Services Library Functions 				  inet_ntop(3XNET)

NAME
inet_ntop, inet_pton - convert IPv4 and IPv6 addresses between binary and text form SYNOPSIS
cc [ flag ... ] file ... -lxnet [ library ... ] #include <arpa/inet.h> const char *inet_ntop(int af, const void *restrict src, char *restrict dst, socklen_t size); int inet_pton(int af, const char *restrict src, dst); DESCRIPTION
The inet_ntop() function converts a numeric address into a text string suitable for presentation. The af argument specifies the family of the address. This can be AF_INET or AF_INET6. The src argument points to a buffer holding an IPv4 address if the af argument is AF_INET, or an IPv6 address if the af argument is AF_INET6. The dst argument points to a buffer where the function stores the resulting text string; it cannot be NULL. The size argument specifies the size of this buffer, which must be large enough to hold the text string (INET_ADDRSTRLEN characters for IPv4, INET6_ADDRSTRLEN characters for IPv6). The inet_pton() function converts an address in its standard text presentation form into its numeric binary form. The af argument specifies the family of the address. The AF_INET and AF_INET6 address families are supported. The src argument points to the string being passed in. The dst argument points to a buffer into which the function stores the numeric address; this must be large enough to hold the numeric address (32 bits for AF_INET, 128 bits for AF_INET6). If the af argument of inet_pton() is AF_INET, the src string is in the standard IPv4 dotted-decimal form: ddd.ddd.ddd.ddd where "ddd"is a one to three digit decimal number between 0 and 255 (see inet_addr(3XNET)). The inet_pton() function does not accept other formats (such as the octal numbers, hexadecimal numbers, and fewer than four numbers that inet_addr() accepts). If the af argument of inet_pton() is AF_INET6, the src string is in one of the following standard IPv6 text forms: 1. The preferred form is "x:x:x:x:x:x:x:x", where the 'x's are the hexadecimal values of the eight 16-bit pieces of the address. Leading zeros in individual fields can be omitted, but there must be at least one numeral in every field. 2. A string of contiguous zero fields in the preferred form can be shown as "::". The "::" can only appear once in an address. Unspecified addresses ("0:0:0:0:0:0:0:0") can be represented simply as "::". 3. A third form that is sometimes more convenient when dealing with a mixed environment of IPv4 and IPv6 nodes is "x:x:x:x:x:x:d.d.d.d", where the 'x's are the hexadecimal values of the six high-order 16-bit pieces of the address, and the 'd's are the decimal values of the four low-order 8-bit pieces of the address (standard IPv4 representation). A more extensive description of the standard representations of IPv6 addresses can be found in RFC 2373. RETURN VALUES
The inet_ntop() function returns a pointer to the buffer containing the text string if the conversion succeeds. Otherwise it returns NULL and sets errno to indicate the error. The inet_pton() function returns 1 if the conversion succeeds, with the address pointed to by dst in network byte order. It returns 0 if the input is not a valid IPv4 dotted-decimal string or a valid IPv6 address string. It returns -1 and sets errno to EAFNOSUPPORT if the af argument is unknown. ERRORS
The inet_ntop() and inet_pton() functions will fail if: EAFNOSUPPORT The af argument is invalid. ENOSPC The size of the inet_ntop() result buffer is inadequate. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
inet_addr(3XNET), attributes(5) SunOS 5.11 1 Nov 2003 inet_ntop(3XNET)
Man Page