expr: small code shrink
[oweals/busybox.git] / coreutils / df.c
index c569dae339a644656d8a9bd63fd27c910d34c5b1..82730806edce899470c23e8668e5526bdc7f7104 100644 (file)
  * the command line.  Properly round *-blocks, Used, and Available quantities.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
 #include <mntent.h>
 #include <sys/vfs.h>
-#include "busybox.h"
+#include "libbb.h"
 
 #ifndef CONFIG_FEATURE_HUMAN_READABLE
 static long kscale(long b, long bs)
 {
-       return ( b * (long long) bs + KILOBYTE/2 ) / KILOBYTE;
+       return ( b * (long long) bs + 1024/2 ) / 1024;
 }
 #endif
 
+int df_main(int argc, char **argv);
 int df_main(int argc, char **argv)
 {
        long blocks_used;
        long blocks_percent_used;
 #ifdef CONFIG_FEATURE_HUMAN_READABLE
-       unsigned long df_disp_hr = KILOBYTE;
+       unsigned long df_disp_hr = 1024;
 #endif
        int status = EXIT_SUCCESS;
        unsigned opt;
@@ -56,7 +53,7 @@ int df_main(int argc, char **argv)
                disp_units_hdr = "     Size";
        }
        if (opt & 2) {
-               df_disp_hr = MEGABYTE;
+               df_disp_hr = 1024*1024;
                disp_units_hdr = "1M-blocks";
        }
 #else
@@ -93,7 +90,7 @@ int df_main(int argc, char **argv)
                        mount_entry = find_mount_point(mount_point, bb_path_mtab_file);
                        if (!mount_entry) {
                                bb_error_msg("%s: can't find mount point", mount_point);
                      SET_ERROR:
+ SET_ERROR:
                                status = EXIT_FAILURE;
                                continue;
                        }