add testnet support: --testnet or -T

Support for testnet-style addresses is still missing.
logfile for testnet.
do not file_sync header file.
from Josselin: correctly handle invalid option