Exemplo n.º 1
0
int thPutList(int handle, CLIENT *clnt)
#endif
/* Returns 0 for total success, -1 for total failure, a positive number
for the number of variables that didn't work */
{
    thNameList *list;
    thNameNode *next,*this;
    int i;
    WVALLIST vals;
    int nerrors;
#ifdef BIT64
    CLIENT *clnt;

    clnt = clnt_list[client-1];
#endif

    /* Create the write structure */
#ifdef BIT64
    list = (thNameList *) handle_list[handle-1];
#else
    list = (thNameList *) handle;
#endif
    /*  printf("list->nnames=%d\n",list->nnames);*/
    if(!list->rpc_made) {
        if(list->rpc.NAMELIST_len == 0) {
            list->rpc.NAMELIST_len = list->nnames;
            list->rpc.NAMELIST_val = (char **) malloc(list->rpc.NAMELIST_len
                                     *sizeof(char *));
        } else if (list->rpc.NAMELIST_len != list->nnames) {
            list->rpc.NAMELIST_len = list->nnames;
            list->rpc.NAMELIST_val = (char **)
                                     realloc(list->rpc.NAMELIST_val,list->rpc.NAMELIST_len*sizeof(char *));
        }
        this = list->namehead;
        for(i=0; (i<list->nnames && this); i++) {
            list->rpc.NAMELIST_val[i] = this->name;
            this = this->next;
        }
    }
    nerrors = 0;
    if(vals = davar_readmultiple_1(&(list->rpc),clnt)) {
        this = list->namehead;
        /*    printf("list->rpc.NAMELIST_len=%d\n",list->rpc.NAMELIST_len);*/
        for(i=0; (i<list->rpc.NAMELIST_len && this); i++) {
            /*      printf("%s\n",this->name);*/
            if(vals->RVALLIST_val[i].valtype != DAVARERROR_RPC) {
                if(daVarWriteVar(this->name,&(vals->RVALLIST_val[i])) != S_SUCCESS)
                    nerrors++;
            } else {
                nerrors++;
            }
            this = this->next;
        }
    } else {
        nerrors = -1;
    }
    return(nerrors);
}
Exemplo n.º 2
0
RVALLIST *davar_readmultiple_1_svc(NAMELIST *argp, struct svc_req *svc)
{
    CLIENT *clnt;
    return(davar_readmultiple_1(argp,clnt));
}