-/**************************************************************************
+/*************************************************************************
*
-* 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
*
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
*/
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
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));