man.bsd.lv manual page server

Manual Page Search Parameters

EXPAND_NUMBER(3) Library Functions Manual EXPAND_NUMBER(3)

expand_numberformat a number from human readable form

library “libutil”

#include <libutil.h>

int
expand_number(const char *buf, uint64_t *num);

The () function unformats the buf string and stores a unsigned 64-bit quantity at address pointed out by the num argument.

The () function is case-insensitive and follows the SI power of two convention.

The prefixes are:

1024
1048576
1073741824
1099511627776
1125899906842624
1152921504606846976

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

The expand_number() function will fail if:

[]
The given string contains no digits.
[]
An unrecognized prefix was given.
[]
Result doesn't fit into 64 bits.

humanize_number(3)

The expand_number() function first appeared in FreeBSD 6.3.

August 15, 2010 FreeBSD-12.0