Ejemplo n.º 1
0
void sec_poll ( int pollflag ) {
	
	int msglen,f,q;
	char retbuf[140],*n,*r;
  
	 
  for (q=0; q<SEC_QUERYLIST_LEN; q++) {
	if (sec_querylist[q].command == NULL) break;
        if (sec_querylist[q].pollflag != pollflag) continue;
	msglen = 0;
 	sec_cmd(SEC_POLLCMD, sec_querylist[q].command, retbuf, &msglen);
	r = retbuf;
        *(r+msglen) = '\0';
	for (f=0; f<SEC_MAXFIELDS; f++) {
	    n = strchr(r, ',');
	   if (n != NULL) *n = '\0';
           if (sqv(q,f) > 0) {
	     
	   if (strcmp(sec_varlist[sqv(q,f)].value, r) != 0  ) {

		    snprintf(sec_varlist[sqv(q,f)].value, 
			sizeof(sec_varlist[sqv(q,f)].value), "%s", r);
                  
		    sec_setinfo(sqv(q,f), r);
		}
		
	/* If SEC VAR is alarm and its on, add it to the alarm property */
	
	if (sec_varlist[sqv(q,f)].flags & FLAG_ALARM && strcmp(r,"1")== 0) {
           alarm_set(sec_varlist[sqv(q,f)].name);  }
           
	  }
	   
	    
	   if (n == NULL) break;
	   r = n+1;
	}
	}

 }
Ejemplo n.º 2
0
double Vect2::norm() const {
	return sqrt_safe(sqv());
}