C News patch for X- headers in local articles

Chip Salzenberg chip at ateng.com
Tue Nov 14 11:01:57 AEST 1989


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 at ateng.com> or <uunet!ateng!chip>



More information about the Comp.sources.bugs mailing list