1<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>7.&#160;Value parsing callback</title><link rel="stylesheet" href="tutorial.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="libConfuse tutorial" /><link rel="up" href="index.html" title="libConfuse tutorial" /><link rel="prev" href="ar01s06.html" title="6.&#160;Validating callback functions" /><link rel="next" href="ar01s08.html" title="8.&#160;Functions" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">7.&#160;Value parsing callback</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ar01s06.html">Prev</a>&#160;</td><th width="60%" align="center">&#160;</th><td width="20%" align="right">&#160;<a accesskey="n" href="ar01s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="7.&#160;Value parsing callback"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="id442434"></a>7.&#160;Value parsing callback</h2></div></div></div><p>
4            A value parsing callback is another kind of callback function
5            available in libConfuse. This function is used to map a string into
6            some other other value. One example is to extend a boolean option
7            to accept the values "yes", "no" and "ask" (or perhaps "true",
8            "false" and "maybe"). Those values should be mapped to the integers
9            1, 2 and 3.
10        </p><pre class="programlisting">
11typedef int (*cfg_callback_t)(cfg_t *cfg, cfg_opt_t *opt,
12                              const char *value, void *result);
13        </pre><p>
14            
15        </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ar01s06.html">Prev</a>&#160;</td><td width="20%" align="center">&#160;</td><td width="40%" align="right">&#160;<a accesskey="n" href="ar01s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">6.&#160;Validating callback functions&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;8.&#160;Functions</td></tr></table></div></body></html>
16