Mercurial > repo
annotate bin/slashes @ 8566:6119f30fc5cb
<int-e> learn pico is the useless twin of nano.
author | HackBot |
---|---|
date | Wed, 22 Jun 2016 18:48:29 +0000 |
parents | c0aac9581038 |
children |
rev | line source |
---|---|
5643 | 1 #!/usr/bin/perl -w |
6596
c0aac9581038
<oerjan> `` sed -i \'s/.rjan/\xc3\x98rjan/\' bin/slashes
HackBot
parents:
5643
diff
changeset
|
2 #By Ørjan Johansen, 2009-2012. This file is in the public domain. |
5643 | 3 |
4 $| = 1; | |
5 my $l = 0; | |
6 | |
7 $_ = join '', <>; | |
8 while ($l < 512) { | |
9 if (s!^([^/\\]+)!! or s!^\\(.)!!s) { | |
10 $l += length($1); | |
11 print($1); | |
12 } | |
13 else { | |
14 if (s!^/((?:[^/\\]|\\.)*)/((?:[^/\\]|\\.)*)/!!s) { | |
15 my ($s,$d) = ($1,$2); | |
16 $s =~ s/\\(.)/$1/gs; | |
17 $d =~ s/\\(.)/$1/gs; | |
18 while (s/(?:\Q$s\E)/$d/) { | |
19 } | |
20 } | |
21 else { last; } | |
22 } | |
23 } |