X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fstaging%2Fwigyori.git;a=blobdiff_plain;f=docs%2Fconfig.tex;h=08318b4b6cfb2468354a6e8f592bef9c1287137b;hp=d13297c4f79d8b2929a899b62d5eea8725f5a2cd;hb=5fbc56cfdc82ed6f7226217ad82fc3872c5ac3b3;hpb=014b05aea0dafeee16d23444f3a7cb9889f21836 diff --git a/docs/config.tex b/docs/config.tex index d13297c4f7..08318b4b6c 100644 --- a/docs/config.tex +++ b/docs/config.tex @@ -23,7 +23,7 @@ To be able to load configuration files, you need to include the common functions with: \begin{Verbatim} -. /etc/functions.sh +. /lib/functions.sh \end{Verbatim} Then you can use \texttt{config\_load \textit{}} to load config files. The function @@ -32,7 +32,7 @@ it from \texttt{/etc/config} (which is the most common way of using it). If you want to use special callbacks for sections and/or options, you need to define the following shell functions before running \texttt{config\_load} -(after including \texttt{/etc/functions.sh}): +(after including \texttt{/lib/functions.sh}): \begin{Verbatim} config_cb() { @@ -57,6 +57,19 @@ after \texttt{config\_load} is done. That allows you to process sections both before and after all options were processed. +Another way of iterating on config sections is using the \texttt{config\_foreach} command. + +Syntax: +\begin{Verbatim} +config_foreach [] [] +\end{Verbatim} + +This command will run the supplied function for every single config section in the currently +loaded config. The section name will be passed to the function as argument 1. +If the section type is added to the command line, the function will only be called for +sections of the given type. + + You can access already processed options with the \texttt{config\_get} command Syntax: @@ -80,3 +93,9 @@ Syntax: config_set