static int hwcrhk_insert_card(const char *prompt_info,
		      const char *wrong_info,
		      HWCryptoHook_PassphraseContext *ppctx,
		      HWCryptoHook_CallerContext *cactx)
        {
        int ok = -1;
        UI *ui;
	void *callback_data = NULL;
        UI_METHOD *ui_method = NULL;
        if (cactx)
                {
                if (cactx->ui_method)
                        ui_method = cactx->ui_method;
		if (cactx->callback_data)
			callback_data = cactx->callback_data;
                }
	if (ppctx)
		{
                if (ppctx->ui_method)
                        ui_method = ppctx->ui_method;
		if (ppctx->callback_data)
			callback_data = ppctx->callback_data;
		}
	if (ui_method == NULL)
		{
		HWCRHKerr(HWCRHK_F_HWCRHK_INSERT_CARD,
			HWCRHK_R_NO_CALLBACK);
		return -1;
		}
	ui = UI_new_method(ui_method);
	if (ui)
		{
		char answer;
		char buf[BUFSIZ];
		if (wrong_info)
			BIO_snprintf(buf, sizeof(buf)-1,
				"Current card: \"%s\"\n", wrong_info);
		ok = UI_dup_info_string(ui, buf);
		if (ok >= 0 && prompt_info)
			{
			BIO_snprintf(buf, sizeof(buf)-1,
				"Insert card \"%s\"", prompt_info);
			ok = UI_dup_input_boolean(ui, buf,
				"\n then hit <enter> or C<enter> to cancel\n",
				"\r\n", "Cc", UI_INPUT_FLAG_ECHO, &answer);
			}
		UI_add_user_data(ui, callback_data);
		if (ok >= 0)
			ok = UI_process(ui);
		UI_free(ui);
		if (ok == -2 || (ok >= 0 && answer == 'C'))
			ok = 1;
		else if (ok < 0)
			ok = -1;
		else
			ok = 0;
		}
	return ok;
	}
['static int hwcrhk_insert_card(const char *prompt_info,\n\t\t      const char *wrong_info,\n\t\t      HWCryptoHook_PassphraseContext *ppctx,\n\t\t      HWCryptoHook_CallerContext *cactx)\n        {\n        int ok = -1;\n        UI *ui;\n\tvoid *callback_data = NULL;\n        UI_METHOD *ui_method = NULL;\n        if (cactx)\n                {\n                if (cactx->ui_method)\n                        ui_method = cactx->ui_method;\n\t\tif (cactx->callback_data)\n\t\t\tcallback_data = cactx->callback_data;\n                }\n\tif (ppctx)\n\t\t{\n                if (ppctx->ui_method)\n                        ui_method = ppctx->ui_method;\n\t\tif (ppctx->callback_data)\n\t\t\tcallback_data = ppctx->callback_data;\n\t\t}\n\tif (ui_method == NULL)\n\t\t{\n\t\tHWCRHKerr(HWCRHK_F_HWCRHK_INSERT_CARD,\n\t\t\tHWCRHK_R_NO_CALLBACK);\n\t\treturn -1;\n\t\t}\n\tui = UI_new_method(ui_method);\n\tif (ui)\n\t\t{\n\t\tchar answer;\n\t\tchar buf[BUFSIZ];\n\t\tif (wrong_info)\n\t\t\tBIO_snprintf(buf, sizeof(buf)-1,\n\t\t\t\t"Current card: \\"%s\\"\\n", wrong_info);\n\t\tok = UI_dup_info_string(ui, buf);\n\t\tif (ok >= 0 && prompt_info)\n\t\t\t{\n\t\t\tBIO_snprintf(buf, sizeof(buf)-1,\n\t\t\t\t"Insert card \\"%s\\"", prompt_info);\n\t\t\tok = UI_dup_input_boolean(ui, buf,\n\t\t\t\t"\\n then hit <enter> or C<enter> to cancel\\n",\n\t\t\t\t"\\r\\n", "Cc", UI_INPUT_FLAG_ECHO, &answer);\n\t\t\t}\n\t\tUI_add_user_data(ui, callback_data);\n\t\tif (ok >= 0)\n\t\t\tok = UI_process(ui);\n\t\tUI_free(ui);\n\t\tif (ok == -2 || (ok >= 0 && answer == \'C\'))\n\t\t\tok = 1;\n\t\telse if (ok < 0)\n\t\t\tok = -1;\n\t\telse\n\t\t\tok = 0;\n\t\t}\n\treturn ok;\n\t}']