Copyright year updates (things touched in 2015)
[exim.git] / src / exim_monitor / em_text.c
CommitLineData
059ec3d9
PH
1/*************************************************
2* Exim Monitor *
3*************************************************/
4
c4ceed07 5/* Copyright (c) University of Cambridge 1995 - 2012 */
059ec3d9
PH
6/* See the file NOTICE for conditions of use and distribution. */
7
8
9#include "em_hdr.h"
10
11
12/* This module contains functions for displaying text in a
13text widget. It is not used for the log widget, because that
14is dynamically updated and has special scrolling requirements. */
15
16
17/* Count of characters displayed */
18
19static int text_count = 0;
20
21
22/*************************************************
23* Empty the widget *
24*************************************************/
25
26void text_empty(Widget w)
27{
28XawTextBlock b;
29b.firstPos = 0;
30b.ptr = CS &b;
31b.format = FMT8BIT;
32b.length = 0;
33XawTextReplace(w, 0, text_count, &b);
34text_count = 0;
35XawTextSetInsertionPoint(w, text_count);
36}
37
38
39
40/*************************************************
41* Display text *
42*************************************************/
43
44void text_show(Widget w, uschar *s)
45{
46XawTextBlock b;
47b.firstPos = 0;
48b.ptr = CS s;
49b.format = FMT8BIT;
50b.length = Ustrlen(s);
51XawTextReplace(w, text_count, text_count, &b);
52text_count += b.length;
53XawTextSetInsertionPoint(w, text_count);
54}
55
56
57/*************************************************
58* Display text from format *
59*************************************************/
60
e0df1c83
DM
61void text_showf(Widget w, char *s, ...) PRINTF_FUNCTION(2,3);
62
059ec3d9
PH
63void text_showf(Widget w, char *s, ...)
64{
65va_list ap;
66uschar buffer[1024];
67va_start(ap, s);
68vsprintf(CS buffer, s, ap);
69va_end(ap);
70text_show(w, buffer);
71}
72
73/* End of em_text.c */