diff bin/cek.pl @ 613:1a996b35eaab

Style updates
author nanaya <me@nanaya.pro>
date Mon, 02 Apr 2018 17:44:25 +0900
parents 5bafb912837e
children 70355e17653e
line wrap: on
line diff
--- a/bin/cek.pl	Mon Apr 02 17:34:40 2018 +0900
+++ b/bin/cek.pl	Mon Apr 02 17:44:25 2018 +0900
@@ -6,44 +6,57 @@
 use File::Basename;
 
 my @files = @ARGV or print("Usage: ",basename($0)," file1 file2 ... fileN\n") && exit(1);
-my $num_ok=0;
-my $num_err=0;
-my $num_nf=0;
-my $num_na=@files;
+my $num_ok = 0;
+my $num_err = 0;
+my $num_nf = 0;
+my $num_na = @files;
+
+foreach (@files) {
+    my $filename = $_;
+    my ($name_crc,$real_crc);
+
+    unless (-f $filename) {
+        $num_nf++;
+        $num_na--;
+        print(qq(Could not find "$filename", skipping\n));
+        next();
+    }
 
-foreach(@files) {
-	my $filename = $_;
-	my ($name_crc,$real_crc);
-	unless (-f $filename) {
-		$num_nf++;$num_na--;
-		print(qq(Could not find "$filename", skipping\n));
-		next();
-	}
-	if(/(\[|\()([0-9A-F]{8})(\]|\))/i){
-		$name_crc=uc($2);
-	}
-	open(FILE,"<",$filename);
-	binmode(FILE);
-	$real_crc=sprintf("%08X",crc32(*FILE));
-	close(FILE);
-	if($name_crc) {
-		$num_na--;
-		if($name_crc eq $real_crc) {
-			$num_ok++;
-			print("$filename: OK - $real_crc\n");
-		} else {
-			$num_err++;
-			print("$filename: NOT OK - $real_crc, should be $name_crc\n");
-		}
-	} else {
-		print("$filename: $real_crc\n");
-	}
+    if (/(\[|\()([0-9A-F]{8})(\]|\))/i){
+        $name_crc = uc($2);
+    }
+
+    open(FILE,"<",$filename);
+    binmode(FILE);
+    $real_crc = sprintf("%08X",crc32(*FILE));
+    close(FILE);
+
+    if ($name_crc) {
+        $num_na--;
+        if($name_crc eq $real_crc) {
+            $num_ok++;
+            print("$filename: OK - $real_crc\n");
+        } else {
+            $num_err++;
+            print("$filename: NOT OK - $real_crc, should be $name_crc\n");
+        }
+    } else {
+        print("$filename: $real_crc\n");
+    }
 }
 
 printf("%s\n","-"x40);
-if($num_ok > 0) { print("Files OK: $num_ok\n"); }
-if($num_err > 0) { print("Files error: $num_err\n"); }
-if($num_nf > 0) { print("Files not found: $num_nf\n"); }
-if($num_na > 0) { print("Files without crc information: $num_na\n"); }
+if ($num_ok > 0) {
+    print("Files OK: $num_ok\n");
+}
+if ($num_err > 0) {
+    print("Files error: $num_err\n");
+}
+if ($num_nf > 0) {
+    print("Files not found: $num_nf\n");
+}
+if ($num_na > 0) {
+    print("Files without crc information: $num_na\n");
+}
 
 exit(0);