File: makefile.pl

package info (click to toggle)
therion 6.3.4-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,544 kB
  • sloc: cpp: 195,273; tcl: 19,779; ansic: 8,434; perl: 1,895; makefile: 1,281; python: 255; asm: 219; sh: 104
file content (43 lines) | stat: -rw-r--r-- 1,006 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use File::Glob;
use File::Copy;
use File::Path;

if ($ARGV[0] =~ /^\s*cp\s*$/i) {
  copy($ARGV[1],$ARGV[2]) || die("$0: error -- cp $ARGV[1] -> $ARGV[2]\n");
}

elsif ($ARGV[0] =~ /^\s*mv\s*$/i) {
  copy($ARGV[1],$ARGV[2]) || die("$0: error -- cp $ARGV[1] -> $ARGV[2]\n");
  unlink($ARGV[1]) || warn("$0: can't delete $ARGV[1]\n");;
}

elsif ($ARGV[0] =~ /^\s*rm\s*$/i) {
  $dum = shift @ARGV;
  $quietdel = '';
  if ($ARGV[0] =~ /^\s*\-q\s*$/) {
    $dum = shift @ARGV;
    $quietdel = 1;
  }
  foreach $f (@ARGV) {
    if ($f =~ /\*/) {
      @fl = glob($f);
      foreach $ff (@fl) {
        unlink($ff) || $quietdel || warn("$0: can't delete $ff\n");
      }
    } else {
      unlink($f) || $quietdel || warn("$0: can't delete $f\n");
    }
  }
}

elsif ($ARGV[0] =~ /^\s*rmdir\s*$/i) {
  $dum = shift @ARGV;
  $quietdel = '';
  if ($ARGV[0] =~ /^\s*\-q\s*$/) {
    $dum = shift @ARGV;
    $quietdel = 1;
  }
  foreach $f (@ARGV) {
    rmtree($f) || $quietdel || warn("$0: can't delete $f\n");;
  }
}