3 ###############################################################################
5 # Name : whack_forever #
6 # Author : Chris Koeritz #
7 # Rights : Copyright (C) 1992-$now by Author #
11 # Zaps a list of files. This file exists since the default in the YETI #
12 # shell environment is to compress files when deletion is attempted. Only #
13 # the whack_forever command actually deletes the files for real. #
15 ###############################################################################
16 # This program is free software; you can redistribute it and/or modify it #
17 # under the terms of the GNU General Public License as published by the Free #
18 # Software Foundation; either version 2 of the License, or (at your option) #
19 # any later version. See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
20 # version of the License. Please send any updates to "fred@gruntose.com". #
21 ###############################################################################
23 require "filename_helper.pl";
25 sub interrupt_handler {
26 # skip doing any deletions.
27 print "\nbailing out due to interrupt. not doing any remaining deletions.\n";
31 $SIG{'INT'} = 'interrupt_handler'; # trigger our function instead of continuing.
35 local(@whackers) = @ARGV;
37 while ($whackers[0] =~ /^-/) {
38 # this one is a special flag to pass. don't try to whack that.
39 $flags = $flags . @whackers[0] . ' ';
43 #print "flags are $flags\n";
45 @whackers = &glob_list(@whackers);
47 if (scalar(@whackers) > 0) {
48 print "ZAPPING FOREVER! @whackers ...\n";
49 system("sleep 4") == 0 || &interrupt_handler;
50 print "\nNow really deleting files! => @whackers\n";
54 foreach $i (@whackers) {
56 unlink($i) || print "failed to unlink $i\n";
58 system("rm $flags \"$i\"");
60 unlink($i) || print "failed to unlink $i\n";