shithub: mc

ref: c7f8059e7ca08d7f31451090b96c6355724a164b
dir: /fmt.myr/

View raw version
use "die.use"
use "sys.use"
use "types.use"
use "str.use"

pkg std =
	const bfmt	: (buf : byte[,], fmt : byte[,], args:... -> size)
	const fmt	: (fmt : byte[,], args:... -> size)
;;

const fmt = {fmt, args
	var c
	var n

	n = 0
	while fmt.len
		(c, fmt) = striter(fmt)
		if c == '%'
			(c, fmt) = striter(fmt)
			match c
			's':
				write(1, "str")
				;;
			'd':
				write(1, "int")
				;;
			'p':
				write(1, "ptr")
				;;
			;;
		;;
	;;
	write(1, "\n")
	-> n
}