OSDN Git Service

untab
authorSHIRAKATA Kentaro <argrath@ub32.org>
Wed, 11 Dec 2019 19:30:08 +0000 (04:30 +0900)
committerSHIRAKATA Kentaro <argrath@ub32.org>
Wed, 11 Dec 2019 19:30:08 +0000 (04:30 +0900)
1line/diff.pl
1line/patch.pl

index 28261ed..becf1ab 100644 (file)
@@ -1,25 +1,23 @@
 #! /usr/bin/perl -i.bak
 while(<>){
-       if($_ eq "/*JP\n"){
-               my($s1, $s2, $s3);
-               $s1 = <>;
-               $s2 = <>;
-               $s3 = <>;
-               if($s2 eq "*/\n"){
-                       print $s1;
-                       open FF, ">>../../1line/$ARGV.txt";
-                       print FF $s1;
-                       print FF $s3;
-                       close FF;
-               } else {
-                       print "/*JP\n";
-                       print $s1;
-                       print $s2;
-                       print $s3;
-               }
-       } else {
-               print $_;
-       }
+    if($_ eq "/*JP\n"){
+        my($s1, $s2, $s3);
+        $s1 = <>;
+        $s2 = <>;
+        $s3 = <>;
+        if($s2 eq "*/\n"){
+            print $s1;
+            open FF, ">>../../1line/$ARGV.txt";
+            print FF $s1;
+            print FF $s3;
+            close FF;
+        } else {
+            print "/*JP\n";
+            print $s1;
+            print $s2;
+            print $s3;
+        }
+    } else {
+        print $_;
+    }
 }
-
-
index 3e81490..e3ebe3f 100644 (file)
@@ -5,40 +5,40 @@ my (@file) = <>;
 my (@file2) = @file;
 close F;
 for($i = 0; $i < $#file; $i++){
-$file2[$i] =~ s/^[\t ]+//;
+    $file2[$i] =~ s/^[\t ]+//;
 }
 open FI, "<../../1line/$ARGV.txt";
 while(!eof(FI)){
-       my ($i);
-       my ($in, $in2, $out);
-       my ($f) = 0;
-       $in = <FI>;
-       $out = <FI>;
-       $in2 = $in;
-       $in2 =~ s/^[\t ]+//;
-       for($i = 0; $i < $#file; $i++){
-               if($file[$i] eq "#if 0 /*JP*/\n"){
-                       $f = 1;
-                       next;
-               }
-               if($file[$i] =~ /endif/){
-                       $f = 0;
-                       next;
-               }
+    my ($i);
+    my ($in, $in2, $out);
+    my ($f) = 0;
+    $in = <FI>;
+    $out = <FI>;
+    $in2 = $in;
+    $in2 =~ s/^[\t ]+//;
+    for($i = 0; $i < $#file; $i++){
+        if($file[$i] eq "#if 0 /*JP*/\n"){
+            $f = 1;
+            next;
+        }
+        if($file[$i] =~ /endif/){
+            $f = 0;
+            next;
+        }
 
-               if($f == 1){
-                       next;
-               }
+        if($f == 1){
+            next;
+        }
 
-               if($in2 eq $file2[$i]){
-                       $file[$i] = "/*JP\n$in*/\n$out";
-                       $file2[$i] = '';
-                       last;
-               }
-       }
-       if($i == $#file){
-               print "$ARGV:\n" . $in . $out;
-       }
+        if($in2 eq $file2[$i]){
+            $file[$i] = "/*JP\n$in*/\n$out";
+            $file2[$i] = '';
+            last;
+        }
+    }
+    if($i == $#file){
+        print "$ARGV:\n" . $in . $out;
+    }
 }
 close FI;
 open FO, ">$ARGV.new";