23 lines
432 B
C
23 lines
432 B
C
#ifndef _PARSE_MODE_H
|
|
#define _PARSE_MODE_H
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#define U(x) (x << 6)
|
|
#define G(x) (x << 3)
|
|
#define O(x) (x)
|
|
#define A(x) (U(x) | G(x) | O(x))
|
|
|
|
#define FULL_PERM ((S_IRUSR | S_IRGRP | S_IROTH) | (S_IWUSR | S_IWGRP | S_IWOTH) | (S_IXUSR | S_IXGRP | S_IXOTH))
|
|
mode_t mu_parse_mode(const char *s) {
|
|
char *p = NULL;
|
|
mode_t mode = (mode_t)strtol(s, &p, 8);
|
|
if (!*p)
|
|
return mode;
|
|
|
|
//TODO
|
|
return A(7);
|
|
}
|
|
|
|
#endif
|