Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F44145
icat.php
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
epriestley
May 24 2013, 12:06 PM
2013-05-24 12:06:43 (UTC+0)
Size
896 B
Referenced Files
None
Subscribers
None
icat.php
View Options
#!/usr/bin/env php
<?php
if
(
$argc
>
1
)
{
$args
=
array_slice
(
$argv
,
1
);
}
else
{
$args
=
array
(
'php://stdin'
);
}
foreach
(
$args
as
$arg
)
{
$data
=
file_get_contents
(
$arg
);
for
(
$ii
=
0
;
$ii
<
strlen
(
$data
);
$ii
++)
{
$s
=
$data
[
$ii
];
$n
=
isset
(
$data
[
$ii
+
1
])
?
$data
[
$ii
+
1
]
:
null
;
$c
=
ord
(
$s
);
if
(
$c
>=
33
&&
$c
<=
127
)
{
echo
$s
;
}
else
if
(
$s
==
"
\r
"
)
{
echo
special
(
'
\\
r '
);
if
(
$n
!==
"
\n
"
)
{
echo
"
\n
"
;
}
}
else
if
(
$s
==
"
\n
"
)
{
echo
special
(
'
\\
n '
).
"
\n
"
;
}
else
if
(
$s
==
"
\t
"
)
{
echo
special
(
'
\\
t '
);
}
else
if
(
$s
==
' '
)
{
echo
under
(
' '
);
}
else
{
echo
special
(
'
\\
x'
.
sprintf
(
'%02x'
,
$c
));
}
}
echo
"
\n
"
;
}
function
special
(
$x
)
{
return
chr
(
27
).
'[7m'
.
$x
.
chr
(
27
).
'[m'
;
}
function
under
(
$x
)
{
return
chr
(
27
).
'[31m'
.
chr
(
27
).
'[4m'
.
$x
.
chr
(
27
).
'[m'
.
chr
(
27
).
'[39m'
;
}
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/3t/hn/wss2vrdqlhebaehw
Default Alt Text
icat.php (896 B)
Attached To
Mode
P844 icat.php
Attached
Detach File
Event Timeline
Log In to Comment