-int UI_dup_input_string(UI *ui, const char *prompt, int echo_p,
- char *result_buf, int minsize, int maxsize)
- {
- char *prompt_copy=NULL;
-
- if (prompt)
- {
- prompt_copy=strdup(prompt);
- if (prompt_copy == NULL)
- {
- UIerr(UI_F_UI_DUP_INPUT_STRING,ERR_R_MALLOC_FAILURE);
- return 0;
- }
- }
-
- return general_allocate_string(ui, prompt, 1,
- echo_p?UI_STRING_ECHO:UI_STRING_NOECHO,
- result_buf, minsize, maxsize, NULL);
- }
-
-int UI_add_verify_string(UI *ui, const char *prompt, int echo_p,
- char *result_buf, int minsize, int maxsize, const char *test_buf)
- {
- return general_allocate_string(ui, prompt, 0,
- echo_p?UI_VERIFY_ECHO:UI_VERIFY_NOECHO,
- result_buf, minsize, maxsize, test_buf);
- }
-
-int UI_dup_verify_string(UI *ui, const char *prompt, int echo_p,
- char *result_buf, int minsize, int maxsize, const char *test_buf)
- {
- char *prompt_copy=NULL;
-
- if (prompt)
- {
- prompt_copy=strdup(prompt);
- if (prompt_copy == NULL)
- {
- UIerr(UI_F_UI_DUP_VERIFY_STRING,ERR_R_MALLOC_FAILURE);
- return -1;
- }
- }
-
- return general_allocate_string(ui, prompt, 1,
- echo_p?UI_VERIFY_ECHO:UI_VERIFY_NOECHO,
- result_buf, minsize, maxsize, test_buf);
- }
+int UI_dup_input_string(UI *ui, const char *prompt, int flags,
+ char *result_buf, int minsize, int maxsize)
+{
+ char *prompt_copy = NULL;
+
+ if (prompt != NULL) {
+ prompt_copy = OPENSSL_strdup(prompt);
+ if (prompt_copy == NULL) {
+ UIerr(UI_F_UI_DUP_INPUT_STRING, ERR_R_MALLOC_FAILURE);
+ return 0;
+ }
+ }
+
+ return general_allocate_string(ui, prompt_copy, 1,
+ UIT_PROMPT, flags, result_buf, minsize,
+ maxsize, NULL);
+}
+
+int UI_add_verify_string(UI *ui, const char *prompt, int flags,
+ char *result_buf, int minsize, int maxsize,
+ const char *test_buf)
+{
+ return general_allocate_string(ui, prompt, 0,
+ UIT_VERIFY, flags, result_buf, minsize,
+ maxsize, test_buf);
+}
+
+int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
+ char *result_buf, int minsize, int maxsize,
+ const char *test_buf)
+{
+ char *prompt_copy = NULL;
+
+ if (prompt != NULL) {
+ prompt_copy = OPENSSL_strdup(prompt);
+ if (prompt_copy == NULL) {
+ UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
+ return -1;
+ }
+ }
+
+ return general_allocate_string(ui, prompt_copy, 1,
+ UIT_VERIFY, flags, result_buf, minsize,
+ maxsize, test_buf);
+}
+
+int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
+ const char *ok_chars, const char *cancel_chars,
+ int flags, char *result_buf)
+{
+ return general_allocate_boolean(ui, prompt, action_desc,
+ ok_chars, cancel_chars, 0, UIT_BOOLEAN,
+ flags, result_buf);
+}
+
+int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
+ const char *ok_chars, const char *cancel_chars,
+ int flags, char *result_buf)
+{
+ char *prompt_copy = NULL;
+ char *action_desc_copy = NULL;
+ char *ok_chars_copy = NULL;
+ char *cancel_chars_copy = NULL;
+
+ if (prompt != NULL) {
+ prompt_copy = OPENSSL_strdup(prompt);
+ if (prompt_copy == NULL) {
+ UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+
+ if (action_desc != NULL) {
+ action_desc_copy = OPENSSL_strdup(action_desc);
+ if (action_desc_copy == NULL) {
+ UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+
+ if (ok_chars != NULL) {
+ ok_chars_copy = OPENSSL_strdup(ok_chars);
+ if (ok_chars_copy == NULL) {
+ UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+
+ if (cancel_chars != NULL) {
+ cancel_chars_copy = OPENSSL_strdup(cancel_chars);
+ if (cancel_chars_copy == NULL) {
+ UIerr(UI_F_UI_DUP_INPUT_BOOLEAN, ERR_R_MALLOC_FAILURE);
+ goto err;
+ }
+ }
+
+ return general_allocate_boolean(ui, prompt_copy, action_desc_copy,
+ ok_chars_copy, cancel_chars_copy, 1,
+ UIT_BOOLEAN, flags, result_buf);
+ err:
+ OPENSSL_free(prompt_copy);
+ OPENSSL_free(action_desc_copy);
+ OPENSSL_free(ok_chars_copy);
+ OPENSSL_free(cancel_chars_copy);
+ return -1;
+}