ethera2n.c

来自「minix操作系统最新版本(3.1.1)的源代码」· C语言 代码 · 共 43 行

C
43
字号
/*ethera2n.cConvert an ASCII string with an ethernet address into a struct ether_addr.Created:	Nov 17, 1992 by Philip Homburg*/#include <sys/types.h>#include <stdlib.h>#include <net/netlib.h>#include <net/gen/ether.h>#include <net/gen/if_ether.h>struct ether_addr *ether_aton(s)_CONST char *s;{	static struct ether_addr ea;	int i;	long v;	char *check;	if (s == NULL)		return NULL;	for (i=0; i<6; i++)	{		v= strtol(s, &check, 16);		if (v<0 || v>255)			return NULL;		if ((i<5 && check[0] != ':') || (i == 5 && check[0] != '\0'))			return NULL;		ea.ea_addr[i]= v;		s= check+1;	}	return &ea;}/* * $PchId: ethera2n.c,v 1.3 1996/02/22 21:10:01 philip Exp $ */

⌨️ 快捷键说明

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