]>
sourceware.org Git - newlib-cygwin.git/blob - winsup/utils/getfacl.c
16 pbuf
[0] = (perm
& S_IREAD
) ? 'r' : '-';
17 pbuf
[1] = (perm
& S_IWRITE
) ? 'w' : '-';
18 pbuf
[2] = (perm
& S_IEXEC
) ? 'x' : '-';
27 static char ubuf
[256];
30 if (pw
= getpwuid (uid
))
31 strcpy (ubuf
, pw
->pw_name
);
33 strcpy (ubuf
, "<unknown>");
39 static char gbuf
[256];
42 if (gr
= getgruid (gid
))
43 strcpy (gbuf
, gr
->gr_name
);
45 strcpy (gbuf
, "<unknown>");
50 main (int argc
, char **argv
)
58 aclent_t acls
[MAX_ACL_ENTRIES
];
60 while ((c
= getopt (argc
, argv
, "ad")) != EOF
)
70 fprintf (stderr
, "usage: %s [-ad] file...\n", argv
[0]);
73 while ((c
= optind
++) < argc
)
75 if (stat (argv
[c
], &st
))
83 printf ("# file: %s\n", argv
[c
]);
84 printf ("# owner: %d\n", st
.st_uid
);
85 printf ("# group: %d\n", st
.st_gid
);
86 if ((c
= acl (argv
[c
], GETACL
, MAX_ACL_ENTRIES
, acls
)) < 0)
91 for (i
= 0; i
< c
; ++i
)
93 if (acls
[i
].a_type
& ACL_DEFAULT
)
101 switch (acls
[i
].a_type
& ~ACL_DEFAULT
)
107 printf ("user:%d:", acls
[i
].a_id
);
113 printf ("group:%d:", acls
[i
].a_id
);
122 printf ("%s\n", permstr (acls
[i
].a_perm
));
This page took 0.043862 seconds and 6 git commands to generate.