ICU-66108.tar.gz
[apple/icu.git] / icuSources / tools / genbrk / genbrk.cpp
index 72c6cffe7b5296de8678efae04b47597408f6a07..38df3ee969cd15e72d59878e6f15a6d609e4ee36 100644 (file)
@@ -1,6 +1,8 @@
+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /*
 **********************************************************************
-*   Copyright (C) 2002-2009, International Business Machines
+*   Copyright (C) 2002-2016, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *
@@ -56,6 +58,7 @@ static UOption options[]={
     UOPTION_ICUDATADIR,         /* 5 */
     UOPTION_DESTDIR,            /* 6 */
     UOPTION_COPYRIGHT,          /* 7 */
+    UOPTION_QUIET,              /* 8 */
 };
 
 void usageAndDie(int retCode) {
@@ -66,6 +69,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",
@@ -136,7 +140,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]);
@@ -258,7 +262,7 @@ int  main(int argc, char **argv) {
     if (status != U_BUFFER_OVERFLOW_ERROR) {
         fprintf(stderr, "ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status));
         exit(status);
-    };
+    }
 
     status = U_ZERO_ERROR;
     UChar *ruleSourceU = new UChar[destCap+1];
@@ -271,7 +275,7 @@ int  main(int argc, char **argv) {
     if (U_FAILURE(status)) {
         fprintf(stderr, "ucnv_toUChars: ICU Error \"%s\"\n", u_errorName(status));
         exit(status);
-    };
+    }
     ucnv_close(conv);
 
 
@@ -292,7 +296,7 @@ int  main(int argc, char **argv) {
         fprintf(stderr, "createRuleBasedBreakIterator: ICU Error \"%s\"  at line %d, column %d\n",
                 u_errorName(status), (int)parseError.line, (int)parseError.offset);
         exit(status);
-    };
+    }
 
 
     //
@@ -338,7 +342,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 */