omega-mcp
aien-dev/omega-mcp
Brought by drakestapleton
omega-mcp / data / examples / files.om
| 1 | note open, write, sync, lock, seek, read, positioned read and write, truncate, stat, chmod, unlink, memfd |
| 2 | text path "demo.txt" |
| 3 | global data uchar 5 |
| 4 | global buf uchar 128 |
| 5 | fn ck yes bool to void |
| 6 | if not yes |
| 7 | exit 80 |
| 8 | end |
| 9 | end |
| 10 | fn main to int |
| 11 | for i ulong 5 |
| 12 | put data i uchar add 97 i |
| 13 | end |
| 14 | old = umask 18 |
| 15 | fd = int fopen path 0 len path 578 420 |
| 16 | ck ge fd 0 |
| 17 | ck eq write fd data 0 len data 5 |
| 18 | ck eq fsync fd 0 |
| 19 | ck eq fdsync fd 0 |
| 20 | ck eq flock fd 2 0 |
| 21 | ck eq syncfs fd 0 |
| 22 | ck eq pwrite fd data 0 1 5 1 |
| 23 | ck eq fseek fd 0 0 0 |
| 24 | ck eq read fd buf 0 6 6 |
| 25 | ck eq pread fd buf 0 2 3 2 |
| 26 | ck eq ftrunc fd 3 0 |
| 27 | ck eq fstat fd buf 0 128 0 |
| 28 | ck eq fchmod fd 384 0 |
| 29 | ck eq fclose fd 0 |
| 30 | ck eq stat path 0 len path buf 0 128 0 |
| 31 | ck eq lstat path 0 len path buf 0 128 0 |
| 32 | ck eq chmod path 0 len path 420 0 |
| 33 | ck eq faccess path 0 len path 4 0 |
| 34 | ck eq truncate path 0 len path 1 0 |
| 35 | ck eq unlink path 0 len path 0 |
| 36 | m = memfd path 0 len path 0 |
| 37 | ck ge m 0 |
| 38 | ret 0 |
| 39 | end |