#!/usr/bin/php $arg) { if (strpos($arg, "--fd") !== false) unset($argv[$i]) ; if ($arg == "-o") { unset($argv[$i]);unset($argv[$i+1]); } } # Check if options file exists. Each option should be on a new line. if (is_file($file)) $options = explode("\n",file_get_contents($file)) ; else $options = ['--syslog','--inode-file-handles=mandatory','--announce-submounts']; if (isset($argoptions['fd'])) { $options[] = "--fd=".$argoptions['fd']; } if (isset($argoptions['o'])) { $virtiofsoptions = explode(',',$argoptions["o"]); foreach ($virtiofsoptions as $opt) { $optsplit = explode('=',$opt); switch ($optsplit[0]) { case "source": $options[] = "--shared-dir={$optsplit[1]}"; break; case "cache": $options[] = "--cache=never"; break; case "xattr": $options[] = "--xattr"; break; case "sandbox": $options[] = "--sandbox={$optsplit[1]}"; break; } } } $newargs = array_merge($options,$argv); foreach($newargs as $arg) { if ($arg != "") $whole_cmd.= escapeshellarg($arg).' '; } echo trim($whole_cmd); ?>