1 #include <sys/types.h> /* primitive system data types */
2 #include <stdlib.h> /* C standard library */
3 #include <stdio.h> /* standard I/O library */
4 #include <unistd.h> /* unix standard library */
5 #include <sys/acl.h> /* acl library (use -l acl) */
7 int main(int argc, char *argv[])
10 * Variables definition
16 /* must have an argument */
17 if ((argc - optind) != 1) {
18 printf("Wrong number of arguments %d\n", argc - optind);
22 acl = acl_get_file(argv[1], ACL_TYPE_ACCESS);
24 perror("cannot get acl for file");
27 buffer = acl_to_text(acl, &size);
29 perror("cannot convert acl");
32 printf("ACL for file '%s':\n%s\n", argv[1], buffer);