int main(int argc, char **argv) { int c; // Parse options while(1) { int option_index = 0; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {0,0,0,0} }; c = getopt_long (argc, argv, "h", long_options, &option_index); if (c == -1) break; switch(c) { case 'h': case '?': Usage(argc,argv); return 0; default: printf ("?? getopt returned character code 0%o ??\n", c); } } MainApp myApplication; myApplication.Run(); return(0); }
/* FUNCTION: main ARGS: arc number of command line arguments argv vector to arguments RETURN: Exit status DESCRIPTION: main program entry point */ int main(int argc, char **argv) { // Check if shape specified on command line MainWindow::SHAPE shape = MainWindow::BOOK; if (argc > 1) { int value = *argv[1] - '0'; if (value >= 0 && value < MainWindow::NUMBER_OF_SHAPES) shape = (MainWindow::SHAPE) value; } MainApp *app = new MainApp(shape); app->Run(); delete app; }