]> git.ozlabs.org Git - ccan/blobdiff - web/staticall.php
tal/str: use tal/grab_file not grab_file in example.
[ccan] / web / staticall.php
index 3a6407ffb85aab2aaf0d277120147f5986f5bafc..e976406b3330a9082d20c5c5c69e38eca90869a9 100644 (file)
@@ -4,7 +4,7 @@ include('logo.html');
 include('menulist.html');
 include('static-configuration');
 
-$tarballsize=round((filesize($argv[2]."/ccan.tar.bz2") + 1023) / 1024);
+$tarballsize=round((filesize($argv[3]."/ccan.tar.bz2") + 1023) / 1024);
 ?>
 
 <h1> List of all CCAN modules: </h1>
@@ -16,7 +16,7 @@ download.
 </p>
 
 <p>
-Or you can just download the <a href="ccan.tar.bz2">tarball of everything (<?=$tarballsize?>K)</a>.
+Or you can just download the <a href="ccan.tar.bz2">tarball of everything including CCAN tools (<?=$tarballsize?>K)</a>.
 </p>
 
 <table align="center" width="80%" border="0" cellpadding="3" cellspacing="1">
@@ -25,21 +25,15 @@ Or you can just download the <a href="ccan.tar.bz2">tarball of everything (<?=$t
 <th align="right">Download</th>
 
 <?php 
-$d = dir($argv[1]);
-$modules = array();
-while (false !== ($entry = $d->read())) {
-       if ($entry[0] != '.') {
-               array_push($modules, $entry);
-       }
-}
+$modules = array_slice($argv, 4);
 sort($modules);
 
 foreach ($modules as $module) {
        $summary=extract_field('summary',$argv[1].$module);
        $with_deps="$tar_dir/with-deps/$module.tar.bz2";
        $no_deps="$tar_dir/$module.tar.bz2";
-       $with_dep_size = round((filesize($argv[2]."/".$with_deps) + 1023) / 1024);
-       $no_dep_size = round((filesize($argv[2]."/".$no_deps) + 1023) / 1024);
+       $with_dep_size = round((filesize($argv[3]."/".$with_deps) + 1023) / 1024);
+       $no_dep_size = round((filesize($argv[3]."/".$no_deps) + 1023) / 1024);
        ?>
        <tr>
          <td><?=$module?></td>
@@ -49,7 +43,6 @@ foreach ($modules as $module) {
        </tr>
        <?php
 }
-$d->close();
 ?>
 </table>
 
@@ -60,18 +53,19 @@ $d->close();
 <table align="center" width="80%" border="0" cellpadding="3" cellspacing="1">
 
 <?php
-$d = dir($argv[2]."/junkcode");
-$files = array();
+$d = dir($argv[2]);
+$dirs = array();
 while (false !== ($entry = $d->read())) {
        if ($entry[0] != '.') {
-               array_push($files, $entry);
+               array_push($dirs, $entry);
        }
 }
 
-sort($files);
-foreach ($files as $file) {
-       $size = round((filesize($argv[2]."/junkcode/".$file) + 1023) / 1024);
-       echo "<tr><td><a href=\"junkcode/$file\">$file (${size}K)</a></td><tr>\n";
+sort($dirs);
+foreach ($dirs as $dir) {
+       $size = round((filesize($argv[3]."/junkcode/".$dir.".tar.bz2") + 1023) / 1024);
+       echo "<tr><td><a href=\"junkcode/$dir.tar.bz2\">$dir.tar.bz2 (${size}K)</a></td>\n";
+       echo "<td><a href=\"junkcode/$dir.html\">Browse contents...</a></td><tr>\n";
 }
 $d->close();
 ?>