Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strspct(3) [netbsd man page]

STRPCT(3)						   BSD Library Functions Manual 						 STRPCT(3)

NAME
strpct, strspct -- decimal percent formatters LIBRARY
System Utilities Library (libutil, -lutil) SYNOPSIS
#include <util.h> char * strpct(char *buf, size_t bufsiz, uintmax_t numerator, uintmax_t denominator, size_t precision); char * strspct(char *buf, size_t bufsiz, intmax_t numerator, intmax_t denominator, size_t precision); DESCRIPTION
The strpct() function formats the fraction represented by numerator and denominator into a percentage representation with given number of digits of precision without using floating point arithmetic. RETURN VALUES
strpct() and strspct() always return a pointer to a NUL-terminated (unless buflen is 0) formatted string which is placed in buf and is up to buflen characters. If there was an overflow, the formatted string will reflect that precision loss. EXAMPLES
strpct(buf, buflen, 1, 16, 3); => "6.250" strpct(buf, buflen, 1, 2, 0); => "50" HISTORY
strpct() was originally implemented in csh(1) for NetBSD 1.3. It printed into a static buffer, was not locale aware, handled unsigned long numbers, and printed a ``%'' at the end of the number. Other programs such as df(1) and time(1) started using it. strpct() and strspct() appeared separately in libutil for NetBSD 6.0. AUTHORS
Erik E. Fair <fair@netbsd.org> BSD
January 7, 2012 BSD

Check Out this Related Man Page

BSDE_RULE_TO_STRING(3)					   BSD Library Functions Manual 				    BSDE_RULE_TO_STRING(3)

NAME
bsde_rule_to_string -- convert a ugidfw rule into its text representation LIBRARY
File System Firewall Interface Library (libugidfw, -lugidfw) SYNOPSIS
#include <ugidfw.h> int bsde_rule_to_string(struct mac_bsdextended_rule *rule, char *buf, size_t buflen); DESCRIPTION
The bsde_rule_to_string() function converts a rule in its internal representation (struct mac_bsdextended_rule) into its text representation, and writes up to buflen bytes of it to buf (including the terminating NUL). RETURN VALUES
The bsde_rule_to_string() function returns -1 if the conversion was truncated; otherwise the value 0 is returned. SEE ALSO
bsde_delete_rule(3), bsde_get_rule(3), bsde_get_rule_count(3), bsde_get_rule_slots(3), bsde_parse_rule(3), bsde_parse_rule_string(3), bsde_set_rule(3), libugidfw(3), mac_bsdextended(4), ugidfw(8) AUTHORS
This software was contributed to the FreeBSD Project by Network Associates Labs, the Security Research Division of Network Associates Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (``CBOSS''), as part of the DARPA CHATS research program. BSD
January 7, 2003 BSD
Man Page