FreeBSD/contrib/ntp/ntpq/ntpq-subs.c
/*
 * dolist - send a request with the given list of variables
 */
send a request with the given list of variables
send a request with the given list of variables
static int
dolist(
	struct varlist *vlist,
	associd_t associd,
	int op,
	int type,
	FILE *fp
	)
{
	const char *datap;
	int res;
	size_t dsize;
	u_short rstatus;
	int quiet;
	if (old_rv)
		quiet = 0;
	else
		quiet = (vlist->name != NULL);
	res = doquerylist(vlist, op, associd, 0, &rstatus, &dsize, &datap);
	if (res != 0)
		return 0;
	if (numhosts > 1)
		fprintf(fp, "server=%s ", currenthost);
	if (dsize == 0) {
		if (associd == 0)
			fprintf(fp, "No system%s variables returned\n",
				(type == TYPE_CLOCK) ? " clock" : "");
		else
			fprintf(fp,
				"No information returned for%s association %u\n",
				(type == TYPE_CLOCK) ? " clock" : "",
				associd);
		return 1;
	}
	if (!quiet)
		fprintf(fp, "associd=%u ", associd);
	printvars(dsize, datap, (int)rstatus, type, quiet, fp);
	return 1;
}
static int dolist ( struct varlist * vlist , associd_t associd , int op , int type , FILE * fp ) { const char * datap ; int res ; size_t dsize ; u_short rstatus ; int quiet ; if ( old_rv ) quiet = 0 ; else quiet = ( vlist -> name != NULL ) ; res = doquerylist ( vlist , op , associd , 0 , & rstatus , & dsize , & datap ) ; if ( res != 0 ) return 0 ; if ( numhosts > 1 ) fprintf ( fp , " " , currenthost ) ; if ( dsize == 0 ) { if ( associd == 0 ) fprintf ( fp , " \n " , ( type == TYPE_CLOCK ) ? " " : " " ) ; else fprintf ( fp , " \n " , ( type == TYPE_CLOCK ) ? " " : " " , associd ) ; return 1 ; } if ( ! quiet ) fprintf ( fp , " " , associd ) ; printvars ( dsize , datap , ( int ) rstatus , type , quiet , fp ) ; return 1 ; }
dolist - send a request with the given list of variables
dolist - send a request with the given list of variables
/*
	 * if we're asking for specific variables don't include the
	 * status header line in the output.
	 */