X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/73c04bcfe1096173b00431f0cdc742894b15eef0..f59164e3d128c7675a4d3934206346a3384e53a5:/icuSources/tools/genbrk/genbrk.cpp diff --git a/icuSources/tools/genbrk/genbrk.cpp b/icuSources/tools/genbrk/genbrk.cpp index c6ca76e2..290b2e7d 100644 --- a/icuSources/tools/genbrk/genbrk.cpp +++ b/icuSources/tools/genbrk/genbrk.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2002-2006, International Business Machines +* Copyright (C) 2002-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -44,6 +44,8 @@ #include #include +U_NAMESPACE_USE + static char *progName; static UOption options[]={ UOPTION_HELP_H, /* 0 */ @@ -54,6 +56,7 @@ static UOption options[]={ UOPTION_ICUDATADIR, /* 5 */ UOPTION_DESTDIR, /* 6 */ UOPTION_COPYRIGHT, /* 7 */ + UOPTION_QUIET, /* 8 */ }; void usageAndDie(int retCode) { @@ -64,6 +67,7 @@ void usageAndDie(int retCode) { "\t-V or --version show a version message\n" "\t-c or --copyright include a copyright notice\n" "\t-v or --verbose turn on verbose output\n" + "\t-q or --quiet do not display warnings and progress\n" "\t-i or --icudatadir directory for locating any needed intermediate data files,\n" "\t followed by path, defaults to %s\n" "\t-d or --destdir destination directory, followed by the path\n", @@ -72,7 +76,7 @@ void usageAndDie(int retCode) { } -#if UCONFIG_NO_BREAK_ITERATION +#if UCONFIG_NO_BREAK_ITERATION || UCONFIG_NO_FILE_IO /* dummy UDataInfo cf. udata.h */ static UDataInfo dummyDataInfo = { @@ -134,7 +138,7 @@ int main(int argc, char **argv) { // U_MAIN_INIT_ARGS(argc, argv); progName = argv[0]; - argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); + argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options); if(argc<0) { // Unrecognized option fprintf(stderr, "error in command line argument \"%s\"\n", argv[-argc]); @@ -157,13 +161,6 @@ int main(int argc, char **argv) { u_setDataDirectory(options[5].value); } - /* Initialize ICU */ - u_init(&status); - if (U_FAILURE(status)) { - fprintf(stderr, "%s: can not initialize ICU. status = %s\n", - argv[0], u_errorName(status)); - exit(1); - } status = U_ZERO_ERROR; /* Combine the directory with the file name */ @@ -174,13 +171,13 @@ int main(int argc, char **argv) { copyright = U_COPYRIGHT_STRING; } -#if UCONFIG_NO_BREAK_ITERATION +#if UCONFIG_NO_BREAK_ITERATION || UCONFIG_NO_FILE_IO UNewDataMemory *pData; char msg[1024]; /* write message with just the name */ - sprintf(msg, "genbrk writes dummy %s because of UCONFIG_NO_BREAK_ITERATION, see uconfig.h", outFileName); + sprintf(msg, "genbrk writes dummy %s because of UCONFIG_NO_BREAK_ITERATION and/or UCONFIG_NO_FILE_IO, see uconfig.h", outFileName); fprintf(stderr, "%s\n", msg); /* write the dummy data file */ @@ -190,6 +187,14 @@ int main(int argc, char **argv) { return (int)status; #else + /* Initialize ICU */ + u_init(&status); + if (U_FAILURE(status)) { + fprintf(stderr, "%s: can not initialize ICU. status = %s\n", + argv[0], u_errorName(status)); + exit(1); + } + status = U_ZERO_ERROR; // // Read in the rule source file @@ -335,7 +340,9 @@ int main(int argc, char **argv) { u_cleanup(); - printf("genbrk: tool completed successfully.\n"); + if(!options[8].doesOccur) { + printf("genbrk: tool completed successfully.\n"); + } return 0; #endif /* #if !UCONFIG_NO_BREAK_ITERATION */