svn path=/trunk/boinc/; revision=26110

This commit is contained in:
David Anderson 2012-09-14 06:20:10 +00:00
parent cc13f2ee6f
commit 0a3e2fd553
1 changed files with 25 additions and 26 deletions

View File

@ -48,7 +48,9 @@ function handle_submit() {
} }
function handle_query() { function handle_query() {
global $argc,$argv; global $argc, $argv;
if ($argc != 3) usage();
$req->project = PROJECT; $req->project = PROJECT;
$req->authenticator = get_auth(); $req->authenticator = get_auth();
list($batches, $errmsg) = boinc_query_batches($req); list($batches, $errmsg) = boinc_query_batches($req);
@ -56,10 +58,7 @@ function handle_query() {
echo "Error: $errmsg\n"; echo "Error: $errmsg\n";
return; return;
} }
if($argv[2]!='all')$batch_id=$argv[2]; if ($argv[2] == 'all') {
else $batch_id=-1;
if($batch_id==-1){
foreach ($batches as $batch) { foreach ($batches as $batch) {
echo "batch $batch->id: "; echo "batch $batch->id: ";
switch ($batch->state) { switch ($batch->state) {
@ -69,20 +68,20 @@ function handle_query() {
case 4: echo "Retired\n"; break; case 4: echo "Retired\n"; break;
} }
} }
}else{ } else if (is_numeric($argv[2])) {
foreach ($batches as $batch) { foreach ($batches as $batch) {
if ($batch->id==$batch_id){ if ($batch->id==$batch_id) {
echo "batch $batch_id: "; echo "batch $batch_id: ";
switch ($batch->state) { switch ($batch->state) {
case 1: echo "In progress\n"; break; case 1: echo "In progress\n"; break;
case 2: echo "Completed\n"; break; case 2: echo "Completed\n"; break;
case 3: echo "Aborted\n"; break; case 3: echo "Aborted\n"; break;
case 4: echo "Retired\n"; break; case 4: echo "Retired\n"; break;
}//switch }
} //if }
}//foreach }
}//else }
}//query_batch() }
function handle_get_output() { function handle_get_output() {
global $argc, $argv; global $argc, $argv;