ethere2a.c
来自「操作系统源代码」· C语言 代码 · 共 51 行
C
51 行
/* $Id: ethere2a.c,v 2.1 89/10/23 15:42:28 dupuy Exp $ *//* This file was part of the etherlib package. */#include <stdio.h>#ifdef _MINIX#include <sys/types.h>#include <stdlib.h>#include <net/gen/ether.h>#include <net/gen/if_ether.h>#define ETHERSTRLEN 18 /* max length of "xx:xx:xx:xx:xx:xx" */#define ether_addr ether_addr_t#define bytes ea_addrchar *ether_e2a _ARGS(( ether_addr_t *a, char *e ));#else#include "libether.h"#endifchar *ether_e2a (addr, estring)ether_addr *addr;char *estring;{#ifdef lint char *sprintf ();#endif if (estring == NULL) estring = (char *) malloc (ETHERSTRLEN); if (estring != NULL) (void) sprintf (estring, "%x:%x:%x:%x:%x:%x", addr->bytes[0], addr->bytes[1], addr->bytes[2], addr->bytes[3], addr->bytes[4], addr->bytes[5]); return (estring);}#ifndef ETHERDBchar *ether_ntoa (addr)ether_addr *addr;{ static char estring[ETHERSTRLEN]; return (ether_e2a (addr, estring));}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?