add nbtool_config.h
sync with FreeBSD
check and fix printf formats, negative array indices, uninitialized variables,shadowed variables.
branches: 1.1.1;Initial revision