Exemplo n.º 1
0
/* Insert client parameter
   return value:
	OC_NOERR => not already define; insertion performed
	OC_EINVAL => already defined
*/
OCerror
oc_clientparam_insert(OCconnection conn, const char* param, const char* value)
{
    OCstate* state;
    OCVERIFY(OCstate*,state,conn);
    OCDEREF(OCstate*,state,conn);

    return ocparaminsert(state->clientparams,param,value);
}
Exemplo n.º 2
0
/*
Replace new client param (name,value);
return value = 1 => replacement performed
               0 => insertion performed
*/
int
ocparamreplace(OClist* params, const char* clientparam, const char* value)
{
    int i;
    if(params == NULL || clientparam == NULL) return 0;
    for(i=0;i<oclistlength(params);i+=2) {
	char* name = (char*)oclistget(params,i);
	if(strcmp(clientparam,name)==0) {
	    oclistinsert(params,i+1,(ocelem)nulldup(value));
	    return 1;
	}
    }
    ocparaminsert(params,clientparam,value);
    return 0;
}