From 5a221e6b84e9eab02e24ca541530e28eb7cfddac Mon Sep 17 00:00:00 2001 From: Felix Janda Date: Mon, 22 Apr 2013 22:29:43 +0200 Subject: Add library function for the file permission formatting in ls and stat --- lib/lib.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'lib/lib.c') diff --git a/lib/lib.c b/lib/lib.c index 4d8e23a4..b89f2db8 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -1176,6 +1176,32 @@ barf: error_exit("bad mode '%s'", modestr); } +// Format a mode for ls and stat +void format_mode(char (*buf)[11], mode_t mode) +{ + char c, d; + int i, bit; + + (*buf)[10]=0; + for (i=0; i<9; i++) { + bit = mode & (1<