- make printf return int
add file functions
move some functions away from common.h
split up header files, make src pointer in write functions const