Some more magicnumber vs. sizeof(staticbuf)
No vsprintf calls left. please use vsnprintf in new code :)
Ported first half of sprintf calls to snprintf