FreeBSD/contrib/ntp/ntpdc/ntpdc.c
/*
 * host - set the host we are dealing with.
 */
set the host we are dealing with.
set the host we are dealing with .
static void
host(
	struct parse *pcmd,
	FILE *fp
	)
{
	int i;
	if (pcmd->nargs == 0) {
		if (havehost)
		    (void) fprintf(fp, "current host is %s\n", currenthost);
		else
		    (void) fprintf(fp, "no current host\n");
		return;
	}
	i = 0;
	if (pcmd->nargs == 2) {
		if (!strcmp("-4", pcmd->argval[i].string))
			ai_fam_templ = AF_INET;
		else if (!strcmp("-6", pcmd->argval[i].string))
			ai_fam_templ = AF_INET6;
		else {
			if (havehost)
				(void) fprintf(fp,
				    "current host remains %s\n", currenthost);
			else
				(void) fprintf(fp, "still no current host\n");
			return;
		}
		i = 1;
	}
	if (openhost(pcmd->argval[i].string)) {
		(void) fprintf(fp, "current host set to %s\n", currenthost);
	} else {
		if (havehost)
		    (void) fprintf(fp,
				   "current host remains %s\n", currenthost);
		else
		    (void) fprintf(fp, "still no current host\n");
	}
}
static void host ( struct parse * pcmd , FILE * fp ) { int i ; if ( pcmd -> nargs == 0 ) { if ( havehost ) ( void ) fprintf ( fp , " \n " , currenthost ) ; else ( void ) fprintf ( fp , " \n " ) ; return ; } i = 0 ; if ( pcmd -> nargs == 2 ) { if ( ! strcmp ( " " , pcmd -> argval [ i ] . string ) ) ai_fam_templ = AF_INET ; else if ( ! strcmp ( " " , pcmd -> argval [ i ] . string ) ) ai_fam_templ = AF_INET6 ; else { if ( havehost ) ( void ) fprintf ( fp , " \n " , currenthost ) ; else ( void ) fprintf ( fp , " \n " ) ; return ; } i = 1 ; } if ( openhost ( pcmd -> argval [ i ] . string ) ) { ( void ) fprintf ( fp , " \n " , currenthost ) ; } else { if ( havehost ) ( void ) fprintf ( fp , " \n " , currenthost ) ; else ( void ) fprintf ( fp , " \n " ) ; } }
host - set the host we are dealing with.
host - set the host we are dealing with .