FreeBSD/contrib/ntp/ntpq/ntpq-subs.c
/*
 * writelist - send a write variables request with the variables on the list
 */
send a write variables request with the variables on the list
send a write variables request with the variables on the list
static void
writelist(
	struct parse *pcmd,
	FILE *fp
	)
{
	const char *datap;
	int res;
	associd_t associd;
	size_t dsize;
	u_short rstatus;
	if (pcmd->nargs == 0) {
		associd = 0;
	} else {
		if (pcmd->argval[0].uval == 0)
			associd = 0;
		else if ((associd = checkassocid(pcmd->argval[0].uval)) == 0)
			return;
	}
	res = doquerylist(g_varlist, CTL_OP_WRITEVAR, associd, 1, &rstatus,
			  &dsize, &datap);
	if (res != 0)
		return;
	if (numhosts > 1)
		(void) fprintf(fp, "server=%s ", currenthost);
	if (dsize == 0)
		(void) fprintf(fp, "done! (no data returned)\n");
	else {
		(void) fprintf(fp,"associd=%u ", associd);
		printvars(dsize, datap, (int)rstatus,
			  (associd != 0) ? TYPE_PEER : TYPE_SYS, 0, fp);
	}
	return;
}
static void writelist ( struct parse * pcmd , FILE * fp ) { const char * datap ; int res ; associd_t associd ; size_t dsize ; u_short rstatus ; if ( pcmd -> nargs == 0 ) { associd = 0 ; } else { if ( pcmd -> argval [ 0 ] . uval == 0 ) associd = 0 ; else if ( ( associd = checkassocid ( pcmd -> argval [ 0 ] . uval ) ) == 0 ) return ; } res = doquerylist ( g_varlist , CTL_OP_WRITEVAR , associd , 1 , & rstatus , & dsize , & datap ) ; if ( res != 0 ) return ; if ( numhosts > 1 ) ( void ) fprintf ( fp , " " , currenthost ) ; if ( dsize == 0 ) ( void ) fprintf ( fp , " \n " ) ; else { ( void ) fprintf ( fp , " " , associd ) ; printvars ( dsize , datap , ( int ) rstatus , ( associd != 0 ) ? TYPE_PEER : TYPE_SYS , 0 , fp ) ; } return ; }
writelist - send a write variables request with the variables on the list
writelist - send a write variables request with the variables on the list
/* HMS: Do we really want uval here? */