3 # Wrapper for the ls -D command
5 $esc = quotemeta($ARGV[0]);
6 $out = `ls -dDL $esc 2>&1`;
11 if ($out !~ /\[([^\]]*)\]/) {
12 print STDERR "Failed to parse ls -D output : $out\n";
16 # Convert to normal ACL form
17 ($acl, $dacl) = split(/\//, $1);
18 foreach (split(/,/, $acl)) {
25 foreach (split(/,/, $dacl)) {
30 print "default:",$_,"\n";
34 # Make up ACL from perms
35 local @st = stat($ARGV[0]);
36 local $other = $st[2] & 7;
37 local $group = ($st[2] >> 3) & 7;
38 local $user = ($st[2] >> 6) & 7;
39 print "user::",&octal_to_perms($user),"\n";
40 print "group::",&octal_to_perms($group),"\n";
41 print "other::",&octal_to_perms($other),"\n";
42 print "mask::",&octal_to_perms($user | $group),"\n";
48 $rv .= ($_[0] & 4 ? "r" : "-");
49 $rv .= ($_[0] & 2 ? "w" : "-");
50 $rv .= ($_[0] & 1 ? "x" : "-");