HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/share/gtk-doc/html/libuser/libuser-prompt.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>prompt: libuser Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="libuser Reference Manual">
<link rel="up" href="ch01.html" title="libuser">
<link rel="prev" href="libuser-error.html" title="error">
<link rel="next" href="libuser-user.html" title="user">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#libuser-prompt.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libuser-error.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libuser-user.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libuser-prompt"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libuser-prompt.top_of_page"></a>prompt</span></h2>
<p>prompt — Sample prompter functions for use with the libuser
library.</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libuser-prompt.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-prompt.html#lu-prompt-console" title="lu_prompt_console ()">lu_prompt_console</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="libuser-prompt.html#lu-prompt-console-quiet" title="lu_prompt_console_quiet ()">lu_prompt_console_quiet</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libuser-prompt.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="libuser-prompt.html#lu-prompt" title="struct lu_prompt">lu_prompt</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libuser-prompt.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;libuser/prompt.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="libuser-prompt.description"></a><h2>Description</h2>
<p>prompt.h declares two predefined prompter functions which applications can
use instead of providing their own.  These should suffice for most
command-line applications.  Authors of graphical applications are encouraged
to supply graphical implementations.</p>
</div>
<div class="refsect1">
<a name="libuser-prompt.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="lu-prompt-console"></a><h3>lu_prompt_console ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_prompt_console (<em class="parameter"><code><span class="type">struct lu_prompt</span> *prompts</code></em>,
                   <em class="parameter"><code><span class="type">int</span> count</code></em>,
                   <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
                   <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Prompts the user using a text console.</p>
<div class="refsect3">
<a name="id-1.2.6.7.2.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>prompts</p></td>
<td class="parameter_description"><p>An array of <a class="link" href="libuser-prompt.html#lu-prompt" title="struct lu_prompt"><span class="type">lu_prompt</span></a> structures.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>count</p></td>
<td class="parameter_description"><p>The number of elements in the <em class="parameter"><code>prompts</code></em>
array.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback_data</p></td>
<td class="parameter_description"><p>Ignored.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>The location to store error information in the event of an error.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.6.7.2.6"></a><h4>Returns</h4>
<p> A <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> indicating success or failure.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="lu-prompt-console-quiet"></a><h3>lu_prompt_console_quiet ()</h3>
<pre class="programlisting"><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
lu_prompt_console_quiet (<em class="parameter"><code><span class="type">struct lu_prompt</span> *prompts</code></em>,
                         <em class="parameter"><code><span class="type">int</span> count</code></em>,
                         <em class="parameter"><code><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> callback_data</code></em>,
                         <em class="parameter"><code><span class="type">struct lu_error</span> **error</code></em>);</pre>
<p>Prompts the user using a text console.  Unlike <a class="link" href="libuser-prompt.html#lu-prompt-console" title="lu_prompt_console ()"><code class="function">lu_prompt_console()</code></a>, this
function will not prompt users for a question for which the calling
application or module supplies a default, and will simply return the
default.</p>
<div class="refsect3">
<a name="id-1.2.6.7.3.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>prompts</p></td>
<td class="parameter_description"><p>An array of <a class="link" href="libuser-prompt.html#lu-prompt" title="struct lu_prompt"><span class="type">lu_prompt</span></a> structures.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>count</p></td>
<td class="parameter_description"><p>The number of elements in the <em class="parameter"><code>prompts</code></em>
array.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback_data</p></td>
<td class="parameter_description"><p>Ignored.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>The location to store error information in the event of an error.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.2.6.7.3.6"></a><h4>Returns</h4>
<p> A <a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> indicating success or failure.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="libuser-prompt.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="lu-prompt"></a><h3>struct lu_prompt</h3>
<pre class="programlisting">struct lu_prompt {
	const char *key;
	const char *prompt;
	const char *domain;
	gboolean visible;
	const char *default_value;
	char *value;
	void (*free_value) (void *);
};
</pre>
<p>The type of data passed to a prompter function.  The library uses these
when it needs to prompt the user for information.</p>
<div class="refsect3">
<a name="id-1.2.6.8.2.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p>const <span class="type">char</span> *<em class="structfield"><code><a name="lu-prompt.key"></a>key</code></em>;</p></td>
<td class="struct_member_description"><p>An invariant string of the form "module/name", which describes the
information being prompted for.  The calling application may use this value
as an index into a hash table used to cache answers to particular queries.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p>const <span class="type">char</span> *<em class="structfield"><code><a name="lu-prompt.prompt"></a>prompt</code></em>;</p></td>
<td class="struct_member_description"><p>The text of a prompt to display.  This *may* be translated for the
current locale by a module.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p>const <span class="type">char</span> *<em class="structfield"><code><a name="lu-prompt.domain"></a>domain</code></em>;</p></td>
<td class="struct_member_description"><p>The text domain which contains this prompt's translations.  This may
be the default libuser domain, or a module-specific text domain which the
module which provided this prompt bound for gettext when it was loaded.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><a href="https://developer.gnome.org/glib/unstable/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> <em class="structfield"><code><a name="lu-prompt.visible"></a>visible</code></em>;</p></td>
<td class="struct_member_description"><p>Whether or not the user's response should be echoed to the screen
(in a console app) or visible in an entry field (in a GUI app).</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p>const <span class="type">char</span> *<em class="structfield"><code><a name="lu-prompt.default-value"></a>default_value</code></em>;</p></td>
<td class="struct_member_description"><p>A default value, given as a string.  This will only contain a
value if the string is visible, but the reverse won't necessarily be true
(default_value -&gt; visible).</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><span class="type">char</span> *<em class="structfield"><code><a name="lu-prompt.value"></a>value</code></em>;</p></td>
<td class="struct_member_description"><p>The user's response.  This is set by the prompter function.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="lu-prompt.free-value"></a>free_value</code></em> ()</p></td>
<td class="struct_member_description"><p>A function which can free the user's response.  This is set by
the prompter function.  If NULL, the response will not be freed, ever.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>