[news.misc] rn environment values

ray@philmtl.philips.ca (Ray Dunn) (01/11/90)

I'm trying to construct a warning that I'm following up to a Followup-to
line rather than to the Newsgroups line, by inserting a test in the
NEWSHEADER variable.

Unfortunately it would appear that a percent escape cannot appear as the
"pattern" in the construct:

%(test_text=pattern?then_text:else_text)

In other words, the following, and its variations, does not work,
irrespective of the values of %F (new Newsgroups line) and %n (old
Newsgroups line):

%(%F=%n?:Warning - Followup-to different from %n)

Does anyone have any suggestions?  Comments?

Thanks.
-- 
Ray Dunn.                    | UUCP: ray@philmt.philips.ca
Philips Electronics Ltd.     |       ..!{uunet|philapd|philabs}!philmtl!ray
600 Dr Frederik Philips Blvd | TEL : (514) 744-8200  Ext : 2347 (Phonemail)
St Laurent. Quebec.  H4M 2S9 | FAX : (514) 744-6455  TLX : 05-824090

ray@philmtl.philips.ca (Ray Dunn) (01/12/90)

In referenced article, I wrote:
>I'm trying to construct a warning that I'm following up to a Followup-to
>
>%(%F=%n?:Warning - Followup-to different from %n)
>
> [doesn't work because the %n can't appear as the pattern!]

In email, sahayman@iuvax.cs.indiana.edu (Steve Hayman) suggests a variant
of the following using expr and command substitution:

%(%`expr "%F" = "n"`=1?:WARNING\
Followed-up to: %F\
          from: %n\n\n)\

This is embedded at the end of the NEWSHEADER environment variable so that
the warning actually appears in the followup being created, so it is easy to
pick up the "correct" newsgroup and yank it into the newgroup line.

[ Note that =1?: is "safer" than =0? ]

It could of course be done as a prompt prior to entering the editor by, e.g:

%(%`expr "%F" = "n"`=1?:%"WARNING:Followed-up to: %F")

Select your own flavour from the many.

I am never happy with the overhead involved in executing commands in this
way, and would rather do it "within the language" where possible.

Anyone see a "better" solution?
-- 
Ray Dunn.                    | UUCP: ray@philmt.philips.ca
Philips Electronics Ltd.     |       ..!{uunet|philapd|philabs}!philmtl!ray
600 Dr Frederik Philips Blvd | TEL : (514) 744-8200  Ext : 2347 (Phonemail)
St Laurent. Quebec.  H4M 2S9 | FAX : (514) 744-6455  TLX : 05-824090