merged with version from https://github.com/MarioViara/xprintfc