The Unix Heritage Society mailing list
 help / color / Atom feed
* Re: [TUHS] eqn anomaly
@ 2020-03-11  1:46 Norman Wilson
  0 siblings, 0 replies; 2+ messages in thread
From: Norman Wilson @ 2020-03-11  1:46 UTC (permalink / raw)
  To: tuhs

On (post-)V10:

echo '.EQ
define f % $1 %
.EN' | eqn


.lf 1 -
.ds 11 "\f2a,b\fP
.if 1m>\n(.v .ne 1m
.rn 11 10
.lf 5

On a Linux system with GNU eqn (groff) version 1.22.3,
the output is rather more verbose (48 lines!), but
the troff result is just an a (rather than the proper
a,b) and eqn complains

eqn:<standard input>:3: newline before end of quoted text

I assume this Linux result is more or less what Doug

Norman Wilson
Toronto ON
(still heating my basement with a MicroVAX)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [TUHS] eqn anomaly
@ 2020-03-11  1:14 Doug McIlroy
  0 siblings, 0 replies; 2+ messages in thread
From: Doug McIlroy @ 2020-03-11  1:14 UTC (permalink / raw)
  To: tuhs

I was surprised that eqn parses the macro call below as having two
arguments, each with an unmatched ".
        define f % $1 %
Ralph Corderoy found that the comma can be hidden by replacing it with
\N'44'. A somewhat cleaner way to hide it is
        define f % $1 %
        define comma % , %
        f(a comma b)
This works too.
        f(f(a comma b))
[Note for cognoscenti. Eqn's practice in expanding macro arguments clashes
with troff's. Eqn expands nested calls after substitution in the outer
macro definition; troff expands while collecting arguments of the outer
call. I've found no documentation of the eqn behavior.]

The classical man page for eqn asserts categorically, `Strings enclosed
in double quotes " " are passed through untouched.'  Unfortunately the
version of Kernighan/Cherry User's Guide that describes macros with
arguments says little about how arguments are parsed except that they
are separated by commas--nothing about whether commas are hidden by
parentheses or quotes.

Certainly splitting at a comma in a quoted string violates the plain
meaning of the man-page assertion. If anyone has v10 (or perhaps something
else after v7) running, I'd be grateful to learn what classic eqn actually
did. I'm morally certain that if it did split and anyone had complained
to Brian, he would have fixed it.

These observations lead me to file a bug report.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  1:46 [TUHS] eqn anomaly Norman Wilson
  -- strict thread matches above, loose matches on Subject: below --
2020-03-11  1:14 Doug McIlroy

The Unix Heritage Society mailing list

Archives are clonable: git clone --mirror

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone