From 846aa6b46f19fe7167dd8e1689229ed85c9bc9a4 Mon Sep 17 00:00:00 2001 From: gombasg Date: Wed, 5 Apr 2006 14:38:18 +0000 Subject: [PATCH] Implement getMaxSubresults() git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@421 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/boinc/client.C | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dcapi/boinc/client.C b/dcapi/boinc/client.C index 5f36087255..0368835280 100644 --- a/dcapi/boinc/client.C +++ b/dcapi/boinc/client.C @@ -41,17 +41,28 @@ int DC_getMaxMessageSize(void) return MAX_MESSAGE_SIZE; } +/* Determine the number of allowed subresults by counting all output files + * that have a name starting with SUBRESULT_PFX */ int DC_getMaxSubresults(void) { - /* XXX Return the actually defined subresults */ - return 10; + struct dirent *d; + int nsubs; + DIR *dir; + + dir = opendir("."); + if (!dir) + return 0; + nsubs = 0; + while ((d = readdir(dir))) + if (!strncasecmp(d->d_name, SUBRESULT_PFX, strlen(SUBRESULT_PFX))) + nsubs++; + return nsubs; } DC_GridCapabilities DC_getGridCapabilities(void) { - /* XXX Add DC_GC_SUBRESULT when it is implemented */ return (DC_GridCapabilities)(DC_GC_EXITCODE | DC_GC_STDERR | - DC_GC_MESSAGING); + DC_GC_SUBRESULT | DC_GC_MESSAGING); } /********************************************************************