From 3fbb3dad7861871a5d1c583c453a50ae6f7264ce Mon Sep 17 00:00:00 2001 From: myvesta <38690722+myvesta@users.noreply.github.com> Date: Sat, 15 Apr 2023 16:38:53 +0200 Subject: [PATCH] myvesta php replacement for gnu 'sed' (but without regular expression) --- func/bash-to-php-interpreter.php | 3 +++ func/main.php | 20 ++++++++++++-------- func/string.php | 26 +++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/func/bash-to-php-interpreter.php b/func/bash-to-php-interpreter.php index baf9475e..09c9c499 100644 --- a/func/bash-to-php-interpreter.php +++ b/func/bash-to-php-interpreter.php @@ -29,11 +29,13 @@ if (!function_exists($func)) { $insert_stdin_at_position=false; if ($func=="myvesta_grep") $insert_stdin_at_position=1; +if ($func=="myvesta_sed") $insert_stdin_at_position=2; $params=array(); $added=0; $stdin_content=''; +$myvesta_stdin_from_file=''; $myvesta_stdin_return_not_found=false; if ($myvesta_stdin!='' && $insert_stdin_at_position===false) {$params[]=$myvesta_stdin; $added++;} @@ -51,6 +53,7 @@ if ($insert_stdin_at_position!=false) { $myvesta_stdin=''; } else { $myvesta_stdin=file_get_contents($file_or_stdin); + $myvesta_stdin_from_file=$file_or_stdin; } } if (isset($params[$insert_stdin_at_position])) array_splice($params, $insert_stdin_at_position, 0, array($myvesta_stdin)); diff --git a/func/main.php b/func/main.php index b521ea2e..967fb8fb 100644 --- a/func/main.php +++ b/func/main.php @@ -1,6 +1,7 @@