X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..f59164e3d128c7675a4d3934206346a3384e53a5:/icuSources/tools/gencfu/gencfu.cpp diff --git a/icuSources/tools/gencfu/gencfu.cpp b/icuSources/tools/gencfu/gencfu.cpp index b50d6cbb..74d89d9b 100644 --- a/icuSources/tools/gencfu/gencfu.cpp +++ b/icuSources/tools/gencfu/gencfu.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2009-2010, International Business Machines +* Copyright (C) 2009-2016, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * @@ -56,6 +56,7 @@ static UOption options[]={ UOPTION_ICUDATADIR, /* 6 */ UOPTION_DESTDIR, /* 7 */ UOPTION_COPYRIGHT, /* 8 */ + UOPTION_QUIET, /* 9 */ }; void usageAndDie(int retCode) { @@ -66,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", @@ -140,7 +142,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]); @@ -174,6 +176,11 @@ int main(int argc, char **argv) { copyright = U_COPYRIGHT_STRING; } + UBool quiet = FALSE; + if (options[9].doesOccur) { + quiet = TRUE; + } + #if UCONFIG_NO_REGULAR_EXPRESSIONS || UCONFIG_NO_NORMALIZATION || UCONFIG_NO_FILE_IO // spoof detection data file parsing is dependent on regular expressions. // TODO: have the tool return an error status. Requires fixing the ICU data build @@ -287,10 +294,12 @@ int main(int argc, char **argv) { uspoof_close(sc); delete [] outData; - delete confusables; - delete wsConfsables; + delete [] confusables; + delete [] wsConfsables; u_cleanup(); - printf("gencfu: tool completed successfully.\n"); + if (!quiet) { + printf("gencfu: tool completed successfully.\n"); + } return 0; #endif // UCONFIG_NO_REGULAR_EXPRESSIONS } @@ -313,7 +322,8 @@ int main(int argc, char **argv) { fseek(file, 0, SEEK_SET); result = new char[fileSize+10]; if (result==NULL) { - return result; + fclose(file); + return NULL; } long t = fread(result, 1, fileSize, file);