progress.c: Minor compilation fixes and reorg. to be able to use in a
library.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>