ifstat.c (126775) | ifstat.c (158160) |
---|---|
1/* 2 * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTIFSTAT_ERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * | 1/* 2 * Copyright (c) 2003, Trent Nelson, <trent@arpa.com>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTIFSTAT_ERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/usr.bin/systat/ifstat.c 126775 2004-03-09 11:57:28Z dwmalone $ | 28 * $FreeBSD: head/usr.bin/systat/ifstat.c 158160 2006-04-30 04:26:46Z bde $ |
29 */ 30 31#include <sys/types.h> 32#include <sys/socket.h> 33#include <sys/sysctl.h> 34#include <sys/time.h> 35#include <sys/queue.h> 36#include <net/if.h> --- 54 unchanged lines hidden (view full) --- 91static u_int getifnum(void); 92 93#define IFSTAT_ERR(n, s) do { \ 94 putchar(''); \ 95 closeifstat(wnd); \ 96 err((n), (s)); \ 97} while (0) 98 | 29 */ 30 31#include <sys/types.h> 32#include <sys/socket.h> 33#include <sys/sysctl.h> 34#include <sys/time.h> 35#include <sys/queue.h> 36#include <net/if.h> --- 54 unchanged lines hidden (view full) --- 91static u_int getifnum(void); 92 93#define IFSTAT_ERR(n, s) do { \ 94 putchar(''); \ 95 closeifstat(wnd); \ 96 err((n), (s)); \ 97} while (0) 98 |
99#define STARTING_ROW (8) 100#define ROW_SPACING (3) 101 102#define TOPLINE 5 | 99#define TOPLINE 3 |
103#define TOPLABEL \ 104" Interface Traffic Peak Total" 105 | 100#define TOPLABEL \ 101" Interface Traffic Peak Total" 102 |
103#define STARTING_ROW (TOPLINE + 1) 104#define ROW_SPACING (3) 105 |
|
106#define CLEAR_LINE(y, x) do { \ 107 wmove(wnd, y, x); \ 108 wclrtoeol(wnd); \ 109} while (0) 110 111#define IN_col2 (ifp->if_in_curtraffic) 112#define OUT_col2 (ifp->if_out_curtraffic) 113#define IN_col3 (ifp->if_in_traffic_peak) --- 34 unchanged lines hidden (view full) --- 148 mvprintw(p->if_ypos, col2-3, "%s", (const char *)"in"); \ 149 mvprintw(p->if_ypos+1, col2-3, "%s", (const char *)"out"); \ 150} while (0) 151 152 153WINDOW * 154openifstat(void) 155{ | 106#define CLEAR_LINE(y, x) do { \ 107 wmove(wnd, y, x); \ 108 wclrtoeol(wnd); \ 109} while (0) 110 111#define IN_col2 (ifp->if_in_curtraffic) 112#define OUT_col2 (ifp->if_out_curtraffic) 113#define IN_col3 (ifp->if_in_traffic_peak) --- 34 unchanged lines hidden (view full) --- 148 mvprintw(p->if_ypos, col2-3, "%s", (const char *)"in"); \ 149 mvprintw(p->if_ypos+1, col2-3, "%s", (const char *)"out"); \ 150} while (0) 151 152 153WINDOW * 154openifstat(void) 155{ |
156 return (subwin(stdscr, LINES-1-5, 0, 5, 0)); | 156 return (subwin(stdscr, LINES-3-1, 0, MAINWIN_ROW, 0)); |
157} 158 159void 160closeifstat(WINDOW *w) 161{ 162 struct if_stat *node = NULL; 163 164 while (!SLIST_EMPTY(&curlist)) { --- 248 unchanged lines hidden --- | 157} 158 159void 160closeifstat(WINDOW *w) 161{ 162 struct if_stat *node = NULL; 163 164 while (!SLIST_EMPTY(&curlist)) { --- 248 unchanged lines hidden --- |