summaryrefslogtreecommitdiff
path: root/ls.c
diff options
context:
space:
mode:
authorErik Andersen1999-12-29 22:19:46 +0000
committerErik Andersen1999-12-29 22:19:46 +0000
commit1266a13e1f687d34052ae7e2469048d035633e58 (patch)
treedc70d49434faf03d25c199ebbb3d360d95e5fac5 /ls.c
parenta89910829c73c5ed4f30eecb181d7b3087ca4f74 (diff)
downloadbusybox-1266a13e1f687d34052ae7e2469048d035633e58.zip
busybox-1266a13e1f687d34052ae7e2469048d035633e58.tar.gz
* sed now supports addresses (numeric or regexp, with negation) and
has an append command, thanks to Marco Pantaleoni <panta@prosa.it> * Fixed dmesg. It wasn't parsing its options (-n or -s) properly. * Some cosmetic fixes to ls output formatting to make it behave more like GNU ls. -Erik
Diffstat (limited to 'ls.c')
-rw-r--r--ls.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/ls.c b/ls.c
index 571c962..862da43 100644
--- a/ls.c
+++ b/ls.c
@@ -193,11 +193,13 @@ 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[0]='\0';
+ memset ( scratch, 0, sizeof (scratch));
my_getpwuid( scratch, info->st_uid);
- scratch[8]='\0';
- if (*scratch)
- wr(scratch,8);
+ if (*scratch) {
+ fputs(scratch, stdout);
+ if ( strlen( scratch) <= 8 )
+ wr(" ", 8-strlen( scratch));
+ }
else {
writenum((long) info->st_uid,(short)8);
fputs(" ", stdout);
@@ -208,20 +210,21 @@ static void list_single(const char *name, struct stat *info, const char *fullnam
writenum((long) info->st_uid,(short)8);
fputs(" ", stdout);
}
- tab(16);
#ifdef BB_FEATURE_LS_USERNAME
if (!(opts & DISP_NUMERIC)) {
- scratch[0]='\0';
+ memset ( scratch, 0, sizeof (scratch));
my_getgrgid( scratch, info->st_gid);
- scratch[8]='\0';
- if (*scratch)
- wr(scratch,8);
+ if (*scratch) {
+ fputs(scratch, stdout);
+ if ( strlen( scratch) <= 8 )
+ wr(" ", 8-strlen( scratch));
+ }
else
- writenum((long) info->st_gid,(short)8);
+ writenum((long) info->st_gid,(short)8);
} else
#endif
writenum((long) info->st_gid,(short)8);
- tab(17);
+ //tab(26);
if (S_ISBLK(mode) || S_ISCHR(mode)) {
writenum((long)MAJOR(info->st_rdev),(short)3);
fputs(", ", stdout);
@@ -230,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;