2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
14 ULONG
prot_u2a(mode_t protect
);
16 int chmod(const char *path
, mode_t mode
)
18 if (!SetProtection(path
, prot_u2a(mode
)))
20 errno
= IoErr2errno(IoErr());
28 /* taken from emul_handler */
29 ULONG
prot_u2a(mode_t protect
)
31 ULONG aprot
= FIBF_SCRIPT
;
33 /* The following three (AROS) flags are low-active! */
34 if (!(protect
& S_IRUSR
))
36 if (!(protect
& S_IWUSR
))
38 if (!(protect
& S_IXUSR
))
39 aprot
|= FIBF_EXECUTE
;
41 /* The following flags are high-active again. */
42 if ((protect
& S_IRGRP
))
43 aprot
|= FIBF_GRP_READ
;
44 if ((protect
& S_IWGRP
))
45 aprot
|= FIBF_GRP_WRITE
;
46 if ((protect
& S_IXGRP
))
47 aprot
|= FIBF_GRP_EXECUTE
;
48 if ((protect
& S_IROTH
))
49 aprot
|= FIBF_OTR_READ
;
50 if ((protect
& S_IWOTH
))
51 aprot
|= FIBF_OTR_WRITE
;
52 if ((protect
& S_IXOTH
))
53 aprot
|= FIBF_OTR_EXECUTE
;