int main (int argc, char* const argv[]) { init(); if (argc == 1 && usage()) return 0; if (parseCmdLine(argc, argv) != 0) return 0; if (optShowHelp && showHelp()) return 0; if (optShowVersion && showVersion()) return 0; curl_global_init(CURL_GLOBAL_ALL); for (int i = 0; i < optFiles.size(); i++) { std::string processed = processImage(optFiles[i], optImageSize); if (processed == "") continue; if (processed != optFiles[i]) tempFiles.push_back(processed); std::string err; std::string output = uploadImage(processed.c_str(), err); if (!userOutput(output) || err.length() > 0) fprintf(stderr, "Upload failed for %s.\n%s\n", optFiles[i].c_str(), err.c_str()); } for (int i = 0; i < tempFiles.size(); i++) remove(tempFiles[i].c_str()); return 0; }
int main(int argc, char *argv[]) { char const * dir; int root_fd; int this_fd; char * umount_cmd[] = { UMOUNT_PROG, "-l", "-n", ".", 0 }; if (argc<2) { WRITE_MSG(2, "Try '"); WRITE_STR(2, argv[0]); WRITE_MSG(2, " --help' for more information.\n"); return EXIT_FAILURE; } if (strcmp(argv[1], "--help")==0) showHelp(1, argv[0], 0); if (strcmp(argv[1], "--version")==0) showVersion(); dir = argv[1]; if (strcmp(dir, "--")==0 && argc>=3) dir = argv[2]; root_fd = Eopen("/", O_RDONLY, 0); Echroot("."); Echdir(dir); this_fd = Eopen(".", O_RDONLY, 0); Efchdir(root_fd); Echroot("."); Efchdir(this_fd); Eclose(root_fd); Eclose(this_fd); Eexecv(umount_cmd[0], umount_cmd); }
static void showHelp() { std::cerr << "Usage moc: [options] <header-file>\n" " -o<file> write output to file rather than stdout\n" " -I<dir> add dir to the include path for header files\n" " -E preprocess only; do not generate meta object code\n" " -D<macro>[=<def>] define macro, with optional definition\n" " -U<macro> undefine macro\n" " -M<key=valye> add key/value pair to plugin meta data\n" " -i do not generate an #include statement\n" // " -p<path> path prefix for included file\n" // " -f[<file>] force #include, optional file name\n" // " -nn do not display notes\n" // " -nw do not display warnings\n" // " @<file> read additional options from file\n" " -v display version of moc-ng\n" /* undocumented options " -include <file> Adds an implicit #include into the predefines buffer which is read before the source file is preprocessed\n" " -W<warnings> Enable the specified warning\n" " -f<option> clang option\n" " -X<ext> <arg> extensions arguments\n" */ << std::endl; showVersion(false); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setOrganizationDomain(QLatin1String("mapeditor.org")); a.setApplicationName(QLatin1String("TmxRasterizer")); a.setApplicationVersion(QLatin1String("1.0")); CommandLineOptions options; parseCommandLineArguments(options); if (options.showVersion) { showVersion(); return 0; } if (options.showHelp || options.fileToOpen.isEmpty() || options.fileToSave.isEmpty()) { showHelp(); return 0; } if (options.scale <= 0.0 && options.tileSize <= 0) { showHelp(); return 0; } TmxRasterizer w; w.setAntiAliasing(options.useAntiAliasing); if (options.tileSize > 0) { w.setTileSize(options.tileSize); } else if (options.scale > 0.0) { w.setScale(options.scale); } return w.render(options.fileToOpen, options.fileToSave); }
void Options::showUsage(std::ostream& stream) const { showVersion(stream); stream << "\nUsage:\n" << " " << program_name_ << " [options]\n\n" << desc_ << "\nExamples:\n" << " Generate waveform data from an MP3 file, at 256 samples per point\n" << " with 8-bit resolution:\n" << " " << program_name_ << " -i test.mp3 -o test.dat -z 256 -b 8\n\n" << " Generate a 1000x200 pixel PNG image from a waveform data file\n" << " at 512 samples per pixel, starting at 5.0 seconds:\n" << " " << program_name_ << " -i test.dat -o test.png -z 512 -s 5.0 -w 1000 -h 200\n\n" << " Generate a 1000x2000 pixel PNG image from a waveform data file\n" << " starting at 5.0 seconds, ending at 10.0 seconds:\n" << " " << program_name_ << " -i test.dat -o test.png -s 5.0 -e 10.0 -w 1000 -h 200\n\n" << " Convert a waveform data file to JSON format:\n" << " " << program_name_ << " -i test.dat -o test.json\n\n" << " Convert MP3 to WAV format audio:\n" << " " << program_name_ << " -i test.mp3 -o test.wav\n"; }
/* usage() - print usage information */ void usage(char *procname, boolean full) { if (full) { showVersion(procname); printf("\nUsage:\n "); } printf("%s [options] -f file.yml [dbname [username]]\n", procname); if (full) { printf( "\n" "General options:\n" " -? | --help show this help, then exit\n" " -V | --version show version information, then exit\n" " -v | --verbose verbose output\n" " -x | --explain do not run jobs, but produce explain plans\n" " -X | --explain-analyze run jobs and produce explain-analyze plans\n" " -k | --key <name>=<value> sets a yaml variable\n" "\n" "Connection options:\n" " -h | --host <hostname> database server host or socket directory\n" " -p | --port <port> database server port\n" " -U | --username <username> database user name\n" " -W | --password prompt for password\n" ); } }
int main(int argc, char *argv[]) { // Avoid performance issues with X11 engine when rendering objects #ifdef Q_WS_X11 QApplication::setGraphicsSystem(QLatin1String("raster")); #endif QApplication a(argc, argv); a.setOrganizationDomain(QLatin1String("mapeditor.org")); a.setApplicationName(QLatin1String("TmxViewer")); a.setApplicationVersion(QLatin1String("1.0")); CommandLineOptions options; parseCommandLineArguments(options); if (options.showVersion) showVersion(); if (options.showHelp || (options.fileToOpen.isEmpty() && !options.showVersion)) showHelp(); if (options.showVersion || options.showHelp || options.fileToOpen.isEmpty()) return 0; TmxViewer w; w.viewMap(options.fileToOpen); w.show(); return a.exec(); }
int main(int argc,char *argv[]) { int opt; prefix[0] = 0; target_ip = 0; debug = verbose = 0; while((opt=getopt(argc,argv,"dD:iI:t:vV")) != EOF) { switch(opt) { case 'D': sprintf(prefix,"%s",optarg); break; case 'i': strcpy(prefix,"${IPADD}"); break; case 'I': sprintf(prefix,"%s/${IPADD}",optarg); break; case 't': target_ip = optarg; ttftp_init(); tftpQuiet = 1; break; case 'V': showVersion(); break; case 'v': verbose = 1; break; default: usage(0); } } if (target_ip) mkflist_fromtftp(target_ip); else mkflist_fromcli(argc,argv); if (!fbase) { fprintf(stderr,"Failed to generate file list\n"); exit(1); } if (debug) { flist = fbase; while(flist) { printf("Name: <%s> flgs: <%s> info: <%s>\n", flist->tfs_fname,flist->flags,flist->info); flist = flist->next; } } mkupdate(); exit(0); }
static void parse_args(int ac, char **av) { int verbose = 1; int i; if (ac == 1) return; for (i = 1; i < ac; i++) if (strcmp(av[i], "-c") == 0) i++; else if (strcmp(av[i], "--configtest") == 0) { load_config(verbose); if (hash_get("ApplyFileSpec") != NULL) FileSpecActiveProfils(hash_get("ApplyFileSpec"), verbose); (void) printf("Config is valid.\n"); exit(0); } else if (strcmp(av[i], "--help") == 0) { help: (void) printf("Build:\n\t"); showVersion(0); (void) printf("\nUsage:\n\t%s [verbose] [options]\n\nOptions:\n", av[0]); (void) printf( "\t--configtest : test the config file and show errors\n"); (void) printf("\t--help : show this screen\n"); (void) printf("\t--version : show version of MySecureShell\n"); (void) printf("\nVerbose:\n"); (void) printf("\t-v : add a level at verbose mode\n"); exit(0); } else if (strcmp(av[i], "--version") == 0) { showVersion(1); exit(0); } else if (strcmp(av[i], "-v") == 0) verbose++; else { (void) printf("--- UNKNOW OPTION: %s ---\n\n", av[i]); goto help; } }
AppOptions::AppOptions(int argc, const char* argv[]) : m_exeName(base::get_file_name(argv[0])) , m_startUI(true) , m_startShell(false) , m_verboseEnabled(false) , m_palette(m_po.add("palette").requiresValue("<filename>").description("Use a specific palette by default")) , m_shell(m_po.add("shell").description("Start an interactive console to execute scripts")) , m_batch(m_po.add("batch").mnemonic('b').description("Do not start the UI")) , m_saveAs(m_po.add("save-as").requiresValue("<filename>").description("Save the last given document with other format")) , m_scale(m_po.add("scale").requiresValue("<factor>").description("Resize all previous opened documents")) , m_data(m_po.add("data").requiresValue("<filename.json>").description("File to store the sprite sheet metadata")) , m_format(m_po.add("format").requiresValue("<format>").description("Format to export the data file (json-hash, json-array)")) , m_sheet(m_po.add("sheet").requiresValue("<filename.png>").description("Image file to save the texture")) , m_sheetWidth(m_po.add("sheet-width").requiresValue("<pixels>").description("Sprite sheet width")) , m_sheetHeight(m_po.add("sheet-height").requiresValue("<pixels>").description("Sprite sheet height")) , m_sheetPack(m_po.add("sheet-pack").description("Use a packing algorithm to avoid waste of space\nin the texture")) , m_splitLayers(m_po.add("split-layers").description("Import each layer of the next given sprite as\na separated image in the sheet")) , m_layer(m_po.add("layer").alias("import-layer").requiresValue("<name>").description("Include just the given layer in the sheet")) , m_frameTag(m_po.add("frame-tag").requiresValue("<name>").description("Include tagged frames in the sheet")) , m_ignoreEmpty(m_po.add("ignore-empty").description("Do not export empty frames/cels")) , m_borderPadding(m_po.add("border-padding").requiresValue("<value>").description("Add padding on the texture borders")) , m_shapePadding(m_po.add("shape-padding").requiresValue("<value>").description("Add padding between frames")) , m_innerPadding(m_po.add("inner-padding").requiresValue("<value>").description("Add padding inside each frame")) , m_trim(m_po.add("trim").description("Trim all images before exporting")) , m_crop(m_po.add("crop").requiresValue("x,y,width,height").description("Crop all the images to the given rectangle")) , m_filenameFormat(m_po.add("filename-format").requiresValue("<fmt>").description("Special format to generate filenames")) , m_script(m_po.add("script").requiresValue("<filename>").description("Execute a specific script")) , m_verbose(m_po.add("verbose").mnemonic('v').description("Explain what is being done")) , m_help(m_po.add("help").mnemonic('?').description("Display this help and exits")) , m_version(m_po.add("version").description("Output version information and exit")) { try { m_po.parse(argc, argv); m_verboseEnabled = m_po.enabled(m_verbose); m_paletteFileName = m_po.value_of(m_palette); m_startShell = m_po.enabled(m_shell); if (m_po.enabled(m_help)) { showHelp(); m_startUI = false; } else if (m_po.enabled(m_version)) { showVersion(); m_startUI = false; } if (m_po.enabled(m_shell) || m_po.enabled(m_batch)) { m_startUI = false; } } catch (const std::runtime_error& parseError) { std::cerr << m_exeName << ": " << parseError.what() << '\n' << "Try \"" << m_exeName << " --help\" for more information.\n"; m_startUI = false; } }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); a.setApplicationName("qlabnetfake"); a.setApplicationVersion("0.0.1-pre-alpha"); server s; //a.connect(&s,SIGNAL(wantAbort()),&a,SLOT(quit())); QStringList arglist=a.arguments(); for (int i=0;i<arglist.size();i++) { if (arglist.at(i)=="--version") { showVersion(); return 0; } if (arglist.at(i)=="--help") { showHelp(); return 0; } } if (a.argc()>1) { qDebug("There is command-line arguments, good..."); QString infile=arglist.at(1); QFile file(infile); if (file.exists()) { qDebug()<<"Trying to open file " <<infile; } else { qCritical("File '%s' does not exist. Consider quit, bye!", qPrintable(infile)); return 1; } } else { qWarning()<<"No file specified. Will try to open sample.dat\n"; qWarning("Run '%s infile'",qPrintable(arglist.at(0))); QFile file("sample.dat"); if (QFile::exists("sample.dat")) { s.setInFile("sample.dat"); } else { qCritical("File 'sample.dat' does not exist. Consider quit, bye!"); return 1; } } return a.exec(); }
int main(int argc, char *argv[]) { int en_daemonize = 0; int i; for(i=1; i<argc; i++){ if (!strcmp(argv[i], "-d")) { en_daemonize = 1; //daemonize("/tmp", "/tmp/pikeyd.pid"); } else if (!strcmp(argv[i], "-k")) { daemonKill("/tmp/pikeyd.pid"); exit(0); } else if (!strcmp(argv[i], "-r")) { force_repeat(); } else if (!strcmp(argv[i], "-v")) { showVersion(); exit(0); } else if (!strcmp(argv[i], "-h")) { showHelp(); exit(0); } /* debug options */ else if (!strncmp(argv[i], "-D", 2)) { int d = 1; char *p = &argv[i][2]; if (argv[i][2]) { d = strtol(&argv[i][2], &p, 10); if (d > 10) { d = 10; } } if (*p) { printf("Unknown -D option: %s\n", argv[i]); exit(-1); } debug_init(d); printf("DEBUG LEVEL %d\n", d); } else { printf("Unknown command line argument: %s\n", argv[i]); showHelp(); exit(-1); } } if(en_daemonize){ daemonize("/tmp", "/tmp/pikeyd.pid"); } <<<<<<< HEAD
int main(int argc, char **argv) { QApplication app(argc, argv); QTextCodec *tc = QTextCodec::codecForName("utf8"); QTextCodec::setCodecForCStrings(tc); QString url = "http://www.yahoo.cn"; QWebSettings::setMaximumPagesInCache(20); app.setApplicationName(VB_PRODUCT_NAME); app.setApplicationVersion( QString("%1.%2.%3") .arg(VB_MAJORVERSION_NUMBER) .arg(VB_MINORVERSION_NUMBER) .arg(VB_PATCHLEVEL_NUMBER) ); QCoreApplication::setOrganizationName("Yahoo China EEEE"); QCoreApplication::setOrganizationDomain("eeeeworks.org"); QCoreApplication::setApplicationName(VB_PRODUCT_NAME); QWebSettings::setObjectCacheCapacities((16*1024*1024) / 8, (16*1024*1024) / 8, 16*1024*1024); QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); const QStringList args = app.arguments(); QStringList jsFiles; for (int i = 1; i < args.count(); i++) { QString arg = args.at(i); if (arg == "-h" || arg == "--help") { //argHelp = true; help(0); } else if (arg.indexOf("--js=") == 0) { QString jsFile = arg.split("=").at(1); jsFiles.push_back(jsFile); } else if (arg == "-v" || arg == "--version") { showVersion(app); return 0; } else if (arg.indexOf("-") == 0) { fprintf(stderr, "Invalid command-line option: %s\n\n", arg.toUtf8().data()); exit(1); } else { url = arg; } } MainWindow window(url); //qDebug() << "js files: " << jsFiles << endl; if (jsFiles.count() > 0) { window.setJSFiles(jsFiles); } window.show(); return app.exec(); }
CLI::CLI(int & argc, char ** argv) : m_impl(new Impl) { // Setup dispatch_function_t stopHandler = [](void * ctx){ static_cast<CLI*>(ctx)->stop();}; m_impl->signalSourceINT = createSourceSignal(SIGINT, this, stopHandler); m_impl->signalSourceTERM = createSourceSignal(SIGTERM, this, stopHandler); // UI showVersion(); parse(argc, argv); }
void Options::parse(int argc, char** argv) { bool isLevelNotSet = true; for (int argx = 1; argx < argc; argx++) { // Handle Starting Level Option if ( strcmp(argv[argx], "--level") == 0 || strcmp(argv[argx], "-l") == 0) { // Confirm that a level number has been provided. if (argx + 1 >= argc || !isPositiveInt(argv[argx + 1])) { die("You must provide a level number."); } // Confirm that the provided level is within range and is thus // valid. startingLevelNum = atoi(argv[++argx]); if (startingLevelNum < 1 || startingLevelNum > LevelManager::GetTotal()) { die("Invalid level."); } isLevelNotSet = false; // Handle Help Flags. } else if ( strcmp(argv[argx], "--help") == 0 || strcmp(argv[argx], "-h") == 0) { showHelp(); // Handle Version Flags. } else if ( strcmp(argv[argx], "--version") == 0 || strcmp(argv[argx], "-v") == 0 ) { showVersion(); // Initial Mode will be the Editor. } else if ( strcmp(argv[argx], "--editor") == 0 || strcmp(argv[argx], "-e") == 0 ) { initialState = EDIT; // Initial Mode will be the Editor. } else if ( strcmp(argv[argx], "--new") == 0 || strcmp(argv[argx], "-n") == 0 ) { createNewLevel = true; } else { die("Unrecognized option: " + std::string(argv[argx])); } } if (initialState == EDIT && isLevelNotSet && !createNewLevel) { die("You must provide a level number to edit or specify -n."); } }
void myre_show_help() { showVersion(); gtk_text_buffer_set_text(text2, HELPMSG, -1); gtk_widget_show(hboxmain); gtk_widget_show(textview2); gtk_widget_show(button2); my_text_buffer_highlight(text2, "Mark : Site", 1); my_text_buffer_highlight(text2, "Command word", 1); my_text_buffer_highlight(text2, "Keyboard Control", 1); restore_cursor_pos_after_highlight(); gtk_widget_grab_focus(textview2); }
void mainbase::parseArgs(std::vector<std::string> args) { for (uint nArg = 0; nArg < args.size(); nArg++) { if (args[nArg] == "--help" || args[nArg] == "-h") { showHelp(); exit(EXIT_SUCCESS); } else if (args[nArg] == "--version" || args[nArg] == "-v") { showVersion(); exit(EXIT_SUCCESS); } else if (args[nArg] == "--foreground" || args[nArg] == "-f") { m_Foreground = true; } else if (args[nArg] == "--droproot" || args[nArg] == "-dr") { if ((++nArg) < args.size()) { if ((++nArg) < args.size()) { m_Uid = args[nArg-1]; m_Gid = args[nArg]; m_DropRoot = true; } } } else if (args[nArg] == "--config" || args[nArg] == "-c") { if ((++nArg) < args.size()) { m_IniFile = args[nArg]; } } else if (args[nArg] == "--debug" || args[nArg] == "-d") { if ((++nArg) < args.size()) { int i; std::stringstream ss(args[nArg]); ss >> i; output::instance().setDebugLevel(i); } } else if (args[nArg] == "--pid" || args[nArg] == "-p")
AppOptions::AppOptions(int argc, const char* argv[]) : m_exeName(base::get_file_name(argv[0])) , m_startUI(true) , m_startShell(false) , m_verboseEnabled(false) , m_palette(m_po.add("palette").requiresValue("<filename>").description("Use a specific palette by default")) , m_shell(m_po.add("shell").description("Start an interactive console to execute scripts")) , m_batch(m_po.add("batch").description("Do not start the UI")) , m_saveAs(m_po.add("save-as").requiresValue("<filename>").description("Save the last given document with other format")) , m_scale(m_po.add("scale").requiresValue("<factor>").description("Resize all previous opened documents")) , m_data(m_po.add("data").requiresValue("<filename.json>").description("File to store the sprite sheet metadata")) , m_sheet(m_po.add("sheet").requiresValue("<filename.png>").description("Image file to save the texture")) , m_sheetWidth(m_po.add("sheet-width").requiresValue("<pixels>").description("Sprite sheet width")) , m_sheetHeight(m_po.add("sheet-height").requiresValue("<pixels>").description("Sprite sheet height")) , m_sheetPack(m_po.add("sheet-pack").description("Use a packing algorithm to avoid waste of space\nin the texture")) , m_splitLayers(m_po.add("split-layers").description("Import each layer of the next given sprite as\na separated image in the sheet")) , m_importLayer(m_po.add("import-layer").requiresValue("<name>").description("Import just one layer of the next given sprite")) , m_verbose(m_po.add("verbose").description("Explain what is being done")) , m_help(m_po.add("help").mnemonic('?').description("Display this help and exits")) , m_version(m_po.add("version").description("Output version information and exit")) { try { m_po.parse(argc, argv); m_verboseEnabled = m_po.enabled(m_verbose); m_paletteFileName = m_po.value_of(m_palette); m_startShell = m_po.enabled(m_shell); if (m_po.enabled(m_help)) { showHelp(); m_startUI = false; } else if (m_po.enabled(m_version)) { showVersion(); m_startUI = false; } if (m_po.enabled(m_shell) || m_po.enabled(m_batch)) { m_startUI = false; } } catch (const std::runtime_error& parseError) { std::cerr << m_exeName << ": " << parseError.what() << '\n' << "Try \"" << m_exeName << " --help\" for more information.\n"; m_startUI = false; } }
int main(int argc, char *argv[]) { bool quiet = false; char const * vserver; VserverTag tag; while (1) { int c = getopt_long(argc, argv, "ql", CMDLINE_OPTIONS, 0); if (c==-1) break; switch (c) { case 'h' : showHelp(1, argv[0], 0); case 'v' : showVersion(); case 'l' : showTags(); case 'q' : quiet = true; break; default : WRITE_MSG(2, "Try '"); WRITE_STR(2, argv[0]); WRITE_MSG(2, " --help' for more information.\n"); exit(1); break; } } if (optind+2>argc) { execQuery("-", tgSYSINFO, 0, 0); WRITE_MSG(2, "\nAssumed 'SYSINFO' as no other option given; try '--help' for more information.\n"); exit(0); } vserver = argv[optind]; tag = stringToTag(argv[optind+1]); if (tag==tgNONE) { WRITE_MSG(2, "Unknown tag; use '-l' to get list of valid tags\n"); exit(1); } if (quiet) { int fd = Eopen("/dev/null", O_WRONLY, 0644); Edup2(fd, 1); Eclose(fd); } return execQuery(vserver, tag, argc-(optind+2), argv+optind+2); }
int main (int argc, char *argv[]) { int idx = 1; struct stat st; if (argc>=2) { if (strcmp(argv[1], "--help") ==0) showHelp(argv[0]); if (strcmp(argv[1], "--version")==0) showVersion(); if (strcmp(argv[1], "--") ==0) ++idx; } if (argc<idx+1) WRITE_MSG(2, "No filename specified; use '--help' for more information\n"); else if (stat(argv[idx], &st)==-1) PERROR_Q("stat", argv[idx]); else { time_t now = time(NULL); time_t since = now - st.st_mtime; int days = since / (24*60*60); int today = since % (24*60*60); int hours = today / (60*60); int minutes = (today % (60*60)) / 60; char buf[3*sizeof(time_t)*3 + 128]; size_t l = 0; if (days > 0) { l = utilvserver_fmt_ulong(buf, days); buf[l++] = ' '; #define MSG "days, " memcpy(buf+l, MSG, sizeof(MSG)-1); l += sizeof(MSG)-1; } if (hours<10) buf[l++] = '0'; l += utilvserver_fmt_ulong(buf+l, hours); buf[l++] = ':'; if (minutes<10) buf[l++] = '0'; l += utilvserver_fmt_ulong(buf+l, minutes); buf[l++] = '\n'; Vwrite(1, buf, l); return EXIT_SUCCESS; } return EXIT_FAILURE; }
/*@maynotreturn@*/ inline static void showHelp(/*@in@*//*@nullterminated@*/char const *cmd) /*@*/ { char const msg[] = (" [-v] [-h] [-c <filename>] [-d]\n\n" " -v show version\n" " -h show help\n" " -c <filename> read configuration from <filename>\n" " -n do not fork separate process\n" " -d debug-mode; same as '-n'\n\n" "Report bugs to Enrico Scholz <" PACKAGE_BUGREPORT ">\n"); showVersion(); (void)write(1, "\nusage: ", 8 ); (void)write(1, cmd, strlen(cmd)); (void)write(1, msg, strlen(msg)); }
int main(int argc, char *argv[]) { /* arguments */ unit_t unit; unit = a; /* default ist 'auto' */ int argi; for (argi = 1; argi < argc; ++argi) { if (argv[argi][0] == '-') { if (strcmp(argv[argi], "-h") == 0 || strcmp(argv[argi], "--help") == 0) { showHelp(); return EXIT_SUCCESS; } else if (strcmp(argv[argi], "-v") == 0 || strcmp(argv[argi], "--version") == 0) { showVersion(); return EXIT_SUCCESS; } else if (strcmp(argv[argi], "-a") == 0) unit = a; else if (strcmp(argv[argi], "-b") == 0) unit = b; else if (strcmp(argv[argi], "-k") == 0) unit = k; else if (strcmp(argv[argi], "-m") == 0) unit = m; else if (strcmp(argv[argi], "-g") == 0) unit = g; else if (strcmp(argv[argi], "-t") == 0) unit = t; else if (strcmp(argv[argi], "-p") == 0) unit = p; else if (strcmp(argv[argi], "-e") == 0) unit = e; else if (strcmp(argv[argi], "-z") == 0) unit = z; else if (strcmp(argv[argi], "-y") == 0) unit = y; else { showHelp(); message_error("invalid argument"); } } } showMem(unit); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int idx = 1; if (argc>=2) { if (strcmp(argv[1], "--help") ==0) showHelp(1, argv[0], 0); if (strcmp(argv[1], "--version")==0) showVersion(); if (strcmp(argv[1], "--") ==0) ++idx; } if (argc<idx+1) { WRITE_MSG(2, "Not enough parameters; use '--help' for more information\n"); return wrapper_exit_code; } signal(SIGCHLD, SIG_DFL); Eexecv(argv[idx], argv+idx); }
int TheApp::run(int argc, tchar* argv[], tistream& /*in*/, tostream& out, tostream& /*err*/) { m_parser.parse(argc, argv, Core::CmdLineParser::ALLOW_UNIX_FORMAT); // Request for help? if (m_parser.isSwitchSet(USAGE)) { showUsage(out); return EXIT_SUCCESS; } // Request for version? else if (m_parser.isSwitchSet(VERSION)) { showVersion(out); return EXIT_SUCCESS; } return EXIT_SUCCESS; }
void MainWindow::createUi() { this->setWindowIcon(QIcon(":/main/app.png")); this->ui->actionQuit->setIcon(QIcon(":/toolbar/application_exit.png")); this->ActionNew = new QAction(QIcon(":/toolbar/filenew.png"), tr("New"), this); this->ActionSave = new QAction(QIcon(":/toolbar/document_save.png"), tr("New"), this); this->ActionPrint = new QAction(QIcon(":/toolbar/printer.png"), tr("Print"), this); this->ActionSearch = new QAction(QIcon(":/toolbar/edit_find.png"), tr("Search"), this); this->ActionShowAll = new QAction(QIcon(":/toolbar/edit_clear_list.png"), tr("Search"), this); this->ActionBarcodeScanner = new QAction(QIcon(":/toolbar/barcode.png"), tr("Scan from Barcode"), this); this->ActionBarcodeScanner->setCheckable(true); this->ToolBar = new QToolBar(this); this->ToolBar->addAction(this->ActionNew); this->ToolBar->addAction(this->ActionSave); this->ToolBar->addAction(this->ActionPrint); this->ToolBar->addSeparator(); this->ToolBar->addAction(this->ActionSearch); this->ToolBar->addAction(this->ActionShowAll); this->ToolBar->addAction(this->ActionBarcodeScanner); this->ToolBar->setWindowTitle(tr("Main ToolBar")); this->addToolBar(ToolBar); this->OverView = new overview(this); newBook(); this->setDockNestingEnabled(true); this->addDockWidget(Qt::LeftDockWidgetArea,(QDockWidget*)this->OverView); this->ui->scrollArea->setWidgetResizable(true); connect(this->ui->actionAbout_2,SIGNAL(triggered()), this,SLOT(showVersion())); connect(this->ui->actionAbout_Qt_2,SIGNAL(triggered()), this,SLOT(showQt())); connect(this->ActionNew,SIGNAL(triggered()), this,SLOT(newBook())); connect(this->ActionBarcodeScanner,SIGNAL(triggered(bool)), this,SLOT(toggleScanner(bool))); }
inline static void parseCommandline(int argc, char *argv[], /*@out@*/struct ConfigInfo * cfg) { assert(cfg!=0); while (true) { int c = getopt(argc, argv, "vhdnc:"); if (c==-1) break; switch (c) { case 'v' : showVersion(); exit(0); case 'h' : showHelp(argv[0]); exit(0); case 'd' : case 'n' : cfg->do_fork = false; break; case 'c' : cfg->conffile_name = optarg; break; default : scEXITFATAL("Use '-h' to get help about possible options"); } } if (argv[optind]!=0) scEXITFATAL("No extra-args allowed; use '-h' to get help."); }
int main(int argc, char *argv[]) { char const * socket_name = 0; struct timeval timeout = { 0,0 }; struct timeval *timeout_ptr = 0; char const * quit_msg = false; while (1) { int c = getopt_long(argc, argv, "+", CMDLINE_OPTIONS, 0); if (c==-1) break; switch (c) { case CMD_HELP : showHelp(1, argv[0], 0); case CMD_VERSION : showVersion(); case CMD_SOCKET : socket_name = optarg; break; case CMD_QUIT : quit_msg = optarg; break; case CMD_TIMEOUT : timeout.tv_sec = atoi(optarg); timeout_ptr = &timeout; break; default : WRITE_MSG(2, "Try '"); WRITE_STR(2, argv[0]); WRITE_MSG(2, " --help' for more information.\n"); return 255; break; } } if (socket_name==0) WRITE_MSG(2, "reserve-context: No socketname specified\n"); if (quit_msg) return sendQuitSignal(socket_name, quit_msg); else return doit(socket_name, timeout_ptr); return EXIT_FAILURE; }
void Patcher::initMenu() { //Fichier QMenu* menuFichier = menuBar()->addMenu("&Fichier"); ///Quitter ADD_ACTION(menuFichier,actionRun,("Lancer" + Config::softname).c_str()); connect(actionRun, SIGNAL(triggered()),this, SLOT(runSoft())); actionRun->setShortcut(QKeySequence("Ctrl+Enter")); ADD_ACTION(menuFichier,actionQuitter,"&Quitter"); connect(actionQuitter, SIGNAL(triggered()),this, SLOT(quit())); actionQuitter->setShortcut(QKeySequence("Ctrl+Q")); //actionQuitter->setIcon(QIcon("quitter.png")); //Edition QMenu* menuEdition = menuBar()->addMenu("&Edition"); //actionGras->setCheckable(true); ADD_MENU(menuEdition,menuConfiguration,"&Configuration"); ADD_ACTION(menuConfiguration,actionConfigurationUrl,"Definir l'url du site"); connect(actionConfigurationUrl,SIGNAL(triggered()),this,SLOT(configSetUrl())); ADD_ACTION(menuConfiguration,actionConfigurationMaj,"Lancer une Maj"); connect(actionConfigurationMaj,SIGNAL(triggered()),this,SLOT(configMaj())); actionConfigurationMaj->setShortcut(QKeySequence("F5")); ADD_ACTION(menuConfiguration,actionConfigurationReset,"Reset"); connect(actionConfigurationReset,SIGNAL(triggered()),this,SLOT(configReset())); actionConfigurationReset->setShortcut(QKeySequence("Ctrl+L")); //Aide QMenu* menuAide = menuBar()->addMenu("&Aide"); ///Version ADD_ACTION(menuAide,actionVersion,"&Version") connect(actionVersion, SIGNAL(triggered()),this, SLOT(showVersion())); }
int main(int argc, char *argv[]) { #ifdef Q_OS_WIN // Make console output work on Windows, if running in a console. if (AttachConsole(ATTACH_PARENT_PROCESS)) { FILE *dummy = nullptr; freopen_s(&dummy, "CONOUT$", "w", stdout); freopen_s(&dummy, "CONOUT$", "w", stderr); } #endif QApplication a(argc, argv); a.setOrganizationDomain(QLatin1String("mapeditor.org")); a.setApplicationName(QLatin1String("TmxViewer")); a.setApplicationVersion(QLatin1String("1.0")); CommandLineOptions options; parseCommandLineArguments(options); if (options.showVersion) showVersion(); if (options.showHelp || (options.fileToOpen.isEmpty() && !options.showVersion)) showHelp(); if (options.showVersion || options.showHelp || options.fileToOpen.isEmpty()) return 0; TmxViewer w; if (!w.viewMap(options.fileToOpen)) return 1; w.show(); return a.exec(); }
int mainBigInt(std::ostream& o_stream, const std::vector<std::string>& i_args) { showVersion(o_stream); BigInt::assertCheck(); applicationSimpleSample(o_stream); if (!checkCommandLine(o_stream, i_args)) { return 1; } if (i_args.size() <= 1) { showHelp(o_stream, i_args); return 0; } // ---------------------- ASSERTION(i_args.size() == 4); runRossiInteractiveSample(o_stream, i_args); return 0; }