summaryrefslogtreecommitdiff
path: root/blasource.php
diff options
context:
space:
mode:
Diffstat (limited to 'blasource.php')
-rw-r--r--blasource.php28
1 files changed, 21 insertions, 7 deletions
diff --git a/blasource.php b/blasource.php
index 5ae752b..87c0872 100644
--- a/blasource.php
+++ b/blasource.php
@@ -5,10 +5,11 @@
// Version History
// 0.0.1 Created blasource.php
- // 0.0.2 Added -l option for listing for sources.
- // 0.0.3 Fixed -l option for listing for sources.
+ // 0.1.0 Added -l option for listing for sources.
+ // 0.1.1 Fixed -l option for listing for sources.
+ // 0.1.2 Checked -l page number to see if there are any results.
- $version = "BlaSource Version: 0.0.3";
+ $version = "BlaSource Version: 0.1.2";
// get the input
$stdin = read_stdin();
@@ -20,16 +21,29 @@
switch ($stdin[$i])
{
case "-l":
+ $last = str_replace(":", "",exec("grep -n \"\" blasource.txt | tail -n 1")) / 5 + 1;
+ $look = 0;
if(!isset($stdin[$i+1]))
{
- $n = 1;
+ $look = 1;
}
else
{
- $n=$stdin[$i+1];
- $i++;
+ if($stdin[$i+1] > $last)
+ {
+ echo "No more source found.";
+ $i++;
+ break;
+ }
+ else
+ {
+ $look = $stdin[$i+1];
+ $i++;
+ }
}
- $X = ($n*5)-5;
+
+
+ $X = ($look*5)-5;
for($j=0;$j<5;$j++)
{
$bla = $j+$X;