~ubuntu-branches/ubuntu/natty/iptraf/natty-proposed

« back to all changes in this revision

Viewing changes to support/txbox.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2006-10-15 13:34:14 UTC
  • mfrom: (1.1.2 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061015133414-77itbhydih1z3amr
* Sync with Ubuntu fixes (by Oliver Grawert and Michael Vogt)
  * added fix for /var/run detection (since it is a tmpfs by default on
    Ubuntu) [and fixed ubuntu fix]
  * added support for ath devices
  * fixed FTBFS by changing linux/if_tr.h to netinet/if_tr.h

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * txbox.c - custom window bordering routine for ncurses windows.
 
3
 *
 
4
 * Copyright (c) Gerard Paul Java 2002
 
5
 *
 
6
 * This function is written to address a strange symptom in ncurses 5.2, at
 
7
 *least on RedHat 7.3.  The border drawn by the box() macro (actually an alias
 
8
 * for a call to wborder()) no longer uses the color attributes set by
 
9
 * wattrset(). However, the addch() and wvline() functions still do.
 
10
 *
 
11
 * The tx_box function is a drop-in replacement for box().
 
12
 */
 
13
 
 
14
#include <curses.h>
 
15
 
 
16
void tx_box(WINDOW *win, int vline, int hline)
 
17
{
 
18
    int winwidth;
 
19
    int winheight;
 
20
    int i;
 
21
    
 
22
    scrollok(win, 0); 
 
23
    getmaxyx(win, winheight, winwidth);
 
24
    winheight--;
 
25
    winwidth--;
 
26
    
 
27
    mvwaddch(win, 0, 0, ACS_ULCORNER);
 
28
    mvwhline(win, 0, 1, hline, winwidth - 1);
 
29
    mvwaddch(win, 0, winwidth, ACS_URCORNER);
 
30
    
 
31
    for (i = 1; i < winheight; i++) {
 
32
        mvwaddch(win, i, 0, vline);
 
33
        mvwaddch(win, i, winwidth, vline);
 
34
    }
 
35
    
 
36
    mvwaddch(win, winheight, 0, ACS_LLCORNER);
 
37
    mvwhline(win, winheight, 1, hline, winwidth - 1);
 
38
    mvwaddch(win, winheight, winwidth, ACS_LRCORNER);
 
39
}