Use IEC 60027-2 prefixes for 2^n based prefixes.

This commit is contained in:
lukem 2007-04-12 06:50:39 +00:00
parent 7347fd3ceb
commit 2d50a59010
2 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,6 @@
.\" $NetBSD: strsuftoll.3,v 1.5 2004/03/05 05:58:29 lukem Exp $
.\" $NetBSD: strsuftoll.3,v 1.6 2007/04/12 06:50:39 lukem Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" Copyright (c) 2002,2007 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 5, 2004
.Dd April 12, 2007
.Dt STRSUFTOLL 3
.Os
.Sh NAME
@ -69,13 +69,13 @@ Each decimal number may have one of the following optional suffixes:
.It b
Block; multiply by 512
.It k
Kilo; multiply by 1024 (1 KB)
Kibi; multiply by 1024 (1 KiB)
.It m
Mega; multiply by 1048576 (1 MB)
Mebi; multiply by 1048576 (1 MiB)
.It g
Giga; multiply by 1073741824 (1 GB)
Gibi; multiply by 1073741824 (1 GiB)
.It t
Tera; multiply by 1099511627776 (1 TB)
Tebi; multiply by 1099511627776 (1 TiB)
.It w
Word; multiply by the number of bytes in an integer
.El

View File

@ -1,4 +1,4 @@
/* $NetBSD: strsuftoll.c,v 1.6 2004/03/05 05:58:29 lukem Exp $ */
/* $NetBSD: strsuftoll.c,v 1.7 2007/04/12 06:50:39 lukem Exp $ */
/*-
* Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc.
* All rights reserved.
@ -74,7 +74,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strsuftoll.c,v 1.6 2004/03/05 05:58:29 lukem Exp $");
__RCSID("$NetBSD: strsuftoll.c,v 1.7 2007/04/12 06:50:39 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef _LIBC
@ -171,28 +171,28 @@ strsuftollx(const char *desc, const char *val,
break;
case 'k':
t = num;
num *= 1024; /* 1 kilobyte */
num *= 1024; /* 1 kibibyte */
if (t > num)
goto erange;
++expr;
break;
case 'm':
t = num;
num *= 1048576; /* 1 megabyte */
num *= 1048576; /* 1 mebibyte */
if (t > num)
goto erange;
++expr;
break;
case 'g':
t = num;
num *= 1073741824; /* 1 gigabyte */
num *= 1073741824; /* 1 gibibyte */
if (t > num)
goto erange;
++expr;
break;
case 't':
t = num;
num *= 1099511627776LL; /* 1 terabyte */
num *= 1099511627776LL; /* 1 tebibyte */
if (t > num)
goto erange;
++expr;