Functions to append/prepend with printf formatting

Add buffer_appendf and bugger_prependf to allow the
user to append or prepend a string formatted with
printf-style syntax.

Fixes #3