['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; $proc = proc_open($cmd, $descriptorspec, $pipes); list($stdin, $stdout, $stderr) = $pipes; fclose($stdin); // assumption: anything written to stderr will fit in the pipe buffer // nutrimatic only appears to write-then-exit, so It's Probably Fine while ($line = fscanf($stdout, "%s %[^\n]s\n")) { list($score, $text) = $line; if ($match_fn($score, $text)) { break; } } fclose($stdout); proc_terminate($proc); while ($err = fgets($stderr)) { $error_fn($err); } fclose($stderr); $retval = proc_close($proc); return $retval; } function index_name($file) { return preg_replace('/\.index$/', '', $file); } $index_files = glob("*.index"); $default_index = "enwiki-latest.index"; $selected_index = $default_index; foreach ($index_files as $file) { if (index_name($file) == $_GET['idx']) { $selected_index = $file; } } $q = $_GET['q'] ?: ""; $more = 0; $autofocus = 'autofocus '; if ($_GET['more']) { $more = (int)($_GET['more']); $autofocus = ''; } $max_more = 10; ?>
Hi I'm a Nutrimatic