Nastrel pthread_mq
[mirrors/Programs.git] / php / skripty / grep.php
1 <?php
2
3 //READLINE
4 function readline($prompt="") {
5 echo $prompt;
6
7 $t = "";
8 $c = "";
9
10 while(1) {
11 $c = fread(STDIN, "1");
12 if ($c == "\n") { // && ($c == "\r") //May be later on oher systems
13 return $t;
14 } else {
15 $t = ($t.$c);
16 }
17 }
18
19 return $t;
20
21 }
22 //READLINE END
23
24 $find = readline("Co hledat: ");
25
26 while(1){
27 $pos = "";
28 $line = (" ".readline());
29 $pos = strpos($line, $find);
30 //echo($pos); //debug
31 if ($pos == "")
32 {} else { echo (trim($line)."\n"); }
33 }
34
35 ?>
This page took 0.379765 seconds and 4 git commands to generate.