// Version History // 0.0.1 Created blasource.php // 0.0.2 Added -l option for listing for sources. $version = "BlaSource Version: 0.0.2"; // get the input $stdin = read_stdin(); $stdin = explode(" ", $stdin); $out = ""; $token = ""; for ($i=0 ; $i> blasource.txt"); $out = $name . ": " . $link . " added."; $i = sizeof($stdin); break; case "-v": $out = $version; $i = sizeof($stdin); break; case "-h": $out = "-h for help, -v for version, -new e.g. !source -new gentoo-portage someurl.html. To view source:just enter a token or e.g. !source gentoo-portage or !source gentoo portage"; $i = sizeof($stdin); break; default: for($j=$i;$j1) { if($parts[0] == $token) { $out = $parts[0] . ": " . $parts[1]; break; } $out = "No Source Found!"; } } fclose($file_handle); break; } } echo $out . "\n"; function read_stdin() { $fr=fopen("php://stdin","r"); // open our file pointer to read from stdin $input = fgets($fr,128); // read a maximum of 128 characters $input = rtrim($input); // trim any trailing spaces. fclose ($fr); // close the file handle return $input; // return the text entered } ?>