ICU-1104 display an error if the encoding passed to --list-code results

in a null first alias (err is not set)

X-SVN-Rev: 7387
This commit is contained in:
Yves Arrouye 2002-01-05 01:20:45 +00:00
parent ef243d3b7d
commit cccb02263f
2 changed files with 4 additions and 2 deletions

View file

@ -450,7 +450,7 @@ int main(int argc, char** argv)
if (iter!=end) {
UErrorCode e = U_ZERO_ERROR;
printName = ucnv_getAlias(*iter, 0, &e);
if (U_FAILURE(e)) {
if (U_FAILURE(e) || !printName) {
UnicodeString str(*iter);
initMsg(pname);
u_wmsg("noSuchCodeset", str.getBuffer());

View file

@ -80,6 +80,7 @@ finish:
ucnv_close(converter);
}
static const char *gPath = 0;
static UResourceBundle *gBundle = NULL;
U_CAPI UResourceBundle *u_wmsg_setPath(const char *path, UErrorCode *err)
@ -99,6 +100,7 @@ U_CAPI UResourceBundle *u_wmsg_setPath(const char *path, UErrorCode *err)
UResourceBundle *b = NULL;
b = ures_open(path, NULL, err);
gPath = uprv_strdup(path);
gBundle = b;
}
@ -125,7 +127,7 @@ U_CAPI void u_wmsg(const char *tag, ... )
if(U_FAILURE(err))
{
fprintf(stderr, "u_wmsg: failed to load tag [%s] [%s]!!\n", tag, u_errorName(err));
fprintf(stderr, "u_wmsg: failed to load tag [%s] [%s] [%s]!!\n", tag, u_errorName(err), gPath);
return;
}