diff bin/slashes @ 4729:417963e20c08

<oerjan> chmod +x ircslashes.pl; mv ircslashes.pl bin/slashes
author HackBot
date Sun, 24 Aug 2014 23:07:35 +0000
parents ircslashes.pl@3339ace022d7
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/slashes	Sun Aug 24 23:07:35 2014 +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; }
+        }
+}