From ea6c2fadb8745f14d7fb1fb23eaab85df1db2a7b Mon Sep 17 00:00:00 2001 From: robiscool Date: Wed, 13 Jun 2012 16:51:54 -0700 Subject: snort-dev, move snort-dev2 to snort-dev --- .../bin/oinkmaster_contrib/snort_rename.pl | 100 --------------------- 1 file changed, 100 deletions(-) delete mode 100644 config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl (limited to 'config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl') diff --git a/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl b/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl deleted file mode 100644 index e5f0d39e..00000000 --- a/config/snort-dev2/bin/oinkmaster_contrib/snort_rename.pl +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -w - -#usage: rename perl_expression [files] -my $usage = qq{rename [-v] s/pat/repl/ [filenames...]\t (c)2001 hellweg\@snark.de -rename files read from the commandline or stdin - -License to use, modify and redistribute granted to each and every lifeform on -this planet (as long as credit to hellweg\@snark.de remains). No guarantee that -'rename' does or does not perform the way you want... - -} ; -$verbose = 0 ; -$quiet = 0 ; - -$op=shift || 0 ; -if($op eq "-v") { - $verbose++ ; $quiet = 0 ; - $op=shift || 0 ; -} -if($op eq "-q") { - $quiet++ ; $verbose = 0 ; - $op=shift || 0 ; -} -if($op =~ /^-h/) { - print $usage; exit(0) ; -} - -if(! $op) { - print $usage; exit(-1) ; -} - -if (!@ARGV) { - @ARGV = ; -} - -$count=0 ; -my($m, $d, $y, $T) ; -for (@ARGV) { - chomp ; - if(-e $_) { - $was = $_; - if($op =~ /\$[Tdym]/) { - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime((stat($_))[9]); - $m = sprintf("%0.2i", $mon+1); - $d = sprintf("%0.2i", $mday); - $y = $year + 1900 ; - $T = "$y$m$d" ; - } - eval $op; - die $@ if $@; - if(-f $_) { print("! exists already: $was -> $_ \n") unless $quiet ; } - else { - if(rename($was, $_)) { - print("$was -> $_\n") if $verbose ; - $count++; - } else { - if(/\//) { - # maybe we need to create dirs? - my $createRes = createDirs($_) ; - if($createRes) { - print("! fauled to create $createRes for $_\n") - unless $quiet ; - } - else { # try again - if(rename($was, $_)) { - print("$was -> $_\n") if $verbose ; - $count++; - } else { - print("! failed to rename $was -> $_ \n") - unless $quiet ; - } - } - } - else { - print("! failed to rename $was -> $_ \n") unless $quiet ; - } - } - } - } - else { print("! not found: $_ \n") ; } -} -print("renamed $count files\n") if $verbose ; - - -sub createDirs { # return the dir we failed to create or 0 - my $file = shift ; - my @dirs = split /\//, $file ; - pop @dirs ; # don't try to mkdir the file itself - my $current = "" ; - $current = "/" if ($file =~ /^\//) ; - foreach (@dirs) { - $current .= $_ ; - if(! -d $current) { - mkdir $current, 0700 || return $current ; - print "mkdir $current\n" if ($verbose) ; - } - $current .= "/" ; - } - return 0 ; # success -} -- cgit v1.2.3