History log of /netbsd-current/lib/libc/gen/humanize_number.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.19 20-Jan-2024 christos

Catch up with all the lint warnings since exit on warning was disabled.
Disable 'missing header declaration' and 'nested extern' warnings for now.


Revision tags: netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.18 11-Mar-2019 kre

PR lib/54053

When auto scaling, and the buffer is bigger than big enough
for the biggest possible number, don't try and calculate
the max value that will fit in the buffer - that calc
will overflow (guaranteed) and is useless, the value
we're formatting cannot possibly be bigger. So simply
use the unscaled value (the raw number).

While here, also avoid returning values that are larger
than the buffer len ... while it would be nice to be able
to find out how big the buffer should be so the data will
fit, the interface doesn't really allow that (the buffer
length passed in controls the scaling - at least when
auto scaling) and the code already does "return -1" when
it detects the buffer length is too small, even before
it works out how much would have been needed. So, rather
than returning a value > len (while truncating the result
to fit in len ... all courtesy of snprintf()) return -1
in this case as well.

Also, allow suffix==NULL (meaning "") - there's no reason
not to, and requiring users to pass in an explicit "" is
not useful.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.17 13-Apr-2017 christos

branches: 1.17.12;
Fix out of bounds read for very large numbers (pointed out by Brooks Davis)
https://svnweb.freebsd.org/changeset/base/316766


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base yamt-pagecache-base5 yamt-pagecache-base4
# 1.16 17-Mar-2012 christos

branches: 1.16.14; 1.16.18;
PR/44097: Yamamoto Takashi: Prevent overflow.


# 1.15 13-Mar-2012 christos

PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 28-Apr-2008 martin

branches: 1.14.4; 1.14.8; 1.14.24;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
# 1.13 14-Dec-2007 christos

branches: 1.13.4;
- add dehumanize_number
- decls for humanize_number and dehumanize_number are in stdlib.h


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
# 1.12 13-Mar-2007 enami

branches: 1.12.4;
Fix a bug that humanize_number() produces "1000" where it should be "1.0G"
or "1.0M". The bug reported by Greg Troxel.


Revision tags: netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 abandoned-netbsd-4-base netbsd-4-base
# 1.11 08-Jun-2006 simonb

branches: 1.11.4; 1.11.6;
Use PRId64 instead of a cast to long long and %lld to print an int64_t.


# 1.10 13-Sep-2005 christos

compat core reorg.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.9 09-Feb-2005 kleink

A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.


# 1.8 27-Jul-2004 enami

- Honor the HN_NOSPACE flag (i.e., don't put a space if specified,
and put space if not specified).
- There was a test which didn't count the suffixlen. Fix it.
- Make the code a bit easier to read.


# 1.7 12-Jul-2004 enami

Print 10450000 as 10M instead of 10.0M (more greater value such as
10500000 is printed as 10M).


# 1.6 12-Jul-2004 enami

No need to set divisor twice.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.5 26-Dec-2003 simonb

Don't ever add a ".0" to a single digit number.

XXX: Should (for example) 1024 be 1.0K or 1K when the HN_DECIMAL flag
is passed? Should there be a separate option that says "use the
HN_DECIMAL behaviour unless we are exactly equal to the suffix"?


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 11-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


# 1.3 27-Sep-2002 drochner

SI prefixes apply to decimal multiplies only. For binary (2^n) multiplies
the most "officially looking" is IEC 60027-2, ie "Ki", "Mi", ...,
which is not too popular, and which would require more code changes.
So stick with the traditional capital "K" for (divisor==1024), and use
the SI "k" otherwise (ie (divisor==1000)).


# 1.2 26-Sep-2002 wiz

Kilo abbreviation is a small k (PR 18408).


# 1.1 22-Aug-2002 abs

branches: 1.1.2;
Move humanize_number(3) from libutil to libc as per discussion on tech-misc
Revert minor number bump on libutil (with note to skip it next update), and
bump libc.


# 1.18 11-Mar-2019 kre

PR lib/54053

When auto scaling, and the buffer is bigger than big enough
for the biggest possible number, don't try and calculate
the max value that will fit in the buffer - that calc
will overflow (guaranteed) and is useless, the value
we're formatting cannot possibly be bigger. So simply
use the unscaled value (the raw number).

While here, also avoid returning values that are larger
than the buffer len ... while it would be nice to be able
to find out how big the buffer should be so the data will
fit, the interface doesn't really allow that (the buffer
length passed in controls the scaling - at least when
auto scaling) and the code already does "return -1" when
it detects the buffer length is too small, even before
it works out how much would have been needed. So, rather
than returning a value > len (while truncating the result
to fit in len ... all courtesy of snprintf()) return -1
in this case as well.

Also, allow suffix==NULL (meaning "") - there's no reason
not to, and requiring users to pass in an explicit "" is
not useful.


Revision tags: pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.17 13-Apr-2017 christos

Fix out of bounds read for very large numbers (pointed out by Brooks Davis)
https://svnweb.freebsd.org/changeset/base/316766


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base yamt-pagecache-base5 yamt-pagecache-base4
# 1.16 17-Mar-2012 christos

branches: 1.16.14; 1.16.18;
PR/44097: Yamamoto Takashi: Prevent overflow.


# 1.15 13-Mar-2012 christos

PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 28-Apr-2008 martin

branches: 1.14.4; 1.14.8; 1.14.24;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
# 1.13 14-Dec-2007 christos

branches: 1.13.4;
- add dehumanize_number
- decls for humanize_number and dehumanize_number are in stdlib.h


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
# 1.12 13-Mar-2007 enami

branches: 1.12.4;
Fix a bug that humanize_number() produces "1000" where it should be "1.0G"
or "1.0M". The bug reported by Greg Troxel.


Revision tags: netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 abandoned-netbsd-4-base netbsd-4-base
# 1.11 08-Jun-2006 simonb

branches: 1.11.4; 1.11.6;
Use PRId64 instead of a cast to long long and %lld to print an int64_t.


# 1.10 13-Sep-2005 christos

compat core reorg.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.9 09-Feb-2005 kleink

A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.


# 1.8 27-Jul-2004 enami

- Honor the HN_NOSPACE flag (i.e., don't put a space if specified,
and put space if not specified).
- There was a test which didn't count the suffixlen. Fix it.
- Make the code a bit easier to read.


# 1.7 12-Jul-2004 enami

Print 10450000 as 10M instead of 10.0M (more greater value such as
10500000 is printed as 10M).


# 1.6 12-Jul-2004 enami

No need to set divisor twice.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.5 26-Dec-2003 simonb

Don't ever add a ".0" to a single digit number.

XXX: Should (for example) 1024 be 1.0K or 1K when the HN_DECIMAL flag
is passed? Should there be a separate option that says "use the
HN_DECIMAL behaviour unless we are exactly equal to the suffix"?


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 11-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


# 1.3 27-Sep-2002 drochner

SI prefixes apply to decimal multiplies only. For binary (2^n) multiplies
the most "officially looking" is IEC 60027-2, ie "Ki", "Mi", ...,
which is not too popular, and which would require more code changes.
So stick with the traditional capital "K" for (divisor==1024), and use
the SI "k" otherwise (ie (divisor==1000)).


# 1.2 26-Sep-2002 wiz

Kilo abbreviation is a small k (PR 18408).


# 1.1 22-Aug-2002 abs

branches: 1.1.2;
Move humanize_number(3) from libutil to libc as per discussion on tech-misc
Revert minor number bump on libutil (with note to skip it next update), and
bump libc.


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.17 13-Apr-2017 christos

Fix out of bounds read for very large numbers (pointed out by Brooks Davis)
https://svnweb.freebsd.org/changeset/base/316766


Revision tags: pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 tls-maxphys-base yamt-pagecache-base5 yamt-pagecache-base4
# 1.16 17-Mar-2012 christos

branches: 1.16.14; 1.16.18;
PR/44097: Yamamoto Takashi: Prevent overflow.


# 1.15 13-Mar-2012 christos

PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 christos-time_t-nbase christos-time_t-base netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
# 1.14 28-Apr-2008 martin

branches: 1.14.4; 1.14.8; 1.14.24;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
# 1.13 14-Dec-2007 christos

branches: 1.13.4;
- add dehumanize_number
- decls for humanize_number and dehumanize_number are in stdlib.h


Revision tags: matt-armv6-prevmlocking cube-autoconf-base matt-mips64-base
# 1.12 13-Mar-2007 enami

branches: 1.12.4;
Fix a bug that humanize_number() produces "1000" where it should be "1.0G"
or "1.0M". The bug reported by Greg Troxel.


Revision tags: netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 abandoned-netbsd-4-base netbsd-4-base
# 1.11 08-Jun-2006 simonb

branches: 1.11.4; 1.11.6;
Use PRId64 instead of a cast to long long and %lld to print an int64_t.


# 1.10 13-Sep-2005 christos

compat core reorg.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
# 1.9 09-Feb-2005 kleink

A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.


# 1.8 27-Jul-2004 enami

- Honor the HN_NOSPACE flag (i.e., don't put a space if specified,
and put space if not specified).
- There was a test which didn't count the suffixlen. Fix it.
- Make the code a bit easier to read.


# 1.7 12-Jul-2004 enami

Print 10450000 as 10M instead of 10.0M (more greater value such as
10500000 is printed as 10M).


# 1.6 12-Jul-2004 enami

No need to set divisor twice.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.5 26-Dec-2003 simonb

Don't ever add a ".0" to a single digit number.

XXX: Should (for example) 1024 be 1.0K or 1K when the HN_DECIMAL flag
is passed? Should there be a separate option that says "use the
HN_DECIMAL behaviour unless we are exactly equal to the suffix"?


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.4 11-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


# 1.3 27-Sep-2002 drochner

SI prefixes apply to decimal multiplies only. For binary (2^n) multiplies
the most "officially looking" is IEC 60027-2, ie "Ki", "Mi", ...,
which is not too popular, and which would require more code changes.
So stick with the traditional capital "K" for (divisor==1024), and use
the SI "k" otherwise (ie (divisor==1000)).


# 1.2 26-Sep-2002 wiz

Kilo abbreviation is a small k (PR 18408).


# 1.1 22-Aug-2002 abs

branches: 1.1.2;
Move humanize_number(3) from libutil to libc as per discussion on tech-misc
Revert minor number bump on libutil (with note to skip it next update), and
bump libc.