diff --git a/trunk/ripnews/ripnews.rb b/trunk/ripnews/ripnews.rb index 07814cb..92c631d 100755 --- a/trunk/ripnews/ripnews.rb +++ b/trunk/ripnews/ripnews.rb @@ -1,6 +1,6 @@ #!/usr/local/bin/ruby -w -# $Dwarf: ripnews.rb,v 1.62 2003/05/26 19:35:04 ward Exp $ +# $Dwarf: ripnews.rb,v 1.63 2003/05/27 19:12:46 ward Exp $ # $Source$ require 'date' @@ -425,6 +425,24 @@ def get_max_file_length(tempdir=".") return name.length - 14 end +def ward_sort(a, b) + c = a.to_s.split(/([0-9]+)/) + d = b.to_s.split(/([0-9]+)/) + + c.collect{|x| + y = d.shift + r = ((x.to_s =~ /^[0-9]+$/) && (y.to_s =~ /^[0-9]+$/)) ? + (x.to_i <=> y.to_i) : + (x.to_s <=> y.to_s) + if r != 0 + return r + end + } + return -1 if (d != []) + return 0 +end + + ############################################################################################# $stdout.sync=true # line buffered output @@ -466,7 +484,7 @@ for group in @config.keys.sort print "eeeps, couldn't create dir\n" exit end - for i in @articles.get_group_subjects + for i in @articles.get_group_subjects.sort{|a, b| ward_sort(a, b)} print "#{i}\n" if Debuglevel > 2 if @config[group].has_key?("-MR") and i =~ /#{@config[group]["-MR"]}/ print "Marking '#{i}' as read\n"