Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/seed/host/tests/truncate.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / host / tests / truncate.om` 33 lines ยท 517 bytes Raw Blame History 1 note truncate: path form of ftrunc; st_size at byte 48 becomes 4, a missing path returns negative. 2 text p "tr.tmp" 3 text body "abcdefgh" 4 text miss "no.such.file" 5 fn main to int 6 fd = int fopen p 0 len p 578 420 7 if lt fd 0 8 ret 1 9 end 10 w = write fd body 0 len body 11 r = fclose fd 12 r = truncate p 0 len p 4 13 if ne r 0 14 ret 2 15 end 16 st = new uchar 128 0 17 r = stat p 0 len p st 0 128 18 if ne r 0 19 ret 3 20 end 21 if ne get st 48 4 22 ret 4 23 end 24 r = truncate miss 0 len miss 4 25 if ge r 0 26 ret 5 27 end 28 r = unlink p 0 len p 29 if ne r 0 30 ret 6 31 end 32 ret 0 33 end