hgprint.c,v

来自「TCP-IP红宝书源代码」· C,V 代码 · 共 77 行

C,V
77
字号
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@ * @;


1.1
date	97.09.21.19.26.58;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* hgprint - hgprint */

#include <conf.h>
#include <kernel.h>
#include <network.h>
#include <igmp.h>

static	printone();

/*------------------------------------------------------------------------
 * hgprint - print the Host Group table on descriptor fd
 *------------------------------------------------------------------------
 */
hgprint(fd)
int	fd;
{
	struct hg	*phg;
	int		i;

	for (i=0; i<HG_TSIZE; ++i)
		printone(fd, &hgtable[i]);
	return OK;
}

char	*index();

/*------------------------------------------------------------------------
 * printone - print one entry in the Host Group table
 *------------------------------------------------------------------------
 */
static
printone(fd, phg)
int	fd;
struct	hg	*phg;
{
	char	line[128], *p;

	if (phg->hg_state == HGS_IDLE)
		strcpy(line, "IDLE ");
	else if (phg->hg_state == HGS_DELAYING)
		strcpy(line, "DELAYING ");
	else
		return OK;
	p = index(line, '\0');

	ip2dot(p, phg->hg_ipa);
	p = index(p, '\0');

	sprintf(p, " intf %d refs %d IPttl %d\n", phg->hg_ifnum,
		phg->hg_refs, phg->hg_ttl);
	return write(fd, line, strlen(line));
}
@

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?