printmode: add xlat style support to print_symbolic_mode_t
* printmode.c (print_symbolic_mode_t): Set ifmt to an empty string, print raw and decoded values based on current xlat_verbosity setting.
This commit is contained in:
parent
cc52da10c6
commit
96ebee2121
31
printmode.c
31
printmode.c
@ -40,25 +40,24 @@
|
||||
void
|
||||
print_symbolic_mode_t(const unsigned int mode)
|
||||
{
|
||||
const char *ifmt;
|
||||
const char *ifmt = "";
|
||||
|
||||
if (mode & S_IFMT) {
|
||||
if (mode & S_IFMT)
|
||||
ifmt = xlookup(modetypes, mode & S_IFMT);
|
||||
if (!ifmt) {
|
||||
tprintf("%#03o", mode);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ifmt = NULL;
|
||||
}
|
||||
|
||||
tprintf("%s%s%s%s%s%#03o",
|
||||
ifmt ? ifmt : "",
|
||||
ifmt ? "|" : "",
|
||||
(mode & S_ISUID) ? "S_ISUID|" : "",
|
||||
(mode & S_ISGID) ? "S_ISGID|" : "",
|
||||
(mode & S_ISVTX) ? "S_ISVTX|" : "",
|
||||
mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX));
|
||||
if (!ifmt || xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
|
||||
tprintf("%#03o", mode);
|
||||
|
||||
if (!ifmt || xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
|
||||
return;
|
||||
|
||||
(xlat_verbose(xlat_verbosity) == XLAT_STYLE_ABBREV
|
||||
? tprintf : tprintf_comment)("%s%s%s%s%s%#03o",
|
||||
ifmt, ifmt[0] ? "|" : "",
|
||||
(mode & S_ISUID) ? "S_ISUID|" : "",
|
||||
(mode & S_ISGID) ? "S_ISGID|" : "",
|
||||
(mode & S_ISVTX) ? "S_ISVTX|" : "",
|
||||
mode & ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX));
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user