[comp.sources.bugs] C News patch for X- headers in local articles

chip@ateng.com (Chip Salzenberg) (11/14/89)

In writing a local program to take a news article and repost it to another
newsgroup, I added a field "X-Original-Newsgroups:" with obvious purpose.
To avoid confusing rn, I put it at the end of the header.  However, I found
that the defhdrs.awk program outputs most headers in a random order, and the
X- header was being output in the middle.  This header arrangement confused
rn's hide-these-headers feature.

Therefore, I modified defhdrs.awk to output all non-standard (X-) headers
last.  Here is the (small) patch:

*** defhdrs.awk.P	Mon Aug 28 16:05:49 1989
--- defhdrs.awk	Mon Nov 13 18:55:52 1989
***************
*** 103,109 ****
  	}
  
! 	# print misc. non-empty headers in random order
  	for (i in hdrval)
! 		if (hdrval[i] != "" && hdrval[i] !~ /^[^\t ]*:[\t ]*$/)
  			print hdrval[i]
  }
--- 103,116 ----
  	}
  
! 	# print remaining standard headers in random order
  	for (i in hdrval)
! 		if (i !~ /^X-/ && \
! 		    hdrval[i] != "" && hdrval[i] !~ /^[^\t ]*:[\t ]*$/)
  			print hdrval[i]
+ 
+ 	# print remaining non-standard headers in random order
+ 	for (i in hdrval)
+ 		if (i ~ /^X-/ && \
+ 		    hdrval[i] != "" && hdrval[i] !~ /^[^\t ]*:[\t ]*$/)
+ 			print hdrval[i]
  }

I trust that others will also find this patch useful.  (Geoff?  Henry?)
-- 
You may redistribute this article only to those who may freely do likewise.
Chip Salzenberg at A T Engineering;  <chip@ateng.com> or <uunet!ateng!chip>

henry@utzoo.uucp (Henry Spencer) (11/16/89)

In article <255F55F6.19192@ateng.com> chip@ateng.com (Chip Salzenberg) writes:
>In writing a local program to take a news article and repost it to another
>newsgroup, I added a field "X-Original-Newsgroups:" with obvious purpose.
>To avoid confusing rn, I put it at the end of the header.  However, I found
>that the defhdrs.awk program outputs most headers in a random order, and the
>X- header was being output in the middle.  This header arrangement confused
>rn's hide-these-headers feature...  Therefore, I modified defhdrs.awk ...
>I trust that others will also find this patch useful.  (Geoff?  Henry?)

Our initial reaction is "we'd much rather see a fix to rn".  Header order
is explicitly arbitrary in all relevant standards; if rn gets confused
on seeing a strange header, that is definitely a bug in rn.  We appreciate
that C News is a lot easier to modify than rn :-), but we don't think this
is really the right approach.

On the other hand, occasional concessions to pragmatism are sometimes
reasonable.  Have other people run into situations like this?  As in
other cases, we'd like to see wide usefulness before we incorporate a
concession to distasteful reality into our software.
-- 
A bit of tolerance is worth a  |     Henry Spencer at U of Toronto Zoology
megabyte of flaming.           | uunet!attcan!utzoo!henry henry@zoo.toronto.edu