2b solved using getopt instead of analyzing argv