Rivoreo Source Code Repositories
src.rivoreo.one
/
toolbox
/
2d947409ed27cae627a25686c0a5d7fb1cfbcd81
/
.
/
str2mode.h
blob: 433eefb41442999a4006d0bf96574f28d19a1f32 [
file
] [
log
] [
blame
] [
raw
]
#define
STR2MODE
(
S
)
({
\
const
char
*
s
=
(
S
);
\
mode_t
r
=
0
;
\
while
(*
s
)
{
\
if
(*
s
>=
'0'
&&
*
s
<=
'7'
)
{
\
r
=
(
r
<<
3
)
|
(*
s
-
'0'
);
\
}
else
{
\
r
=
(
mode_t
)-
1
;
\
break
;
\
}
\
s
++;
\
}
\
r
&
S_IFMT
?
(
mode_t
)-
1
:
r
;
\
})