fix compilation
remove cmdarg in favor of getopt.