#!/usr/local/bin/perl $MQUEUE = '/usr/spool/mqueue'; if ($ARGV[0] eq '-f') { $force_flag++; shift; } if (! chdir $MQUEUE) { die "can't cd to $MQUEUE: $!, bailing out"; } if (! -w $MQUEUE) { die "can't unlink from $MQUEUE, bailing out"; } for (@ARGV) { if (/^(\d+)$/) { $_ = 'AA' . $1; } if (!/^AA/) { warn "$0: ingoring funny mail id: $_\n"; next; } if (! (@files = )) { warn "$0: no $_ mail request\n"; next; } if (!$force_flag && grep(/^lf/,@files)) { warn "$0: request $_ in progress\n"; next; } for $file (@files) { if (unlink($file)) { print STDERR $file, "\n"; } else { warn "$0: can't unlink $file: $!\n"; } } }