Skip to content

Commit

Permalink
Document changes to switch / case
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Mar 28, 2014
1 parent 923aaae commit e44b41d
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions man/man5/unlang.5
Expand Up @@ -10,7 +10,7 @@
.RE
.sp
..
.TH unlang 5 "16 July 2013" "" "FreeRADIUS Processing un-language"
.TH unlang 5 "28 March 2014" "" "FreeRADIUS Processing un-language"
.SH NAME
unlang \- FreeRADIUS Processing un\-language
.SH DESCRIPTION
Expand Down Expand Up @@ -121,39 +121,56 @@ recommended.
.DE
.IP switch
.br
Evaluate the given string, and choose the first matching "case"
statement inside of the current block. If the string is surrounded by
double quotes, it is expanded as described in the DATA TYPES section,
below.
A "switch" statement takes one argument, and contains a series of
"case" statements. When a "switch" statement is encountered, the
argument from the "switch" is evaluated in turn against the argument
from each "case" statement. The first "case" statement which matches
is executed. All other "case" statements are ignored. A default
"case" statement can be defined, by omitting its argument.

If the argument is a double quoted string (e.g. "%{exec:1 + 2}", it is
expanded as described in the DATA TYPES section, below. The match is
then performed on the string returned from the expansion. If the
argument is an attribute reference (e.g. &User-Name), then the match
is performed on the value of that attribute. Otherwise, the argument
is taken to be a literal string, and and matching is done via simple
comparison.

No statement other than "case" can appear in a "switch" block.

.DS
switch "string" {
switch <argument> {
.br
...
.br
}
.DE
.IP case
.br
Define a static string to match a parent "switch" statement. The
strings given here are not expanded as is done with the parent
"switch" statement.
Provides a place-holder which matches the argument of a parent
"switch" statment.

A "case" statement cannot appear outside of a "switch" block.

If the argument is a double quoted string (e.g. "%{exec:1 + 2}", it is
expanded as described in the DATA TYPES section, below. The match is
then performed on the string returned from the expansion. If the
argument is an attribute reference (e.g. &User-Name), then the match
is performed on the value of that attribute. Otherwise, the argument
is taken to be a literal string, and and matching is done via simple
comparison.

.DS
case string {
case <argument> {
.br
...
.br
}
.DE

A default entry can be defined by omitting the static string. This
entry will be used if no other "case" entry matches. Only one default
entry can exist in a "switch" section.
A default entry can be defined by omitting the argument, as given
below. This entry will be used if no other "case" entry matches.
Only one default entry can exist in a "switch" section.

.DS
case {
Expand Down

0 comments on commit e44b41d

Please sign in to comment.