Hi Ralph,

> > It would be consistent but not desirable.
> 
> I disagree, I think consistency is desirable in this case.

I can't imagine why. I consider it as a bug. And if it also affects the string 
compare it would be even more defective. But anyway, that does not matter, I 
would not like to have it fixed (see below).

> I agree it works, but \\$3 isn't empty, it only compares as empty
> against another string.  ;-)
> 
>     $ cat endbrace.tr
>     .de t3
>     .tm \\$1/\\$3.
>     .if '\\$3'' .tm empty
>     .if !'\\$3'' .tm not-empty
>     ..
>     .t3 1 - x
>     .t3 2 -
>     .if t \{
>     .t3 3 - \}
>     .t3 3 - \}
>     $
>     $ groff -w all endbrace.tr >/dev/null
>     1/x.
>     not-empty
>     2/.
>     empty
>     3/\}.
>     empty
>     3/\}.
>     empty
>     $

Interestingly it differs for use for normal output or for .tm.  I used the 
following file on OpenBSD groff and UNIX V7 nroff:

.de A
\\n(.$(\\$1,\\$2,\\$3)
.tm tm \\n(.$(\\$1,\\$2,\\$3)
..
.pl 1
.nf
1: \c
.if 1 \{ .A\}
2: \c
.if 1 \{ .A \}
3: \c
.if 1 \{ .A
.       \}

Command in both cases is:
$ nroff t.nr

OpenBSD groff output:

tm 0(,,)
tm 1(\},,)
tm 0(,,)
1: 0(,,)
2: 1(,,)
3: 0(,,)

UNIX V7 nroff output:

1: 2: 1(,,)
tm 1(\{,,)
3: 0(,,)
tm 0(,,)

(Line order maybe differs due to stderr buffering.)

That means:

1) The bug has already been in V7 -> should not be fixed but documented
2) On both systems there is the same difference between normal output and .tm 
output
3) V7 has the additional bug that if there is no space before \} the .if 
statement is ignored

Conclusion: The code should stay as it is and I will update the issue report 
that only documentation has to be updated.

Cheers,
Carsten

Reply via email to