-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprints.c
37 lines (27 loc) · 1016 Bytes
/
prints.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// vim: ts=2 shiftwidth=2 noexpandtab
/*
* per - Simple unix permission viewer and converter
*
* This program is licensed under GPL version 3.
* Copyright is a theft.
* For more info see the LICENSE file or reffer to ``https://www.gnu.org/licenses/gpl-3.0.html''.
*/
#include <stdio.h>
#include "per.h"
char* regular_pnames[] = {"read", "write", "execute"};
char* special_pnames[] = {"suid", "sgid", "sticky"};
/* Printing Functions */
void
print_verbose(uint16_t numeric) {
printf("user: %s\n", numeric_to_verbose((numeric & 0700) >> 6, regular_pnames));
printf("group: %s\n", numeric_to_verbose((numeric & 0070) >> 3, regular_pnames));
printf("other: %s\n", numeric_to_verbose((numeric & 0007), regular_pnames));
if (specialp) {
printf("special: %s\n", numeric_to_verbose((numeric & 07000) >> 9, special_pnames));
}
} /* End of print_verbose */
void
usage() {
fprintf(stderr, "usage: per [-nSsv] [PATH | SYMBOLIC | NUMERIC | -]\n");
} /* End of usage() */
/* End of Printing Functions */