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