#!/usr/bin/perl # # For an internet draft of the form "draft-foo-bar-gork-03.txt", # returns the previous version of the draft (e.g., -02). # # Updated: # 4/6/07 rcg now ignores fluff between digits and dot # (e.g., "b" in "draft-ietf-eai-smtpext-05b.txt") # { $foo = $ARGV[0]; if ( not $foo =~ /(.+-)([0-9]+)[^\.]*(.*)/ ) { printf stderr "\"$ARGV[0]\" doesn't seem to be an I-D\n"; exit 1; } $base = $1; $vers = $2; $ext = $3; if ( $vers == 0 ) { printf stderr "Version is 00\n"; exit 1; } $targ = $vers - 1; if ( $targ < 10 ) { $fill = "0"; } print "${base}${fill}${targ}${ext}\n"; }