From 5faea1e62c8de68270683d4a7023e5178afe144b Mon Sep 17 00:00:00 2001 From: vida Date: Fri, 12 May 2006 12:53:37 +0000 Subject: [PATCH] Use DC_getClientCfgStr to get client informations git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@552 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/local/rm.c | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/dcapi/local/rm.c b/dcapi/local/rm.c index c3958e1e89..07379a82cc 100644 --- a/dcapi/local/rm.c +++ b/dcapi/local/rm.c @@ -86,9 +86,6 @@ DC_Workunit *DC_createWU(const char *clientName, const char *arguments[], { char uuid_str[37]; DC_Workunit *wu; - char *p; - char *clientStr; - const char *cfgval; if (subresults > MAX_SUBRESULTS){ DC_log(LOG_ERR, "DC_createWU: The given subresult number: %d is too high. (max:%d)", @@ -134,37 +131,21 @@ DC_Workunit *DC_createWU(const char *clientName, const char *arguments[], return NULL; } - clientStr = g_strdup_printf("client-%s-linux", clientName); - cfgval = DC_getCfgStr(clientStr); + wu->client_name = DC_getClientCfgStr(clientName, "name", FALSE); + wu->client_path = DC_getClientCfgStr(clientName, "path", FALSE); - if (!cfgval) + if (!wu->client_name || !wu->client_path) { - DC_log(LOG_ERR, "Failed to create WU. Unknown client name: %s", clientName); - DC_log(LOG_ERR, "Define client application in the config file: client-%s-linux", clientName); + DC_log(LOG_ERR, "Failed to create WU. Cannot find client name\n" + "Define client application in the config file:\n" + "[Client-%s]\nname = \npath = ", clientName); DC_destroyWU(wu); - g_free(clientStr); return NULL; } - p = strrchr(cfgval, '/'); - if (p == NULL) - { - wu->client_name = g_strdup(cfgval); - wu->client_path = g_strdup("."); - } - else - { - wu->client_path = g_strdup(cfgval); - wu->client_path[strlen(wu->client_path)-strlen(p)] = 0; - p++; - wu->client_name = g_strdup(p); - } - DC_log(LOG_DEBUG, "client path: %s, client name: %s from client: %s", wu->client_path, wu->client_name, clientName); - g_free(clientStr); - if (!wu_table) wu_table = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);