ICU-9426 Fix pkgdata option file detection

X-SVN-Rev: 32074
This commit is contained in:
Michael Ow 2012-07-27 18:38:08 +00:00
parent f1b69ac0a5
commit d134b120de

View File

@ -1965,29 +1965,21 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
p = popen(cmdBuf, "r");
}
if(p == NULL) {
if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) {
if(verbose) {
fprintf(stdout, "# Calling icu-config: %s\n", cmd);
}
p = popen(cmd, "r");
}
pclose(p);
if(p == NULL)
{
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return -1;
p = popen(cmd, "r");
if(p == NULL || (n = fread(buf, 1, 511, p)) <= 0) {
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return -1;
}
}
n = fread(buf, 1, 511, p);
pclose(p);
if(n<=0)
{
fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
return -1;
}
for (int32_t length = strlen(buf) - 1; length >= 0; length--) {
if (buf[length] == '\n' || buf[length] == ' ') {
buf[length] = 0;