shithub: mc

Download patch

ref: 595f94567824d5c4d1e4ef75ed825eccc6b1783c
parent: c13709b6d407e69dcaf10134c01cabb67b5dee13
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 18 20:25:00 EDT 2016

Add putv to bio.

--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -69,6 +69,7 @@
 
 	/* formatted i/o */
 	const put	: (f : file#, fmt : byte[:], args : ... -> status(std.size))
+	const putv	: (f : file#, fmt : byte[:], ap : std.valist# -> status(std.size))
 
 	/* pkg funcs */
 	pkglocal const ensureread	: (f : file#, n : std.size -> status(std.size))
@@ -524,6 +525,15 @@
 
 	ap = std.vastart(&args)
 	sl = std.fmtv(fmt, &ap)
+	n = write(f, sl)
+	std.slfree(sl)
+	-> n
+}
+
+const putv = {f, fmt, ap
+	var sl, n
+
+	sl = std.fmtv(fmt, ap)
 	n = write(f, sl)
 	std.slfree(sl)
 	-> n