replace echo with printf; else not elseif; move endian.h to util