Eliminated seeks so that we work correctly on pipes, and removed reliance on
[oweals/busybox.git] / ls.c
diff --git a/ls.c b/ls.c
index 201509210fdaee0033327f38a10631c72017ed2b..8f4cae10df9428f28288d74928777e2b5e816bf2 100644 (file)
--- a/ls.c
+++ b/ls.c
@@ -626,7 +626,7 @@ static int list_single(struct dnode *dn)
                                column += 10;
                                break;
                        case LIST_NLINKS:
-                               printf("%4d ", dn->dstat.st_nlink);
+                               printf("%4ld ", (long)dn->dstat.st_nlink);
                                column += 10;
                                break;
                        case LIST_ID_NAME:
@@ -648,15 +648,18 @@ static int list_single(struct dnode *dn)
                                        printf("%4d, %3d ", (int)MAJOR(dn->dstat.st_rdev), (int)MINOR(dn->dstat.st_rdev));
                                } else {
 #ifdef BB_FEATURE_HUMAN_READABLE
-                                       fprintf(stdout, "%9s ", make_human_readable_str(dn->dstat.st_size,
-                                                               (ls_disp_hr==TRUE)? 0: 1));
-#else
+                                       if (ls_disp_hr==TRUE) {
+                                               fprintf(stdout, "%9s ", make_human_readable_str(
+                                                                       dn->dstat.st_size>>10, 0));
+                                       } else 
+#endif 
+                                       {
 #if _FILE_OFFSET_BITS == 64
-                                       printf("%9lld ", dn->dstat.st_size);
+                                               printf("%9lld ", (long long)dn->dstat.st_size);
 #else
-                                       printf("%9ld ", dn->dstat.st_size);
-#endif
+                                               printf("%9ld ", dn->dstat.st_size);
 #endif
+                                       }
                                }
                                column += 10;
                                break;