In the following line the argument to sizeof should be bufa.
This hould not even compile, since buf is undefined in this scope.
(Unless there is something funky going on in the headers).
if ((sz = vsnprintf(bufa, sizeof(buf), fmt, cap)) < BUFSZ) {
--
Remco Treffkorn (RT445)
HAM DC2XT
remco@rvt.com (831) 685-1201