omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / host / tests / faccess.om
| 1 | note faccess: F_OK (0) on an existing path succeeds; a missing path returns a negative error. |
| 2 | text p "acc.tmp" |
| 3 | text miss "no.such.file" |
| 4 | fn main to int |
| 5 | fd = int fopen p 0 len p 578 420 |
| 6 | if lt fd 0 |
| 7 | ret 1 |
| 8 | end |
| 9 | r = fclose fd |
| 10 | if ne r 0 |
| 11 | ret 2 |
| 12 | end |
| 13 | r = faccess p 0 len p 0 |
| 14 | if ne r 0 |
| 15 | ret 3 |
| 16 | end |
| 17 | r = faccess miss 0 len miss 0 |
| 18 | if ge r 0 |
| 19 | ret 4 |
| 20 | end |
| 21 | r = unlink p 0 len p |
| 22 | if ne r 0 |
| 23 | ret 5 |
| 24 | end |
| 25 | ret 0 |
| 26 | end |