A (very) limited version of snprintf, Implemented with simplicity, and async-signal-safety in mind.