diff bin/slashes @ 9075:c989a1669243

<fizzie> revert 58b9ee8f97a7
author HackBot
date Sun, 25 Sep 2016 20:31:46 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/slashes	Sun Sep 25 20:31:46 2016 +0000
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+#By Ørjan Johansen, 2009-2012.  This file is in the public domain.
+
+$| = 1;
+my $l = 0;
+
+$_ = join '', <>;
+while ($l < 512) {
+        if (s!^([^/\\]+)!! or s!^\\(.)!!s) { 
+                $l += length($1);
+                print($1);
+        }
+        else {
+            if (s!^/((?:[^/\\]|\\.)*)/((?:[^/\\]|\\.)*)/!!s) {
+                my ($s,$d) = ($1,$2);
+                $s =~ s/\\(.)/$1/gs;
+                $d =~ s/\\(.)/$1/gs;
+                while (s/(?:\Q$s\E)/$d/) { 
+                }
+            }
+            else { last; }
+        }
+}