From 96b619cc129afed52411b9fad3407037a1cb7207 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 02:47:26 +0200 Subject: Adding upstream version 4.92. Signed-off-by: Daniel Baumann --- exim_monitor/em_text.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 exim_monitor/em_text.c (limited to 'exim_monitor/em_text.c') 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 */ -- cgit v1.2.3