version 1.32, 2020/10/18 11:32:02 |
version 1.33, 2022/09/19 10:41:58 |
|
|
* drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh |
* drwxr-xr-x 5 markus markus 1024 Jan 13 18:39 .ssh |
*/ |
*/ |
char * |
char * |
ls_file(const char *name, const struct stat *st, int remote, int si_units) |
ls_file(const char *name, const struct stat *st, int remote, int si_units, |
|
const char *user, const char *group) |
{ |
{ |
int ulen, glen, sz = 0; |
int ulen, glen, sz = 0; |
struct tm *ltime = localtime(&st->st_mtime); |
struct tm *ltime = localtime(&st->st_mtime); |
const char *user, *group; |
|
char buf[1024], lc[8], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; |
char buf[1024], lc[8], mode[11+1], tbuf[12+1], ubuf[11+1], gbuf[11+1]; |
char sbuf[FMT_SCALED_STRSIZE]; |
char sbuf[FMT_SCALED_STRSIZE]; |
time_t now; |
time_t now; |
|
|
strmode(st->st_mode, mode); |
strmode(st->st_mode, mode); |
if (remote) { |
if (remote) { |
snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); |
if (user == NULL) { |
user = ubuf; |
snprintf(ubuf, sizeof ubuf, "%u", (u_int)st->st_uid); |
snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); |
user = ubuf; |
group = gbuf; |
} |
|
if (group == NULL) { |
|
snprintf(gbuf, sizeof gbuf, "%u", (u_int)st->st_gid); |
|
group = gbuf; |
|
} |
strlcpy(lc, "?", sizeof(lc)); |
strlcpy(lc, "?", sizeof(lc)); |
} else { |
} else { |
user = user_from_uid(st->st_uid, 0); |
user = user_from_uid(st->st_uid, 0); |