__INT32 __cdecl main(const __UINT32 argc, const char *const(argv)[]){ char *srvIp, *echoStr; __UINT32 srvPort; if (argc != 2 && argc != 3) return defErrHandle(INVALID_ARGUMENTS, ERRCODE_INVALID_ARGUMENTS, argc, argv); srvIp = (char*)malloc(strlen(argv[0]) + 1); echoStr = (char*)malloc(strlen(argv[1]) + 1); strcpy(srvIp, argv[0]); strcpy(echoStr, argv[1]); srvPort = argc == 3 ? atoi(argv[2]) : DEF_ECHO_PORT; if (testEcho(srvIp, srvPort, echoStr)) fputs("Succeeded!", stdout); else fputs("Failed!", stderr); return EXIT_SUCCESS; }
int main(int argc, char** argv) { // Time t = now(); if (argc == 2) { if (QString(argv[1]) == "--follow") { Ref<LogDisplay, Owner> display_; for (String path; input()->read(&path);) display_ = new LogDisplay(path); return 0; } } bool styleOverload = false; for (int i = 1; i < argc; ++i) if (QString(argv[i]).contains("-style")) styleOverload = true; #ifdef Q_WS_X11 bool needToUnsetGtk2RcFiles = false; if (!styleOverload) { String clearlooksRc = "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc"; String glossyRc = "/usr/share/themes/Glossy/gtk-2.0/gtkrc"; if (File(clearlooksRc).exists()) { Process::setEnv("GTK2_RC_FILES", clearlooksRc); needToUnsetGtk2RcFiles = true; } else if (File(glossyRc).exists()) { Process::setEnv("GTK2_RC_FILES", glossyRc); needToUnsetGtk2RcFiles = true; } } #endif QxApplication app(argc, argv); if (argc == 2) { if (QString(argv[1]) == "--vttest") { testVideoTerminal(); return 0; } else if (QString(argv[1]) == "--vtlong") { testLongLine(); return 0; } else if (QString(argv[1]) == "--vtload") { testVideoTerminalHighLoad(); return 0; } else if (QString(argv[1]) == "--echo") { testEcho(); return 0; } } QCoreApplication::setApplicationName("Pacu"); QCoreApplication::setApplicationVersion("1.2.4"); QCoreApplication::setOrganizationDomain("cyblogic.com"); QCoreApplication::setOrganizationName("Cyblogic"); if (argc == 2) { if (QString(argv[1]) == "--reset") QSettings().clear(); } else if (argc > 2) { if (QString(argv[1]) == "--open") { for (int i = 2; i < argc; ++i) print("\033]9;%%\007", argv[i]); return 0; } } // print("main(): t0 = %%ms\n", (now() - t).miliSeconds()); QxPacuTheme::load(); if (!styleOverload) QApplication::setStyle(new QxCustomStyle); // print("main(): t1 = %%ms\n", (now() - t).miliSeconds()); #ifdef Q_WS_X11 if (needToUnsetGtk2RcFiles) { Process::unsetEnv("GTK2_RC_FILES"); } #endif return app.exec(); }