2 disp_ncurses.c - Routines to do pretty ncurses output.
3 Copyright 2000 Project Purple. Written by Jonathan McDowell
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 http://www.gnu.org/copyleft/gpl.html
20 17/02/2000 - Started writing.
26 #include "disp_ncurses.h"
28 /* Which port did we display last? */
30 /* Count of chars so far this line */
31 static int wrap=WRAPINIT;
34 /* Initialise the display */
40 /* Close the display */
46 /* Output a status string about what's happening */
47 void disp_outputstatus(char *string)
49 printf("\n%s\n\t", string);
54 /* Output a string from the port. */
55 void disp_outputstr(int port, char *string,
56 long usec_threshold, long usec_waited)
58 if (usec_waited>usec_threshold) {
59 /* report how long we waited between the last port */
60 if (wrap!=WRAPINIT) printf("\n");
61 printf("\t<waited %0ld.%0ld seconds>\n",
68 /* If we didn't just send a CR, we need to now */
69 if (wrap!=WRAPINIT) printf("\n");
70 printf("\nPort%d:\t", port);
73 } else if (wrap==WRAPINIT) {
74 /* We should indent since we're continuing the same port
79 /* If we'd go over the line end, wrap */
80 if (strlen(string)+wrap > SCREEN_WIDTH) {
88 if (wrap % SCREEN_WIDTH == 0) {
89 /* we hit the edge of the screen */
94 /* flush all the time */