-static const char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.9 2004-05-13 15:03:58 hadaq Exp $";
+static const char rcsId[] = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/allParam/rpc/rpcParam.c,v 1.10 2004-05-24 12:07:33 muench Exp $";
#define _POSIX_C_SOURCE 199509L
#if HAVE_CONFIG_H
int retVal = 0;
RpcParam *rpcParam;
char *server;
+ int row = 0;
+ int i = 0;
+ struct utsname bufferS, *buffer = &bufferS;
my->strerror = NULL;
my->specParam = rpcParam;
+ my->basedir = malloc(PARAM_MAX_VALUE_LEN);
+ uname(buffer);
+ while (buffer->nodename[i]) {
+ if (!isalnum(buffer->nodename[i])) {
+ buffer->nodename[i] = '_';
+ }
+ i++;
+ }
+ if (Param_getString
+ (my, buffer->nodename, "basedir", &row, my->basedir)
+ || (row != 1)) {
+ if (Param_getString(my, "glob", "basedir", &row, my->basedir)
+ || (row != 1)) {
+ strcpy(my->basedir, "");
+ }
+ }
+ if ((NULL != my->basedir) && strlen(my->basedir)) {
+ strcat(my->basedir, "/");
+ }
+
return retVal;
}
return res.ret;
}
-int Param_getFilename(const Param * my, const char *name, const char *idx, int *row, char *val)
+int Param_getFilename(const Param *my, const char *name, const char *idx,
+ int *row, char *val)
{
- RpcParam *rpcParam = my->specParam;
-
- GetScalarArgs args;
- GetStringRes res;
-
- args.param = rpcParam->remParam;
- args.name = name;
- args.idx = idx;
-
- res = *getfilename_1(&args, rpcParam->cl);
-
- *row = res.rows;
- strcpy(val, res.value);
-
- xdr_free(xdr_GetStringRes, &res);
+ int retVal = 0;
+ int rows = 0;
+ char value[PARAM_MAX_VALUE_LEN];
- return res.ret;
+ if (((retVal = Param_getString(my, name, idx, &rows, value)) == 0)
+ && (rows == 1)) {
+ if (value[0] == '/') {
+ strcpy(val, value);
+ } else {
+ strcpy(val, my->basedir);
+ strcat(val, value);
+ }
+ *row = 1;
+ } else {
+ *row = 0;
+ }
+ return retVal;
}
int Param_getIntArray(const Param * my, const char *name, const char *idx, int maxrows, int *rows, unsigned long int *val)
return res.ret;
}
-int Param_getFilenameArray(const Param * my, const char *name, const char *idx, int maxrows, int *rows, char **val)
+int Param_getFilenameArray(const Param *my, const char *name,
+ const char *idx, int maxrows, int *rows,
+ char **val)
{
- RpcParam *rpcParam = my->specParam;
-
- GetArrayArgs args;
- GetStringArrayRes res;
-
+ int retVal = 0;
int i;
+ char *value[PARAM_MAX_ARRAY_LEN];
- args.param = rpcParam->remParam;
- args.name = name;
- args.idx = idx;
- args.maxrows = maxrows;
-
- res = *getfilenamearray_1(&args, rpcParam->cl);
+ for (i = 0; i < maxrows; i++) {
+ value[i] = malloc(PARAM_MAX_VALUE_LEN);
+ }
- *rows = res.value.value_len;
- for (i = 0; i < res.value.value_len; i++) {
- strcpy(val[i], res.value.value_val[i]);
+ if (((retVal =
+ Param_getStringArray(my, name, idx, maxrows, rows, value)) == 0)
+ && (*rows > 0)) {
+ for (i = 0; i < *rows; i++) {
+ if (value[i][0] != '/') {
+ strcpy(val[i], my->basedir);
+ strcat(val[i], value[i]);
+ } else {
+ strcpy(val[i], value[i]);
+ }
+ }
+ } else {
+ *rows = 0;
}
- xdr_free(xdr_GetStringRes, &res);
+ for (i = 0; i < maxrows; i++) {
+ free(value[i]);
+ }
- return res.ret;
+ return retVal;
}
int Param_getBlob(const Param * my, const char *name, const char *idx, size_t * size, FILE ** val)