本文整理汇总了C++中showVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ showVersion函数的具体用法?C++ showVersion怎么用?C++ showVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了showVersion函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
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;
}
开发者ID:Sensasion,项目名称:imguru,代码行数:35,代码来源:main.cpp
示例2: main
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);
}
开发者ID:AlexanderS,项目名称:util-vserver,代码行数:33,代码来源:secure-umount.c
示例3: showHelp
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);
}
开发者ID:qyqx,项目名称:moc-ng,代码行数:30,代码来源:main.cpp
示例4: main
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);
}
开发者ID:jcambray,项目名称:ProjetWarCPP,代码行数:35,代码来源:main.cpp
示例5: showVersion
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";
}
开发者ID:samstarling,项目名称:audiowaveform,代码行数:26,代码来源:Options.cpp
示例6: usage
/* 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"
);
}
}
开发者ID:AnLingm,项目名称:gpdb,代码行数:31,代码来源:main.c
示例7: main
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();
}
开发者ID:zorbathut,项目名称:mild,代码行数:32,代码来源:main.cpp
示例8: main
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);
}
开发者ID:chargen,项目名称:robotvisionexp,代码行数:58,代码来源:mkupdate.c
示例9: parse_args
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;
}
}
开发者ID:Orea1234,项目名称:mysecureshell,代码行数:45,代码来源:main.c
示例10: m_exeName
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;
}
}
开发者ID:riggtravis,项目名称:aseprite,代码行数:57,代码来源:app_options.cpp
示例11: main
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();
}
开发者ID:uazure,项目名称:qlabnetview,代码行数:57,代码来源:main.cpp
示例12: main
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
开发者ID:Lencons,项目名称:pikeyd,代码行数:55,代码来源:pikeyd.c
示例13: main
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();
}
开发者ID:Kayven,项目名称:qcontent,代码行数:54,代码来源:main.cpp
示例14: m_impl
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);
}
开发者ID:awein,项目名称:zfs,代码行数:11,代码来源:IDCLI.cpp
示例15: myre_show_help
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);
}
开发者ID:vobiscum,项目名称:myre,代码行数:14,代码来源:myre.c
示例16: showHelp
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")
开发者ID:bjweerd,项目名称:gframe,代码行数:48,代码来源:mainbase.cpp
示例17: m_exeName
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;
}
}
开发者ID:BlueHeisenberg,项目名称:aseprite,代码行数:47,代码来源:app_options.cpp
示例18: main
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);
}
开发者ID:AlexanderS,项目名称:util-vserver,代码行数:46,代码来源:vserver-info.c
示例19: main
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;
}
开发者ID:AlexanderS,项目名称:util-vserver,代码行数:45,代码来源:filetime.c
示例20: showHelp
/*@[email protected]*/
inline static void
showHelp(/*@[email protected]*//*@[email protected]*/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));
}
开发者ID:zipangotes,项目名称:DSL-G624T_GPL_code,代码行数:19,代码来源:cfg.c
注:本文中的showVersion函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论