annotate bin/slashes @ 11293:a7899ef2d7b6

<wob_jonas> learn Aristotle said that every illness can be cured by balancing the four vitreous humors, and everyone believed him for two thousand years, even though people still died of illnesses. It wasn\'t until the 20th century that Szent-Gy\xc3\xb6rgyi Albert realized that Aristotle didn\'t find fifth kind of vitreous humor, vitamin C, because the Greek alphabet
author HackBot
date Mon, 01 Jan 2018 17:57:43 +0000
parents c989a1669243
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9075
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
1 #!/usr/bin/perl -w
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
2 #By Ørjan Johansen, 2009-2012. This file is in the public domain.
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
3
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
4 $| = 1;
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
5 my $l = 0;
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
6
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
7 $_ = join '', <>;
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
8 while ($l < 512) {
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
9 if (s!^([^/\\]+)!! or s!^\\(.)!!s) {
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
10 $l += length($1);
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
11 print($1);
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
12 }
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
13 else {
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
14 if (s!^/((?:[^/\\]|\\.)*)/((?:[^/\\]|\\.)*)/!!s) {
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
15 my ($s,$d) = ($1,$2);
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
16 $s =~ s/\\(.)/$1/gs;
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
17 $d =~ s/\\(.)/$1/gs;
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
18 while (s/(?:\Q$s\E)/$d/) {
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
19 }
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
20 }
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
21 else { last; }
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
22 }
c989a1669243 <fizzie> revert 58b9ee8f97a7
HackBot
parents:
diff changeset
23 }