libk  emitc.fn.c at [8d478e0b3c]

File mod/kstr/emitc.fn.c artifact 0654040df9 part of check-in 8d478e0b3c


#include <k/type.h>
#include <k/str.h>
#include <k/io.h>

kcond
ksemitc(const char** array, sz bufsz, kiochan channel) {
	ubyte cache [sizeof(ksbuf) + bufsz];
	ksbuf* out = ksbufmk(cache, channel, bufsz);

	kcond c = ksbufwrite(out, array);
	if (!kokay(c)) return c;

	return ksbufflush(out);
}