]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/samples/ufortune/ufortune.c
ICU-66108.tar.gz
[apple/icu.git] / icuSources / samples / ufortune / ufortune.c
index a7f01189783dc6e7f4b93bcb05e85b34154f1050..c1c203a983defd512ff7545a67cdcb3e9eea72a4 100644 (file)
@@ -1,9 +1,15 @@
-/**************************************************************************
+/*************************************************************************
 *
-*   Copyright (C) 2001, International Business Machines
+*   © 2016 and later: Unicode, Inc. and others.
+*   License & terms of use: http://www.unicode.org/copyright.html#License
+*
+**************************************************************************
+**************************************************************************
+*
+*   Copyright (C) 2001-2006, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
-***************************************************************************
+**************************************************************************
 *
 *   ufortune - An ICU resources sample program
 *
@@ -100,13 +106,13 @@ int main(int argc, char **argv)
         break;
     }
 
-    /* ICU's ustdio package provides a convenient way to write Unicode
+    /* ICU's icuio package provides a convenient way to write Unicode
      *    data to stdout.  The string data that we get from resources
-     *    will be UChar * strings, which ustdio can handle nicely.
+     *    will be UChar * strings, which icuio can handle nicely.
      */
     u_stdout = u_finit(stdout, NULL /*locale*/,  NULL /*codepage */);
     if (verbose) {
-        u_fprintf(u_stdout, "%s:  checking output via ustdio.\n", programName);
+        u_fprintf(u_stdout, "%s:  checking output via icuio.\n", programName);
     }
 
 #ifndef UFORTUNE_NOSETAPPDATA
@@ -117,7 +123,7 @@ int main(int argc, char **argv)
      */
     udata_setAppData("fortune_resources", &fortune_resources_dat, &err);
     if (U_FAILURE(err)) {
-        fprintf(stderr, "%s: ures_open failed with error \"%s\"\n", programName, u_errorName(err));
+        fprintf(stderr, "%s: udata_setAppData failed with error \"%s\"\n", programName, u_errorName(err));
         exit(-1);
     }
 #endif
@@ -183,11 +189,11 @@ int main(int argc, char **argv)
         exit(-1);
     }
     if (numFortunes <= 0) {
-        fprintf(stderr, "%s: no fortunes found.\n");
+        fprintf(stderr, "%s: no fortunes found.\n", programName);
         exit(-1);
     }
 
-    i = time(NULL) % numFortunes;    /*  Use time to pick a somewhat-random fortune.  */
+    i = (int)time(NULL) % numFortunes;    /*  Use time to pick a somewhat-random fortune.  */
     resString = ures_getStringByIndex(fortunes_r, i, &len, &err);
     if (U_FAILURE(err)) {
         fprintf(stderr, "%s: ures_getStringByIndex(%d) failed, %s\n", programName, i, u_errorName(err));