summaryrefslogtreecommitdiff
path: root/shell/bin/cat.php
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 11:29:44 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2011-11-27 11:29:44 -0500
commitde5cb6329b4e6a4c409d1418f16a3488a53ca953 (patch)
tree3a5af4ef0fd42e4f4904326d2cc94d53582e028e /shell/bin/cat.php
parent76ead734626996f82caddaca57dc2f84243b0947 (diff)
This is what was deployed on the lnns serverHEADmaster
Diffstat (limited to 'shell/bin/cat.php')
-rw-r--r--shell/bin/cat.php37
1 files changed, 22 insertions, 15 deletions
diff --git a/shell/bin/cat.php b/shell/bin/cat.php
index 8778f22..8376ca0 100644
--- a/shell/bin/cat.php
+++ b/shell/bin/cat.php
@@ -1,15 +1,22 @@
-<?php
-class p_cat extends prog {
- public static function main($args, $env) {
- $me = array_shift($args);
- if (count($args)==0) { $args = array('-'); }
- foreach ($args as $file) {
- if ( ($file=='-') || ($file=='/dev/stdin') ) {
- echo $_POST['stdin'];
- } else {
- echo htmlentities(file_get_contents($file));
- }
- }
- }
-}
-
+<?php
+class p_cat extends prog {
+ public static function main($args, $env) {
+ $me = array_shift($args);
+ $raw = (isset($args[0])?($args[0]=='-r'):false);
+ if ($raw) {
+ array_shift($args);
+ }
+ if (count($args)==0) { $args = array('-'); }
+ foreach ($args as $file) {
+ if ( ($file=='-') || ($file=='/dev/stdin') ) {
+ echo $_POST['stdin'];
+ } else {
+ if ($raw) {
+ echo file_get_contents($file);
+ } else {
+ echo htmlentities(file_get_contents($file));
+ }
+ }
+ }
+ }
+}