4
4
5
5
import cpp
6
6
7
+ /**
8
+ * Gets the number corresponding to the contents of `input` in base-8.
9
+ * Note: the first character of `input` must be `0`. For example:
10
+ * `parseOctal("012345") = 5349`.
11
+ */
7
12
bindingset [ input]
8
13
int parseOctal ( string input ) {
9
14
input .charAt ( 0 ) = "0" and
@@ -15,44 +20,77 @@ int parseOctal(string input) {
15
20
)
16
21
}
17
22
23
+ /** Gets the number corresponding to the "set-user-ID on execute bit" in Unix. */
18
24
int s_isuid ( ) { result = parseOctal ( "04000" ) }
19
25
26
+ /** Gets the number corresponding to the "set-group-ID on execute bit" in Unix. */
20
27
int s_isgid ( ) { result = parseOctal ( "02000" ) }
21
28
29
+ /** Gets the number corresponding to the sticky bit in Unix. */
22
30
int s_isvtx ( ) { result = parseOctal ( "01000" ) }
23
31
32
+ /** Gets the number corresponding to the read permission bit for owner of the file in Unix. */
24
33
int s_irusr ( ) { result = parseOctal ( "0400" ) }
25
34
35
+ /** Gets the number corresponding to the write permission bit for owner of the file in Unix. */
26
36
int s_iwusr ( ) { result = parseOctal ( "0200" ) }
27
37
38
+ /** Gets the number corresponding to the execute permission bit for owner of the file in Unix. */
28
39
int s_ixusr ( ) { result = parseOctal ( "0100" ) }
29
40
41
+ /** Gets the number corresponding to the permissions `S_IRUSR | S_IWUSR | S_IXUSR` in Unix. */
30
42
int s_irwxu ( ) { result = s_irusr ( ) .bitOr ( s_iwusr ( ) ) .bitOr ( s_ixusr ( ) ) }
31
43
44
+ /**
45
+ * Gets the number corresponding to the read permission bit for the group
46
+ * owner of the file in Unix.
47
+ */
32
48
int s_irgrp ( ) { result = s_irusr ( ) .bitShiftRight ( 3 ) }
33
49
50
+ /**
51
+ * Gets the number corresponding to the write permission bit for the group
52
+ * owner of the file in Unix.
53
+ */
34
54
int s_iwgrp ( ) { result = s_iwusr ( ) .bitShiftRight ( 3 ) }
35
55
56
+ /**
57
+ * Gets the number corresponding to the execute permission bit for the group
58
+ * owner of the file in Unix.
59
+ */
36
60
int s_ixgrp ( ) { result = s_ixusr ( ) .bitShiftRight ( 3 ) }
37
61
62
+ /** Gets the number corresponding to the permissions `S_IRGRP | S_IWGRP | S_IXGRP` in Unix. */
38
63
int s_irwxg ( ) { result = s_irwxu ( ) .bitShiftRight ( 3 ) }
39
64
65
+ /** Gets the number corresponding to the read permission bit for other users in Unix. */
40
66
int s_iroth ( ) { result = s_irgrp ( ) .bitShiftRight ( 3 ) }
41
67
68
+ /** Gets the number corresponding to the write permission bit for other users in Unix. */
42
69
int s_iwoth ( ) { result = s_iwgrp ( ) .bitShiftRight ( 3 ) }
43
70
71
+ /** Gets the number corresponding to the execute-or-search permission bit for other users in Unix. */
44
72
int s_ixoth ( ) { result = s_ixgrp ( ) .bitShiftRight ( 3 ) }
45
73
74
+ /** Gets the number corresponding to the permissions `S_IROTH | S_IWOTH | S_IXOTH` in Unix. */
46
75
int s_irwxo ( ) { result = s_irwxg ( ) .bitShiftRight ( 3 ) }
47
76
77
+ /**
78
+ * Gets the number that can be used in a bitwise and with the file status flag
79
+ * to produce a number representing the file access mode.
80
+ */
48
81
int o_accmode ( ) { result = parseOctal ( "0003" ) }
49
82
83
+ /** Gets the number corresponding to the read-only file access mode. */
50
84
int o_rdonly ( ) { result = parseOctal ( "00" ) }
51
85
86
+ /** Gets the number corresponding to the write-only file access mode. */
52
87
int o_wronly ( ) { result = parseOctal ( "01" ) }
53
88
89
+ /** Gets the number corresponding to the read-and-write file access mode. */
54
90
int o_rdwr ( ) { result = parseOctal ( "02" ) }
55
91
92
+ /** Gets the number corresponding to the file creation flag O_CREAT on Linux. */
56
93
int o_creat ( ) { result = parseOctal ( "0100" ) }
57
94
95
+ /** Gets the number corresponding to the file creation flag O_EXCL on Linux. */
58
96
int o_excl ( ) { result = parseOctal ( "0200" ) }
0 commit comments