summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-02-10 07:46:45 +0000
committerfukachan <fukachan>2001-02-10 07:46:45 +0000
commit36a2bc2806c2afd793cecfecf2f2830ca427a61f (patch)
treee9a17d633e65e265a74e1f77b4db3c6e108b7ded /regress
parentae6484547f897b6cecf77175b7ea9b133b6a7c46 (diff)
downloadfml8-36a2bc2806c2afd793cecfecf2f2830ca427a61f.tar.gz
fml8-36a2bc2806c2afd793cecfecf2f2830ca427a61f.tar.bz2
fml8-36a2bc2806c2afd793cecfecf2f2830ca427a61f.zip
merge primitive ticket formatter
Diffstat (limited to 'regress')
-rwxr-xr-xregress/simulation/ticket/format134
-rwxr-xr-xregress/simulation/ticket/list_up.sh12
2 files changed, 6 insertions, 140 deletions
diff --git a/regress/simulation/ticket/format b/regress/simulation/ticket/format
deleted file mode 100755
index 3d629953..00000000
--- a/regress/simulation/ticket/format
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/local/bin/perl
-#
-# $Id$
-#
-
-use strict;
-use Carp;
-use vars qw(%article %options %cost %costed_ticket);
-use Getopt::Long;
-use lib qw(./fml/lib ./cpan/lib);
-use Jcode;
-use MIME::Base64;
-
-GetOptions(\%options, qw(debug! -D=s));
-
-my $ml_home_dir = $options{ D } || croak("-D directory");
-
-my ($buf);
-my ($date, $age, $status, $ticket_id, @articles);
-while (<>) {
- if (/^\d+/) {
- ($date, $age, $status, $ticket_id, @articles) = split;
- my $cost = $status.'-'.$age;
- $cost{ $cost } = $_;
- $costed_ticket{ $cost } = $ticket_id;
- $article{ $ticket_id } = $articles[0];
- }
- else {
- $buf .= $_;
- }
-}
-
-if (%article) {
- print $buf;
- ShowList( \%cost );
- print " ---------------------\n";
- print "\n";
- ShowSummary( \%article );
-}
-
-exit 0;
-
-
-sub ShowList
-{
- my ($cost) = @_;
- my $k;
-
- for $k (sort { $b cmp $a } keys %$cost) {
- print $cost{ $k };
- }
-}
-
-
-sub ShowSummary
-{
- my ($article) = @_;
- my ($cost, $tid, $num);
- my $f;
-
- print "\"!\" mark: stalled? please check and reply it!!!\n";
-
- for $cost (sort { $b cmp $a } keys %costed_ticket) {
- $tid = $costed_ticket{ $cost };
- $num = $article->{ $tid };
- $f = "$ml_home_dir/spool/$num";
-
- if (-f $f) {
- my $how_bad = 0;
- if ($cost =~ /(\w+)\-(\d+)/) {
- $how_bad += $2;
- $how_bad += 2 if $1 =~ /open/;
- $how_bad = "!" x ($how_bad > 6 ? 6 : $how_bad);
- }
-
- printf "\n%6s %-10s %s\n", $how_bad, $tid;
- print _summary($f);
- }
- }
-}
-
-
-sub _summary
-{
- my ($f) = @_;
- use FileHandle;
-
- my $buf;
- my $subject;
- my $padding = ' > ';
- my $line = 5;
- my $fh = new FileHandle $f;
- my $zform_is_found = 0;
- if (defined $fh) {
- while (<$fh>) {
- if (1 ../^$/) {
- if (/^(Subject:.*)=\?ISO\S+B\?(\S+)=\?=/) {
- my ($x, $y) = ($1, $2);
- $y = decode_base64($y);
- $buf .= $padding;
- $buf .= $x. Jcode::convert(\$y, 'euc')."\n";
- $buf .= $padding."\n";
- }
- elsif (/^(Subject:.*)/) {
- $buf .= $padding. $_;
- $buf .= $padding."\n";
- }
- next;
- }
-
- # looks zform ?
- if (/^DTD:/) {
- $zform_is_found = 1;
- next;
- }
-
- # nuke useless lines
- next if /^\s*$/;
- next if /^\>/;
- next if /^\-/;
- next if /^[-\w]+:/ && (! $zform_is_found);
-
- # pick up effetive the first $line lines
- if ($line--> 0) {
- $buf .= $padding. $_;
- }
- else {
- last;
- }
- }
- }
-
- $buf;
-}
diff --git a/regress/simulation/ticket/list_up.sh b/regress/simulation/ticket/list_up.sh
index abb47714..15fce686 100755
--- a/regress/simulation/ticket/list_up.sh
+++ b/regress/simulation/ticket/list_up.sh
@@ -3,17 +3,17 @@
# $Id$
#
+tmp=/tmp/$$
pwd=`pwd`
+trap "rm -f $tmp" 0 1 3 15
+
cd ../.. || exit 1;
-exec /usr/local/libexec/fml/fmlticket \
+/usr/local/libexec/fml/fmlticket \
--params pwd=$PWD \
-c $pwd/main.cf \
-R open \
- list /var/spool/ml/elena |\
- perl regress/simulation/ticket/format -D /var/spool/ml/elena
-
-
-
+ list /var/spool/ml/elena
+exit 0;