Display examples more nicely
This commit is contained in:
parent
1d9622e10d
commit
5dc4b0aae2
1 changed files with 10 additions and 10 deletions
|
@ -58,7 +58,7 @@ generate nice printed copy.
|
|||
<p>Bird is configured using text configuration file. At startup, bird reads <file/bird.conf/
|
||||
(unless -c command line parameter is given). Really simple configuration file might look like this:
|
||||
|
||||
<cf>
|
||||
<cf><verb>
|
||||
|
||||
protocol kernel {
|
||||
persist; # Don't remove routes on bird shutdown
|
||||
|
@ -74,7 +74,7 @@ protocol rip {
|
|||
export all;
|
||||
import all;
|
||||
}
|
||||
</cf>
|
||||
</verb></cf>
|
||||
|
||||
<p>You can find example of more complicated configuration file in <file>doc/bird.conf.example</file>.
|
||||
|
||||
|
@ -102,7 +102,7 @@ value and value.
|
|||
|
||||
<p>Filter basically looks like this:
|
||||
|
||||
<cf>
|
||||
<cf><verb>
|
||||
filter not_too_far
|
||||
int var;
|
||||
{
|
||||
|
@ -117,7 +117,7 @@ int var;
|
|||
else
|
||||
accept "ok";
|
||||
}
|
||||
</cf>
|
||||
</verb></cf>
|
||||
|
||||
<p>As you can see, filter has a header, list of local variables, and body. Header consists of <cf/filter/ keyword, followed by (unique) name of filter. List of local variables consists of
|
||||
pairs <cf><I>type name</I>;</cf>, where each pair defines one local variable. Body consists of
|
||||
|
@ -188,7 +188,7 @@ is true if element is in given set or if ip adress is inside given prefix.
|
|||
over. Functions can have zero or more parameters, and can have local variables. Function basically
|
||||
looks like this:
|
||||
|
||||
<cf>
|
||||
<cf><verb>
|
||||
function name ()
|
||||
int local_variable;
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ function with_parameters (int parameter)
|
|||
{
|
||||
print parameter;
|
||||
}
|
||||
</cf>
|
||||
</verb></cf>
|
||||
|
||||
<p>Unlike C, variables are declared after function line but before first {. You can not declare
|
||||
variables in nested blocks. Functions are called like in C: <cf>name(); with_parameters(5);</cf>.
|
||||
|
@ -216,13 +216,13 @@ case. Syntax of if/then/else is <cf>if <I>expression</I> then
|
|||
or both commands. <cf>else</cf> clause may be ommited. Case is
|
||||
used like this:
|
||||
|
||||
<cf>
|
||||
<cf><verb>
|
||||
case <I>argument</I> {
|
||||
2: print "dva"; print "jeste jednou dva";
|
||||
3 .. 5: print "tri az pet";
|
||||
else: print "neco jineho";
|
||||
}
|
||||
</cf>
|
||||
</verb></cf>
|
||||
|
||||
where <I>argument</I> is any argument that can be on the left side of ~ operator, and anything that
|
||||
could be member of set is allowed before :. Multiple commands are allowed without {} grouping. If
|
||||
|
@ -293,7 +293,7 @@ other than equally (mis-)configured bird. I warned you.
|
|||
<p>In addition, rip defines two filter variables, both of type it. <cf>rip_metric</cf> is rip
|
||||
metric of current route, <cf>rip_tag</cf> is tag of current route.
|
||||
|
||||
<cf>
|
||||
<cf><verb>
|
||||
|
||||
protocol rip MyRIP_test {
|
||||
debug all;
|
||||
|
@ -309,6 +309,6 @@ protocol rip MyRIP_test {
|
|||
import filter { print "importing"; accept; };
|
||||
export filter { print "exporting"; accept; };
|
||||
}
|
||||
</cf>
|
||||
</verb></cf>
|
||||
|
||||
</article>
|
||||
|
|
Loading…
Reference in a new issue