strspct man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

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 num‐
     bers, 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 sep‐
     arately in libutil for NetBSD 6.0.

AUTHORS
     Erik E. Fair ⟨fair@netbsd.org⟩

BSD				January 7, 2012				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net