int main(int argc, char** argv) { int ch, mode = LIST_MODE; while ((ch = getopt(argc, argv, "th")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 't': mode = TEST_MODE; break; default: usage(); exit(EXIT_FAILURE); } } argc -= optind; argv += optind; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); if (mode == LIST_MODE) list_modes(); else if (mode == TEST_MODE) test_modes(); exit(EXIT_SUCCESS); }
int main(int argc, char** argv) { int ch, i, count, mode = LIST_MODE; GLFWmonitor** monitors; while ((ch = getopt(argc, argv, "th")) != -1) { switch (ch) { case 'h': usage(); exit(EXIT_SUCCESS); case 't': mode = TEST_MODE; break; default: usage(); exit(EXIT_FAILURE); } } argc -= optind; argv += optind; glfwSetErrorCallback(error_callback); if (!glfwInit()) exit(EXIT_FAILURE); monitors = glfwGetMonitors(&count); for (i = 0; i < count; i++) { if (mode == LIST_MODE) list_modes(monitors[i]); else if (mode == TEST_MODE) test_modes(monitors[i]); } glfwTerminate(); exit(EXIT_SUCCESS); }