UI_STRING(3ossl)
β¨ NAME β¨
okay so this page is UI_STRING(3ossl) β the whole user interface string parsing situation β and it covers the entire squad: UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags, UI_get0_output_string, UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, UI_get0_test_string, UI_get_result_minsize, UI_get_result_maxsize, UI_set_result, UI_set_result_ex. literally all of them bestie π
π¦ SYNOPSIS π¦
#include <openssl/ui.h>
typedef struct ui_string_st UI_STRING;
enum UI_string_types {
UIT_NONE = 0,
UIT_PROMPT, /* Prompt for a string */
UIT_VERIFY, /* Prompt for a string and verify */
UIT_BOOLEAN, /* Prompt for a yes/no response */
UIT_INFO, /* Send info to the user */
UIT_ERROR /* Send an error message to the user */
};
enum UI_string_types UI_get_string_type(UI_STRING *uis);
int UI_get_input_flags(UI_STRING *uis);
const char *UI_get0_output_string(UI_STRING *uis);
const char *UI_get0_action_string(UI_STRING *uis);
const char *UI_get0_result_string(UI_STRING *uis);
int UI_get_result_string_length(UI_STRING *uis);
const char *UI_get0_test_string(UI_STRING *uis);
int UI_get_result_minsize(UI_STRING *uis);
int UI_get_result_maxsize(UI_STRING *uis);
int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
πΈ DESCRIPTION πΈ
so the UI_STRING gets created internally and added to a UI whenever one of these icons gets called:
UI_add_input_string()UI_dup_input_string()UI_add_verify_string()UI_dup_verify_string()UI_add_input_boolean()UI_dup_input_boolean()UI_add_info_string()UI_dup_info_string()UI_add_error_string()UI_dup_error_string()
if you're a UI_METHOD user, honestly that's all you need to know, you're done, go touch grass π«Ά
but if you're a UI_METHOD creator? oh you're so main character. you get to fetch text from these UI_STRING objects and add results to some of them. iykyk.
π the getters (aka the vibe check squad)
UI_get_string_type() retrieves the type of the given UI_STRING. yes bestie, the actual type.
UI_get_input_flags() retrieves the flags associated with the given UI_STRING.
UI_get0_output_string() retrieves the actual string to output β prompt, info, error, whatever the moment calls for.
UI_get0_action_string() retrieves the action description associated with a UIT_BOOLEAN type UI_STRING. for literally every other UI_STRING type it returns NULL. see UI_add_input_boolean(3) for the lore.
UI_get0_result_string() and UI_get_result_string_length() retrieve the result of a prompt and its length. this is only useful for UIT_PROMPT and UIT_VERIFY type strings. for all other UI_STRING types, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1. not me crying at the -1 π
UI_get0_test_string() retrieves the string to compare the prompt result with. only useful for UIT_VERIFY type strings, and for all other UI_STRING types, NULL is returned.
UI_get_result_minsize() and UI_get_result_maxsize() retrieve the minimum and maximum required size of the result. only useful for UIT_PROMPT and UIT_VERIFY type strings β for all other UI_STRING types, -1 is returned.
π setting results, the moment of truth
UI_set_result_ex() sets the result value of a prompt and its length. let's break it down, slay by slay:
- for
UIT_PROMPTandUIT_VERIFYtype UI strings, this sets the result retrievable withUI_get0_result_string()by copying the contents ofresultif its length fits the minimum and maximum size requirements. - for
UIT_BOOLEANtype UI strings, this sets the first character of the result retrievable withUI_get0_result_string()to the firstok_chargiven withUI_add_input_boolean()orUI_dup_input_boolean()if the result matched any of them, or the first of thecancel_charsif the result matched any of them β otherwise it's set to theNULchar"\0". - see
UI_add_input_boolean(3)for more info onok_charsandcancel_chars.
UI_set_result() does the same thing as UI_set_result_ex(), but it calculates its length internally. it expects the string to be terminated with a NUL byte, and is therefore only useful with normal C strings. periodt.
π RETURN VALUES π
UI_get_string_type()β returns the UI string type.UI_get_input_flags()β returns the UI string flags.UI_get0_output_string()β returns the UI string output string.UI_get0_action_string()β returns the UI string action description string forUIT_BOOLEANtype UI strings,NULLfor any other type.UI_get0_result_string()β returns the UI string result buffer forUIT_PROMPTandUIT_VERIFYtype UI strings,NULLfor any other type.UI_get_result_string_length()β returns the UI string result buffer's content length forUIT_PROMPTandUIT_VERIFYtype UI strings,-1for any other type.UI_get0_test_string()β returns the UI string action description string forUIT_VERIFYtype UI strings,NULLfor any other type.UI_get_result_minsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type.UI_get_result_maxsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type. (fr fr, that's what the page says β "minimum". i'm just the messenger π)UI_set_result()β returns0on success or when the UI string is of any type other thanUIT_PROMPT,UIT_VERIFYorUIT_BOOLEAN, and-1on error.
π₯ SEE ALSO π₯
UI(3)β go read it, bestie, it's giving essential context π
π COPYRIGHT π
Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π this one's version 3.5.6, dated 2026-04-07, and it's UI_STRING(3ossl) signing off β mwah πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms