Make it clearer what means 'won't work' for .if string == ${VAR}.

Replace the use of '=' in conditionals in the examples
by the more correct '=='.

Clarify the example explaining that .for expansion takes place before
.if handling by showing the correct code instead of saying 'the other
way around'. Change a variable name there so the example is more parseable
to the human reader.

PR:		docs/65400
Submitted by:	Roman Neuhauser <neuhauser@chello.cz>
This commit is contained in:
harti 2004-07-19 14:42:57 +00:00
parent a83177cdc3
commit 4265ad1914

View File

@ -1270,19 +1270,26 @@ in a test is very simple-minded.
Currently, the only form that works is
.Ql .if ${VAR} op something
For instance, you should write tests as
.Ql .if ${VAR} = "string"
not the other way around, which doesn't work.
.Ql .if ${VAR} == "string"
not the other way around, which would give you an error.
.Pp
For loops are expanded before tests, so a fragment such as:
.Bd -literal -offset indent
\&.for TMACHINE in ${SHARED_ARCHS}
\&.if ${TMACHINE} = ${MACHINE}
\&.for ARCH in ${SHARED_ARCHS}
\&.if ${ARCH} == ${MACHINE}
...
\&.endif
\&.endfor
.Ed
.Pp
won't work, and should be rewritten the other way around.
won't work, and should be rewritten as:
.Bd -literal -offset indent
\&.for ARCH in ${SHARED_ARCHS}
\&.if ${MACHINE} == ${ARCH}
...
\&.endif
\&.endfor
.Ed
.Pp
The parsing code is broken with respect to handling a semicolon
after a colon, so a fragment like this will fail: