📄 dump_netiftab.c
字号:
/* * Roadrunner/pk * Copyright (C) 1989-2001 Cornfed Systems, Inc. * * The Roadrunner/pk operating system is free software; you can * redistribute and/or modify it under the terms of the GNU General * Public License, version 2, as published by the Free Software * Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * More information about the Roadrunner/pk operating system of * which this file is a part is available on the World-Wide Web * at: http://www.cornfed.com. * */#include <net/netif.h>#include <stdio.h>#include <string.h>#include <sys/intr.h>#include <fs/dump.h>#define NETIF_HDR "state ipaddr mask hwaddr"voiddump_netiftab(char *s){ char s1[32]; int i, len; sprintf(s, "%s\n", NETIF_HDR); s += strlen(NETIF_HDR) + 1; disable; if (netif_primary.state == NETIF_STATE_UP) sprintf(s, "up "); else sprintf(s, "down "); s += 7; if (netif_primary.ip == 0) { sprintf(s, "- "); s += 17; } else { ip2str(netif_primary.ip, s1); sprintf(s, s1); len = strlen(s1); s += len; for (i = 0; i < 17 - len; i++) sprintf(s++, " "); } if (netif_primary.mask == 0) { sprintf(s, "- "); s += 17; } else { ip2str(netif_primary.mask, s1); sprintf(s, s1); len = strlen(s1); s += len; for (i = 0; i < 17 - len; i++) sprintf(s++, " "); } if (netif_primary.state != NETIF_STATE_UP) sprintf(s, "-\n"); else { ether2str(netif_primary.hwaddr, s1); sprintf(s, "%s\n", s1); } enable;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -