X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fsvn-archive%2Farchive.git;a=blobdiff_plain;f=docs%2Fconfig.tex;h=f3802198edabcb5fb0723d216d96648760ac2716;hp=44b6689b538034b6482026b5d8acc95d29a40ca2;hb=1de800ac2ccef15c4bc27af7f1f193ce48dcc1a0;hpb=1c602b8cc8dd6b495496ed65ffd5090d63d5718f diff --git a/docs/config.tex b/docs/config.tex index 44b6689b53..f3802198ed 100644 --- a/docs/config.tex +++ b/docs/config.tex @@ -9,25 +9,25 @@ it was written under. Syntax: \begin{Verbatim} -config [] # Section - option # Option +config [""] # Section + option "" # Option \end{Verbatim} Every parameter needs to be a single string and is formatted exactly -like a parameter for a shell function. The same rules for Quoting and +like a parameter for a shell function. The same rules for Quoting and special characters also apply, as it is parsed by the shell. \subsubsection{Parsing configuration files in custom scripts} -To be able to load configuration files, you need to include the common +To be able to load configuration files, you need to include the common functions with: \begin{Verbatim} . /etc/functions.sh \end{Verbatim} -Then you can use \texttt{config\_load \textit{}} to load config files. The function -first checks for \textit{} as absolute filename and falls back to loading +Then you can use \texttt{config\_load \textit{}} to load config files. The function +first checks for \textit{} as absolute filename and falls back to loading 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 @@ -36,13 +36,13 @@ need to define the following shell functions before running \texttt{config\_load \begin{Verbatim} config_cb() { - local type="$1" - local name="$2" - # commands to be run for every section + local type="$1" + local name="$2" + # commands to be run for every section } option_cb() { - # commands to be run for every option + # commands to be run for every option } \end{Verbatim} @@ -68,7 +68,7 @@ config_get