Fixed user and group name listing.
This commit is contained in:
parent
5022d0e55f
commit
e93abf9e69
@ -531,7 +531,7 @@ int list_single(struct dnode *dn)
|
|||||||
char *filetime;
|
char *filetime;
|
||||||
time_t ttime, age;
|
time_t ttime, age;
|
||||||
#endif
|
#endif
|
||||||
#if defined (BB_FEATURE_LS_FILETYPES) || defined (BB_FEATURE_LS_USERNAME)
|
#if defined (BB_FEATURE_LS_FILETYPES)
|
||||||
struct stat info;
|
struct stat info;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_FEATURE_LS_FILETYPES
|
#ifdef BB_FEATURE_LS_FILETYPES
|
||||||
@ -574,28 +574,19 @@ int list_single(struct dnode *dn)
|
|||||||
break;
|
break;
|
||||||
case LIST_ID_NAME:
|
case LIST_ID_NAME:
|
||||||
#ifdef BB_FEATURE_LS_USERNAME
|
#ifdef BB_FEATURE_LS_USERNAME
|
||||||
{
|
memset(scratch, 0, sizeof(scratch));
|
||||||
memset(&info, 0, sizeof(struct stat));
|
my_getpwuid(scratch, dn->dstat.st_uid);
|
||||||
memset(scratch, 0, sizeof(scratch));
|
if (*scratch)
|
||||||
if (!stat(dn->fullname, &info)) {
|
fprintf(stdout, "%-8.8s ", scratch);
|
||||||
my_getpwuid(scratch, info.st_uid);
|
else
|
||||||
}
|
fprintf(stdout, "%-8d ", dn->dstat.st_uid);
|
||||||
if (*scratch) {
|
memset(scratch, 0, sizeof(scratch));
|
||||||
fprintf(stdout, "%-8.8s ", scratch);
|
my_getgrgid(scratch, dn->dstat.st_gid);
|
||||||
} else {
|
if (*scratch)
|
||||||
fprintf(stdout, "%-8d ", dn->dstat.st_uid);
|
fprintf(stdout, "%-8.8s", scratch);
|
||||||
}
|
else
|
||||||
memset(scratch, 0, sizeof(scratch));
|
fprintf(stdout, "%-8d", dn->dstat.st_gid);
|
||||||
if (info.st_ctime != 0) {
|
|
||||||
my_getgrgid(scratch, info.st_gid);
|
|
||||||
}
|
|
||||||
if (*scratch) {
|
|
||||||
fprintf(stdout, "%-8.8s", scratch);
|
|
||||||
} else {
|
|
||||||
fprintf(stdout, "%-8d", dn->dstat.st_gid);
|
|
||||||
}
|
|
||||||
column += 17;
|
column += 17;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case LIST_ID_NUMERIC:
|
case LIST_ID_NUMERIC:
|
||||||
|
35
ls.c
35
ls.c
@ -531,7 +531,7 @@ int list_single(struct dnode *dn)
|
|||||||
char *filetime;
|
char *filetime;
|
||||||
time_t ttime, age;
|
time_t ttime, age;
|
||||||
#endif
|
#endif
|
||||||
#if defined (BB_FEATURE_LS_FILETYPES) || defined (BB_FEATURE_LS_USERNAME)
|
#if defined (BB_FEATURE_LS_FILETYPES)
|
||||||
struct stat info;
|
struct stat info;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BB_FEATURE_LS_FILETYPES
|
#ifdef BB_FEATURE_LS_FILETYPES
|
||||||
@ -574,28 +574,19 @@ int list_single(struct dnode *dn)
|
|||||||
break;
|
break;
|
||||||
case LIST_ID_NAME:
|
case LIST_ID_NAME:
|
||||||
#ifdef BB_FEATURE_LS_USERNAME
|
#ifdef BB_FEATURE_LS_USERNAME
|
||||||
{
|
memset(scratch, 0, sizeof(scratch));
|
||||||
memset(&info, 0, sizeof(struct stat));
|
my_getpwuid(scratch, dn->dstat.st_uid);
|
||||||
memset(scratch, 0, sizeof(scratch));
|
if (*scratch)
|
||||||
if (!stat(dn->fullname, &info)) {
|
fprintf(stdout, "%-8.8s ", scratch);
|
||||||
my_getpwuid(scratch, info.st_uid);
|
else
|
||||||
}
|
fprintf(stdout, "%-8d ", dn->dstat.st_uid);
|
||||||
if (*scratch) {
|
memset(scratch, 0, sizeof(scratch));
|
||||||
fprintf(stdout, "%-8.8s ", scratch);
|
my_getgrgid(scratch, dn->dstat.st_gid);
|
||||||
} else {
|
if (*scratch)
|
||||||
fprintf(stdout, "%-8d ", dn->dstat.st_uid);
|
fprintf(stdout, "%-8.8s", scratch);
|
||||||
}
|
else
|
||||||
memset(scratch, 0, sizeof(scratch));
|
fprintf(stdout, "%-8d", dn->dstat.st_gid);
|
||||||
if (info.st_ctime != 0) {
|
|
||||||
my_getgrgid(scratch, info.st_gid);
|
|
||||||
}
|
|
||||||
if (*scratch) {
|
|
||||||
fprintf(stdout, "%-8.8s", scratch);
|
|
||||||
} else {
|
|
||||||
fprintf(stdout, "%-8d", dn->dstat.st_gid);
|
|
||||||
}
|
|
||||||
column += 17;
|
column += 17;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case LIST_ID_NUMERIC:
|
case LIST_ID_NUMERIC:
|
||||||
|
Loading…
Reference in New Issue
Block a user