making note of my changes.
[oweals/busybox.git] / ls.c
diff --git a/ls.c b/ls.c
index 3b380671d1835be17ae45745ec9b37ae5872c561..862da436854de79f2222a60804fe3c25f2e62359 100644 (file)
--- a/ls.c
+++ b/ls.c
@@ -193,28 +193,38 @@ static void list_single(const char *name, struct stat *info, const char *fullnam
                fputs(" ", stdout);
 #ifdef BB_FEATURE_LS_USERNAME
                if (!(opts & DISP_NUMERIC)) {
-                       scratch[8]='\0';
+                       memset ( scratch, 0, sizeof (scratch));
                        my_getpwuid( scratch, info->st_uid);
-                       if (*scratch)
-                               fputs(scratch, stdout);
-                       else
-                               writenum((long)info->st_uid,(short)0);
+                       if (*scratch) {
+                           fputs(scratch, stdout);
+                           if ( strlen( scratch) <= 8 )
+                               wr("         ", 8-strlen( scratch));
+                       }
+                       else {
+                               writenum((long) info->st_uid,(short)8);
+                               fputs(" ", stdout);
+                       }
                } else
 #endif
-               writenum((long)info->st_uid,(short)0);
-               tab(16);
+               {
+                   writenum((long) info->st_uid,(short)8);
+                   fputs(" ", stdout);
+               }
 #ifdef BB_FEATURE_LS_USERNAME
                if (!(opts & DISP_NUMERIC)) {
-                       scratch[8]='\0';
+                       memset ( scratch, 0, sizeof (scratch));
                        my_getgrgid( scratch, info->st_gid);
-                       if (*scratch)
-                               fputs(scratch, stdout);
-                       else
-                               writenum((long)info->st_gid,(short)0);
+                       if (*scratch) {
+                           fputs(scratch, stdout);
+                           if ( strlen( scratch) <= 8 )
+                               wr("         ", 8-strlen( scratch));
+                       }
+                       else 
+                           writenum((long) info->st_gid,(short)8);
                } else
 #endif
-               writenum((long)info->st_gid,(short)0);
-               tab(17);
+               writenum((long) info->st_gid,(short)8);
+               //tab(26);
                if (S_ISBLK(mode) || S_ISCHR(mode)) {
                        writenum((long)MAJOR(info->st_rdev),(short)3);
                        fputs(", ", stdout);
@@ -223,6 +233,7 @@ static void list_single(const char *name, struct stat *info, const char *fullnam
                else
                        writenum((long)info->st_size,(short)8);
                fputs(" ", stdout);
+               //tab(32);
 #ifdef BB_FEATURE_LS_TIMESTAMPS
                {
                        time_t cal;