From c0970397c47af6b29926cd887e8eb52506ca411d Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 12 Feb 2016 17:04:57 +0100 Subject: call: Move statline() to make declaration unnecessary. Signed-off-by: Ralf Baechle --- call/call.c | 83 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) (limited to 'call') diff --git a/call/call.c b/call/call.c index 25dbe41..67dda49 100644 --- a/call/call.c +++ b/call/call.c @@ -140,7 +140,6 @@ static char inbuf[MAX_BUFLEN]; static int inbuflen, inbufwid; static char incharbuf[6]; static int incharbuflen; -static void statline(int mode, char *s); static void addscrollline(char *s, int len) { @@ -327,6 +326,47 @@ static void redrawscreen(t_win *win_in, int mode, t_win *win_out) checkcursor(mode); } +static void statline(int mode, char *s) +{ + static int oldlen = 0; + int l, cnt; + + if (*s == '\0') { + if (mode == RAWMODE) + return; + if (oldlen > 0) { + move(0, STATW_STAT); + attron(A_REVERSE); + for (cnt = STATW_STAT; cnt < COLS; cnt++) + addch(' '); + oldlen = 0; + attroff(A_REVERSE); + refresh(); + } + return; + } + if (mode == RAWMODE) { + printf(">>%s\n", s); + fflush(stdout); + return; + } + if (COLS <= STATW_STAT) + return; + l = strlen(s); + if (l > COLS - STATW_STAT) + l = COLS-STATW_STAT; + + move(0, STATW_STAT); + + attron(A_REVERSE); + addnstr(s, l); + for (cnt = STATW_STAT+l;cnt < COLS;cnt++) + addch(' '); + attroff(A_REVERSE); + oldlen = l; + refresh(); +} + static void scrolltext(t_win *win_in, int lines, int mode, t_win *win_out) { int topline, storedlines; @@ -784,47 +824,6 @@ static void cmd_intr(int sig) interrupted = TRUE; } -static void statline(int mode, char *s) -{ - static int oldlen = 0; - int l, cnt; - - if (*s == '\0') { - if (mode == RAWMODE) - return; - if (oldlen > 0) { - move(0, STATW_STAT); - attron(A_REVERSE); - for (cnt = STATW_STAT; cnt < COLS; cnt++) - addch(' '); - oldlen = 0; - attroff(A_REVERSE); - refresh(); - } - return; - } - if (mode == RAWMODE) { - printf(">>%s\n", s); - fflush(stdout); - return; - } - if (COLS <= STATW_STAT) - return; - l = strlen(s); - if (l > COLS - STATW_STAT) - l = COLS-STATW_STAT; - - move(0, STATW_STAT); - - attron(A_REVERSE); - addnstr(s, l); - for (cnt = STATW_STAT+l;cnt < COLS;cnt++) - addch(' '); - attroff(A_REVERSE); - oldlen = l; - refresh(); -} - WINDOW *opnstatw(int mode, wint * wintab, char *s, int lines, int cols) { WINDOW *win; -- cgit v1.2.3