ref: 00a119d9f78148039fcd0e0641f67e3847c8f357
dir: /libstd/blat.myr/
use "sys.use"
use "fmt.use"
pkg std =
	const blat : (path : byte[:], buf : byte[:] -> bool)
	const fblat : (f : fd, buf : byte[:] -> bool)
;;
const blat = {path, buf
	var fd
	fd = openmode(path, Ocreat|Owronly, 0o777)
	if fd < 0
		-> false
	;;
	-> fblat(fd, buf)
}
const fblat = {fd, buf
	var written, n
	n = 0
	while true
		written = write(fd, buf[n:])
		if written <= 0
			goto done
		;;
		n += written
	;;
:done
	-> written == 0
}