/* human.c -- print human readable file size
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free
- Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
# include <locale.h>
#endif
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#ifndef HAVE_DECL_GETENV
-"this configure-time declaration test was not run"
-#endif
-#if !HAVE_DECL_GETENV
-char *getenv ();
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include "gettext.h"
#define _(msgid) gettext (msgid)
{
do
{
- unsigned r10 = (amt % base) * 10 + tenths;
- unsigned r2 = (r10 % base) * 2 + (rounding >> 1);
+ unsigned int r10 = (amt % base) * 10 + tenths;
+ unsigned int r2 = (r10 % base) * 2 + (rounding >> 1);
amt /= base;
tenths = r10 / base;
rounding = (r2 < base
}
}
- if (inexact_style == human_ceiling
- ? 0 < tenths + rounding
- : inexact_style == human_round_to_nearest
- ? 5 < tenths + (2 < rounding + (amt & 1))
- : /* inexact_style == human_floor */ 0)
+ if (inexact_style == human_round_to_nearest
+ ? 5 < tenths + (0 < rounding + (amt & 1))
+ : inexact_style == human_ceiling && 0 < tenths + rounding)
{
amt++;
int i;
int opts = 0;
- if (! spec && ! (spec = getenv ("BLOCK_SIZE")))
+ if (! spec
+ && ! (spec = getenv ("BLOCK_SIZE"))
+ && ! (spec = getenv ("BLOCKSIZE")))
*block_size = default_block_size ();
else
{
"eEgGkKmMpPtTyYzZ0");
if (e != LONGINT_OK)
return e;
- if (*ptr)
- return LONGINT_INVALID_SUFFIX_CHAR;
for (; ! ('0' <= *spec && *spec <= '9'); spec++)
if (spec == ptr)
{