示例#1
0
idn_result_t
idn_decodename2(idn_action_t actions, const char *from, char *to, size_t tolen,
		const char *auxencoding) {
	idn_result_t r;

	assert(from != NULL && to != NULL);

	TRACE(("idn_decodename2(actions=%s, from=\"%s\", tolen=%d)\n",
	       idn__res_actionstostring(actions),
	       idn__debug_xstring(from, 50), (int)tolen));

	if (!initialized && ((r = idn_nameinit(0)) != idn_success))
		goto ret;

	r = idn_res_decodename2(default_conf, actions, from, to, tolen,
				auxencoding);

ret:
	if (r == idn_success) {
		TRACE(("idn_decodename2(): success (to=\"%s\")\n",
		       idn__debug_xstring(to, 50)));
	} else {
		TRACE(("idn_decodename2(): %s\n", idn_result_tostring(r)));
	}
	return (r);
}
示例#2
0
void
sjis_check(void)
{
	idn_result_t r;
	idn_converter_t sjis_ctx = NULL;

	r = idn_nameinit(0);
	if (r != idn_success) {
		fprintf(stderr, "idn_nameinit(): failed\n");
		exit (1);
	}

	r = idn_converter_create(SJIS_ENCODING_NAME, &sjis_ctx, 0);

	if (sjis_ctx != NULL) {
		idn_converter_destroy(sjis_ctx);
	}

	if (r != idn_success) {
		if (r == idn_invalid_name) {
			fprintf(stderr, \
				"\"%s\" is invalid codeset name, edit codeset.h\n", \
				SJIS_ENCODING_NAME);
			exit (1);
		} else {
			fprintf(stderr, \
				"idn_converter_create() failed with error \"%s\"\n", \
				idn_result_tostring(r));
			exit (1);
		}
	}
}
示例#3
0
idn_result_t
mdn_decodename(int actions, const char *from, char *to, size_t tolen) {
	idn_result_t r;

	assert(from != NULL && to != NULL);

	TRACE(("idn_decodename(actions=%s, from=\"%s\", tolen=%d)\n",
	       idn__res_actionstostring(actions),
	       idn__debug_xstring(from, 50), (int)tolen));

	if (!initialized && ((r = idn_nameinit(1)) != idn_success))
		return (r);

	return (idn_res_decodename(default_conf, actions, from, to, tolen));
}
示例#4
0
idn_result_t
mdn_nameinit(void) {
	return idn_nameinit(1);
}