not using getopt anymore, pure C++ equivalent. Program works as before