Move printfmt function to lib/