[openfirmware] r1721 - ofw/core

svn at openfirmware.info svn at openfirmware.info
Fri Jan 29 10:03:08 CET 2010


Author: wmb
Date: 2010-01-29 10:03:08 +0100 (Fri, 29 Jan 2010)
New Revision: 1721

Modified:
   ofw/core/filecmds.fth
Log:
OLPC trac 10004 - Correctly report disk-free > 2 GiB.


Modified: ofw/core/filecmds.fth
===================================================================
--- ofw/core/filecmds.fth	2010-01-29 07:03:08 UTC (rev 1720)
+++ ofw/core/filecmds.fth	2010-01-29 09:03:08 UTC (rev 1721)
@@ -657,8 +657,19 @@
 public
 
 : disk-free  ( "name" -- )
-   parse-word $disk-free drop
-   push-decimal  d# 1024 / (.) type ." K"  cr  pop-base
+   parse-word $disk-free           ( d.size )
+   dup  if    \ Larger than 4G, so display size in GB
+      d# 1,000,000,000 um/mod nip  ( gbytes )
+      .d ." GB" cr                 ( )
+      exit
+   then                            ( d.size )
+   2dup  h# 40.0000.  d<  if       ( d.size )
+      d# 1024 um/mod nip           ( kbytes )
+      .d ." KB" cr                 ( )
+      exit
+   then                            ( d.size )
+   d# 1,000,000 um/mod nip         ( mbytes )
+   .d ." MB" cr                    ( )
 ;
 
 : more  ( "devspec" -- )




More information about the openfirmware mailing list