summaryrefslogtreecommitdiff
path: root/shell/bin/cat.php
diff options
context:
space:
mode:
Diffstat (limited to 'shell/bin/cat.php')
-rw-r--r--shell/bin/cat.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/shell/bin/cat.php b/shell/bin/cat.php
index fab9883..8778f22 100644
--- a/shell/bin/cat.php
+++ b/shell/bin/cat.php
@@ -1,7 +1,15 @@
<?php
-function main($args) {
- $me = array_shift($args);
- foreach ($args as $file) {
- echo htmlentities(file_get_contents($file));
+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));
+ }
+ }
}
}
+