/*
*******************************************************************************
*
-* Copyright (C) 1999-2003, International Business Machines
+* Copyright (C) 1999-2007, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* TODO: make a complete i18n layout for this program.
******************************************************************************/
+#include "unicode/putil.h"
#include "unicode/ures.h"
#include "unicode/ustdio.h"
#include "unicode/uloc.h"
static UChar *quotedString(const UChar *string);
void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErrorCode *status);
void printIndent(UFILE *out, int32_t indent);
-void printHex(UFILE *out, const uint8_t *what);
+void printHex(UFILE *out, const int8_t *what);
static UOption options[]={
UOPTION_HELP_H,
"error in command line argument \"%s\"\n",
argv[-argc]);
}
- if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
+ if(argc<2 || options[0].doesOccur || options[1].doesOccur) {
fprintf(stderr,
- "usage: %s [-options]\n",
+ "usage: %s [-options] locale(s)\n",
argv[0]);
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}
}
} else {
strcpy(resPathBuffer, currdir);
- strcat(resPathBuffer, U_FILE_SEP_STRING);
- strcat(resPathBuffer, "uresb");
+ /*strcat(resPathBuffer, U_FILE_SEP_STRING);
+ strcat(resPathBuffer, "uresb");*/
resPath = resPathBuffer; /* we'll just dump uresb samples resources */
}
}
if(options[6].doesOccur) {
- VERBOSE = TRUE;
+ VERBOSE = TRUE;
}
outerr = u_finit(stderr, locale, encoding);
status = U_ZERO_ERROR;
arg = getLongPathname(argv[i]);
- printf("uresb: processing file \"%s\" in path \"%s\"\n", arg, resPath);
+ u_fprintf(out, "uresb: processing file \"%s\" in path \"%s\"\n", arg, resPath);
bundle = ures_open(resPath, arg, &status);
if(U_SUCCESS(status)) {
u_fprintf(out, "%s\n", arg);
u_fprintf(out, "%s", inchar);
}
-void printHex(UFILE *out, const uint8_t *what) {
- u_fprintf(out, "%02X", *what);
+void printHex(UFILE *out, const int8_t *what) {
+ u_fprintf(out, "%02X", (uint8_t)*what);
}
static UChar *quotedString(const UChar *string) {
}
void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent, UErrorCode *status) {
- int32_t noOfElements = ures_getSize(resource);
int32_t i = 0;
const char *key = ures_getKey(resource);
*/
printIndent(out, indent);
if(key != NULL) {
- u_fprintf(out, "%s { \"%U\" } ", key, string);
+ u_fprintf(out, "%s { \"%S\" } ", key, string);
} else {
- u_fprintf(out, "\"%U\",", string);
+ u_fprintf(out, "\"%S\",", string);
}
if(VERBOSE) {
u_fprintf(out, " // STRING");
}
void reportError(UErrorCode *status) {
- u_fprintf(outerr, "Error %d : %U happened!\n", *status, getErrorName(*status));
+ u_fprintf(outerr, "Error %d(%s) : %U happened!\n", *status, u_errorName(*status), getErrorName(*status));
}