Author: stef-guest
Date: 2008-01-03 21:27:59 +0000 (Thu, 03 Jan 2008)
New Revision: 7808

Modified:
   bin/check-new-issues
Log:
- readline support (needs libterm-readline-gnu-perl)
- be smarter about where to find data/CVE/list


Modified: bin/check-new-issues
===================================================================
--- bin/check-new-issues        2008-01-03 21:23:09 UTC (rev 7807)
+++ bin/check-new-issues        2008-01-03 21:27:59 UTC (rev 7808)
@@ -4,6 +4,7 @@
 use File::Temp;
 use Getopt::Std;
 #use Smart::Comments;
+use Term::ReadLine;
 
 my %opts;
 getopts('ln:fhi:t:T', \%opts);
@@ -45,8 +46,18 @@
 # - handle claimed-by
 # - look for ITPs?
 
-my $datafile="./secure-testing/data/CVE/list";
-my $allitemsfile="gunzip -c allitems.txt.gz|";
+
+my $basedir;
+if (-e "secure-testing/data/CVE/list") {
+       $basedir="secure-testing";
+} elsif (-e "data/CVE/list") {
+       $basedir=".";
+} elsif (-e "../data/CVE/list") {
+       $basedir="..";
+}
+
+my $datafile="$basedir/data/CVE/list";
+my $allitemsfile="gunzip -c $basedir/../allitems.txt.gz|";
 my $allitemsurl="http://cve.mitre.org/data/downloads/allitems.txt.gz";;
 
 my $issue_regexp= $opts{i} || 'CVE-200[3-9]';
@@ -54,7 +65,7 @@
 
 my $editor=$ENV{EDITOR} || $ENV{VISUAL} || "vi";
 
-system "wget -N $allitemsurl";
+system "cd $basedir/.. ; wget -N $allitemsurl";
 
 
 print "Reading data...\n";
@@ -115,13 +126,19 @@
        exit 0;
 }
 
+
+my $term = new Term::ReadLine 'check-new-issues';
+if ($term->ReadLine() eq 'Term::ReadLine::Stub') {
+       print "Install libterm-readline-gnu-perl to get readline support!\n";
+}
+
 TODO: foreach my $todo (reverse sort @todos) {
        print ${$data->{$todo}->{CVE}} if $data->{$todo}->{CVE};
        print ${$data->{$todo}->{entry}};
 
        auto_search($todo);
        
-    READ: while (my $r=<STDIN>) {
+    READ: while (my $r=$term->readline(">") ) {
                chomp $r;
                if ($r =~ /^\s*$/) {
                        next TODO;


_______________________________________________
Secure-testing-commits mailing list
Secure-testing-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/secure-testing-commits

Reply via email to