diff options
author | Stefan Fritsch <sf@sfritsch.de> | 2008-01-03 21:27:59 +0000 |
---|---|---|
committer | Stefan Fritsch <sf@sfritsch.de> | 2008-01-03 21:27:59 +0000 |
commit | 5063e31db27403fcf05101b3fb4642ba146ba32c (patch) | |
tree | b6f428e5a9127c49003fdbb94ab4288dfaa70699 /bin | |
parent | 17bad028355296de7a91c17522a43029d0adaf1e (diff) |
- readline support (needs libterm-readline-gnu-perl)
- be smarter about where to find data/CVE/list
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@7808 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/check-new-issues | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/bin/check-new-issues b/bin/check-new-issues index 264a97241c..aab7db454a 100755 --- a/bin/check-new-issues +++ b/bin/check-new-issues @@ -4,6 +4,7 @@ use strict; use File::Temp; use Getopt::Std; #use Smart::Comments; +use Term::ReadLine; my %opts; getopts('ln:fhi:t:T', \%opts); @@ -45,8 +46,18 @@ EOF # - 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 $todo_regexp= $opts{t} || ( $opts{T} ? '^\s+TODO: check' : '^\s+TODO: check$' 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 @@ if ($opts{l}) { 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; |