document config_foreach, close #2162
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 4 Aug 2007 12:23:46 +0000 (12:23 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Sat, 4 Aug 2007 12:23:46 +0000 (12:23 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@8342 3c298f89-4303-0410-b956-a3cf2f4a3e73

docs/config.tex

index d13297c4f79d8b2929a899b62d5eea8725f5a2cd..17417c99a1c2574aeac1d57397ffeade81f7c04a 100644 (file)
@@ -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 <function name> [<sectiontype>] [<arguments...>]
+\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 <section> <option> <value>
 \end{Verbatim}
 
+If a config section is unnamed, an automatically generated name will
+be assigned internally, e.g. \texttt{cfg1}, \texttt{cfg2}, ...
+
+While it is possible, using unnamed sections through these autogenerated names is
+strongly discouraged. Use callbacks or \texttt{config\_foreach} instead.
+