diff options
Diffstat (limited to 'ls.c')
-rw-r--r-- | ls.c | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -193,11 +193,13 @@ static void list_single(const char *name, struct stat *info, const char *fullnam | |||
193 | fputs(" ", stdout); | 193 | fputs(" ", stdout); |
194 | #ifdef BB_FEATURE_LS_USERNAME | 194 | #ifdef BB_FEATURE_LS_USERNAME |
195 | if (!(opts & DISP_NUMERIC)) { | 195 | if (!(opts & DISP_NUMERIC)) { |
196 | scratch[0]='\0'; | 196 | memset ( scratch, 0, sizeof (scratch)); |
197 | my_getpwuid( scratch, info->st_uid); | 197 | my_getpwuid( scratch, info->st_uid); |
198 | scratch[8]='\0'; | 198 | if (*scratch) { |
199 | if (*scratch) | 199 | fputs(scratch, stdout); |
200 | wr(scratch,8); | 200 | if ( strlen( scratch) <= 8 ) |
201 | wr(" ", 8-strlen( scratch)); | ||
202 | } | ||
201 | else { | 203 | else { |
202 | writenum((long) info->st_uid,(short)8); | 204 | writenum((long) info->st_uid,(short)8); |
203 | fputs(" ", stdout); | 205 | fputs(" ", stdout); |
@@ -208,20 +210,21 @@ static void list_single(const char *name, struct stat *info, const char *fullnam | |||
208 | writenum((long) info->st_uid,(short)8); | 210 | writenum((long) info->st_uid,(short)8); |
209 | fputs(" ", stdout); | 211 | fputs(" ", stdout); |
210 | } | 212 | } |
211 | tab(16); | ||
212 | #ifdef BB_FEATURE_LS_USERNAME | 213 | #ifdef BB_FEATURE_LS_USERNAME |
213 | if (!(opts & DISP_NUMERIC)) { | 214 | if (!(opts & DISP_NUMERIC)) { |
214 | scratch[0]='\0'; | 215 | memset ( scratch, 0, sizeof (scratch)); |
215 | my_getgrgid( scratch, info->st_gid); | 216 | my_getgrgid( scratch, info->st_gid); |
216 | scratch[8]='\0'; | 217 | if (*scratch) { |
217 | if (*scratch) | 218 | fputs(scratch, stdout); |
218 | wr(scratch,8); | 219 | if ( strlen( scratch) <= 8 ) |
220 | wr(" ", 8-strlen( scratch)); | ||
221 | } | ||
219 | else | 222 | else |
220 | writenum((long) info->st_gid,(short)8); | 223 | writenum((long) info->st_gid,(short)8); |
221 | } else | 224 | } else |
222 | #endif | 225 | #endif |
223 | writenum((long) info->st_gid,(short)8); | 226 | writenum((long) info->st_gid,(short)8); |
224 | tab(17); | 227 | //tab(26); |
225 | if (S_ISBLK(mode) || S_ISCHR(mode)) { | 228 | if (S_ISBLK(mode) || S_ISCHR(mode)) { |
226 | writenum((long)MAJOR(info->st_rdev),(short)3); | 229 | writenum((long)MAJOR(info->st_rdev),(short)3); |
227 | fputs(", ", stdout); | 230 | fputs(", ", stdout); |
@@ -230,6 +233,7 @@ static void list_single(const char *name, struct stat *info, const char *fullnam | |||
230 | else | 233 | else |
231 | writenum((long)info->st_size,(short)8); | 234 | writenum((long)info->st_size,(short)8); |
232 | fputs(" ", stdout); | 235 | fputs(" ", stdout); |
236 | //tab(32); | ||
233 | #ifdef BB_FEATURE_LS_TIMESTAMPS | 237 | #ifdef BB_FEATURE_LS_TIMESTAMPS |
234 | { | 238 | { |
235 | time_t cal; | 239 | time_t cal; |