diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-16 19:36:46 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-08-16 19:36:46 +0000 |
commit | b96f5ea4925854db9eae61f98a7ec44568ecae7d (patch) | |
tree | 913918a48168b6e77f64b65f61e9d42b791f1ab2 /src/system.h | |
parent | f048f049e7dd531e207c630088d050c376b39feb (diff) | |
download | coreutils-b96f5ea4925854db9eae61f98a7ec44568ecae7d.tar.xz |
Fix bugs when printing plurals of numbers that are not
unsigned long int values.
* src/system.h (select_plural): New function.
* src/md5sum.c (digest_check): Use select_plural to avoid bug.
* src/uptime.c (print_uptime): Likewise.
* src/dd.c (print_stats): Likewise. Also, don't use ngettext to
print a floating point number, as reducing to 0 or 1 doesn't work
for some languages. Instead, just use "s" for seconds since it
doesn't need a plural form.
Diffstat (limited to 'src/system.h')
-rw-r--r-- | src/system.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/system.h b/src/system.h index 423f0fa8b..3f6aed6d2 100644 --- a/src/system.h +++ b/src/system.h @@ -383,6 +383,14 @@ static inline unsigned char to_uchar (char ch) { return ch; } #define _(msgid) gettext (msgid) #define N_(msgid) msgid +/* Return a value that pluralizes the same way that N does, in all + languages we know of. */ +static inline unsigned long int +select_plural (uintmax_t n) +{ + return (n <= ULONG_MAX ? n : n % 1000 + 1000); +} + #define STREQ(a, b) (strcmp ((a), (b)) == 0) #if !HAVE_DECL_FREE |