When I type ls -l
in the command line, sometimes an @
or +
symbol comes up alongside the file permissions(btw, I am on OS X), as shown below:
-rw-r-----@ 1 john staff 6731 Sep 28 01:10 mutations.txt
drwxr-xr-x+ 71 john staff 2414 Mar 25 18:16 ..
I know how to get the permission bits using the stat
structure, but I don't think these extended permission values are there. Can someone point me in the right direction as to how to obtain these values via a C or POSIX API?
EDIT:
I attempted the following:
#include <sys/types.h>
#include <sys/xattr.h>
#include <sys/types.h>
int main () {
char l[1024];
listxattr("/Users/john/desktop/mutations.txt", l, 1024, XATTR_SHOWCOMPRESSION);
printf("%s\n", l);
}
and got as output:
com.apple.metadata:kMDItemWhereFroms
Still trying to understand how to convert this to an @
or +
?
<sys/types.h>
twice. Not sure if this is by design. – Valerie