KwikTeam/KlustaKwik/param.c
/* returns 1 if the parameter was found and changed, else zero. */
returns 1 if the parameter was found and changed, else zero.
returns 1 if the parameter was found and changed else zero .
int change_param(char *name, char *value)
{
	entry *e;
	int changed = 0;
	for(e=bottom; e; e = e->next) if (!strcmp(name, e->name)) {
		switch (e->t) {
		case FLOAT:
			*((float *) e->addr) = atof(value); break;
		case INT: 
			*((int *) e->addr) = atoi(value); break;
		case BOOLEAN: 
			if (*value == '0')
				*((char *) e->addr) = 0;
			else
				*((char *) e->addr) = 1;
			break;
		case STRING: 
			strncpy((char *)e->addr, value, STRLEN); break;
		}
		changed = 1;
		break;
	}
	return changed;
}
int change_param ( char * name , char * value ) { entry * e ; int changed = 0 ; for ( e = bottom ; e ; e = e -> next ) if ( ! strcmp ( name , e -> name ) ) { switch ( e -> t ) { case FLOAT : * ( ( float * ) e -> addr ) = atof ( value ) ; break ; case INT : * ( ( int * ) e -> addr ) = atoi ( value ) ; break ; case BOOLEAN : if ( * value == ' ' ) * ( ( char * ) e -> addr ) = 0 ; else * ( ( char * ) e -> addr ) = 1 ; break ; case STRING : strncpy ( ( char * ) e -> addr , value , STRLEN ) ; break ; } changed = 1 ; break ; } return changed ; }
returns 1 if the parameter was found and changed, else zero.
returns 1 if the parameter was found and changed else zero .