summaryrefslogtreecommitdiffstats
path: root/exim_monitor/em_text.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:16:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:16:13 +0000
commite90fcc54809db2591dc083f43ef54c6ec8c60847 (patch)
treef20bc206c3c2d5d59d37c46c5cf5d53a20642556 /exim_monitor/em_text.c
parentInitial commit. (diff)
downloadexim4-e90fcc54809db2591dc083f43ef54c6ec8c60847.tar.xz
exim4-e90fcc54809db2591dc083f43ef54c6ec8c60847.zip
Adding upstream version 4.96.upstream/4.96upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'exim_monitor/em_text.c')
-rw-r--r--exim_monitor/em_text.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/exim_monitor/em_text.c b/exim_monitor/em_text.c
new file mode 100644
index 0000000..3a36829
--- /dev/null
+++ b/exim_monitor/em_text.c
@@ -0,0 +1,73 @@
+/*************************************************
+* Exim Monitor *
+*************************************************/
+
+/* Copyright (c) University of Cambridge 1995 - 2012 */
+/* See the file NOTICE for conditions of use and distribution. */
+
+
+#include "em_hdr.h"
+
+
+/* This module contains functions for displaying text in a
+text widget. It is not used for the log widget, because that
+is dynamically updated and has special scrolling requirements. */
+
+
+/* Count of characters displayed */
+
+static int text_count = 0;
+
+
+/*************************************************
+* Empty the widget *
+*************************************************/
+
+void text_empty(Widget w)
+{
+XawTextBlock b;
+b.firstPos = 0;
+b.ptr = CS &b;
+b.format = FMT8BIT;
+b.length = 0;
+XawTextReplace(w, 0, text_count, &b);
+text_count = 0;
+XawTextSetInsertionPoint(w, text_count);
+}
+
+
+
+/*************************************************
+* Display text *
+*************************************************/
+
+void text_show(Widget w, uschar *s)
+{
+XawTextBlock b;
+b.firstPos = 0;
+b.ptr = CS s;
+b.format = FMT8BIT;
+b.length = Ustrlen(s);
+XawTextReplace(w, text_count, text_count, &b);
+text_count += b.length;
+XawTextSetInsertionPoint(w, text_count);
+}
+
+
+/*************************************************
+* Display text from format *
+*************************************************/
+
+void text_showf(Widget w, char *s, ...) PRINTF_FUNCTION(2,3);
+
+void text_showf(Widget w, char *s, ...)
+{
+va_list ap;
+uschar buffer[1024];
+va_start(ap, s);
+vsprintf(CS buffer, s, ap);
+va_end(ap);
+text_show(w, buffer);
+}
+
+/* End of em_text.c */