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";
24 require "importenv.pl";
26 sub interrupt_handler {
27 # skip doing any deletions.
28 print "\nbailing out due to interrupt. not doing any remaining deletions.\n";
32 $SIG{'INT'} = 'interrupt_handler'; # trigger our function instead of continuing.
36 local(@whackers) = @ARGV;
38 while ($whackers[0] =~ /^-/) {
39 # this one is a special flag to pass. don't try to whack that.
40 $flags = $flags . @whackers[0] . ' ';
44 #print "flags are $flags\n";
46 @whackers = &glob_list(@whackers);
48 if (scalar(@whackers) > 0) {
49 print "ZAPPING FOREVER! @whackers ...\n";
50 system("sleep 4") == 0 || &interrupt_handler;
51 print "\nNow really deleting files! => @whackers\n";
55 foreach $i (@whackers) {
57 unlink($i) || print "failed to unlink $i\n";
59 system("rm $flags \"$i\"");
61 unlink($i) || print "failed to unlink $i\n";