#!/opt/bin/perl ######################################################################### # # # Program for finding certain mails in certain mailfolders # # # ######################################################################### # # # Version 1.1 - Written 11.11.96 by Steffen Beyer # # # ######################################################################### # # # Copyright (C) 1995 by software design & management GmbH & Co. KG # # # ######################################################################### # Default settings: $version = 'version 1.1'; $self = $0; $self =~ s!^.*/!!; $self =~ s!\.suid$!!; # Check arguments: if (@ARGV != 1) { &usage; exit(1); } $search = shift; if ($search !~ /^\d{1,4}$/) { &usage; warn " ::= [[[]]]\n"; warn "\n"; warn " ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n"; warn "\n"; exit(1); } printf("Searching preport %04d...\n", $search); unshift(@INC, '/opt/lib/problem'); require "config.pl"; # Configure here the name(s) of your problem report folder(s): push(@list, 'preport'); push(@list, 'zurueck'); push(@list, 'erledigt'); &configure(); push(@list, @files); $found = 0; # Loop through list of folders: for ( $i = 0; $i <= $#list; $i++ ) { $file = $list[$i]; if (open(FOLDER, "<$path/$file")) { while () { if (/^Subject: \d (\d\d\d\d) /) { if ($search == $1) { print "preport $1 found in folder '$file'\n"; $found = 1; last; } } } close(FOLDER); } else { warn "$self: can't read folder '$file': $!\n"; } } unless ($found) { printf("preport %04d not found\n", $search); } exit(0); sub usage { warn "\n"; warn "$self $version\n"; warn "\n"; warn "Usage: $self \n"; warn "\n"; } __END__