#!/usr/bin/perl # # rfc-dist2tag - convert an rfc-dist message to a tag-rfc file # # The announcement is on standard input, and the result is sent to # a file named after the rfc, as extracted from the input file # # This is a utility routine for the tagged rfc-index system and the # output rfcxxx.tag file will need to be edited before being entered # with rfcadd # # Copyright John Lines 1998 - released under the Gnu Public Licence # # throw away everything up to the A New request for comments line while (<>) { last if $_ =~ /^A new Request for Comments is now available.*/; } # next non blank should be RFC rfcnum while (<>) { last if $_ =~ /RFC/; } # get rid of blanks and the colon in the rfc line $_ =~ tr / ://ds; # work out what the rfc number should be $rfcnum= $_ ; chop $rfcnum; $rfcnum =~ tr /A-Z/a-z/; print "Creating $rfcnum.tag\n"; # open stdout named after the rfcnum open STDOUT, ">$rfcnum.tag" or die "Cant open $rfcnum $!"; print "Tag-rfc-version: 1.0\nEnd:\n"; print "Rfc: "; print; while (<>) { last if $_ =~ /^\s*URL.*/; #next if $_ =~ //; next if $_ =~ /^\s*Updates\/Obsoletes: None.*/; s/Author\(s\)/Authors/; s/Proposed Standard/Proposed_Standard/; s/Best Current Practice/Best_Current_Practice/; s/^\s*(.*)/$1/; $_=$1; if (/:/) { s/^(.*):\s*(.*)/$1: $2/; print "$1: $2\n"; } else { print "$_\n"; } } s/^\s*URL:\s*(.*)/Url: $1/; print "Url: $1\n"; print "Description:: END_D\n"; while (<>) { last if $_ =~ /^This memo defines a.*/; last if $_ =~ /^This memo provides information for the Internet.*/; last if $_ =~ /^This is now a Proposed Standard Protocol.*/; last if $_ =~ /^This is now a Standard Protocol.*/; print; } # just in case we will put in the end of the description field print "END_D\n"; print "End:\n";