iconv_t cd = iconv_open(tocode, fromcode);
free(tocode);
if (cd == (iconv_t)(-1)) {
- switch (errno) {
- case EINVAL:
- printf("no\n");
- return UNSUPPORTED;
- default:
- printf("FAIL (errno=%d, unexpected error)\n", errno);
- return FAILURE;
+ if (errno == EINVAL) {
+ printf("OK (no)\n");
+ return UNSUPPORTED;
+ }
+ else {
+ printf("FAIL (%s)\n", ERRNO_STR(errno));
+ return FAILURE;
}
}
- printf("yes\n");
+ printf("OK (yes)\n");
iconv_close(cd);
return SUCCESS;
}
printf("FAIL (outbuf=%s)\n", outbuf);
return FAILURE;
}
- printf("OK (no error)\n");
+ printf("OK\n");
return SUCCESS;
}