summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorRoland Mainz <roland.mainz@nrubsig.org>2005-04-11 01:06:15 +0000
committerRoland Mainz <roland.mainz@nrubsig.org>2005-04-11 01:06:15 +0000
commit33c2d047571cd4ebce2eb630515fc33aa3f05b98 (patch)
treedb36f40f732f2075f70f35983ca8603c88736368 /util.c
parentbd31ddba0725738848be8298a7b1dd691c103fa3 (diff)
xc/programs/Xserver/Xprint/attributes.cXORG-6_8_99_3
xc/programs/glxgears/glxgears.c xc/programs/xdbedizzy/xdbedizzy.c xc/programs/xedit/Imakefile xc/programs/xedit/Xedit-xprint.ad xc/programs/xedit/util.c xc/programs/xedit/xedit.h xc/programs/xlogo/print.c xc/programs/xlogo/xlogo.c xc/programs/xlogo/xlogo.h xc/programs/xman/Imakefile xc/programs/xman/print.h xc/programs/xmore/Imakefile xc/programs/xmore/print.c xc/programs/xmore/print.h xc/programs/xmore/printdialog.c xc/programs/xphelloworld/xpawhelloworld/xpawhelloworld.c xc/programs/xphelloworld/xphelloworld/xphelloworld.c xc/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld.c xc/programs/xphelloworld/xpxmhelloworld/xpxmhelloworld.c //bugs.freedesktop.org/show_bug.cgi?id=790) attachment #2379 (https://bugs.freedesktop.org/attachment.cgi?id=2379) Implement support client+Xserver support for passing output (stdout+stderr) of the spooler command started by the Xprint server back to the application using the "xp-spooler-command-results" XPJobAttr attribute (applications can fetch the attribute value after the XPEndJobNotify event was received; more details can be found in http://xprint.mozdev.org/docs/dtprint_fspec.ps).
Diffstat (limited to 'util.c')
-rw-r--r--util.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/util.c b/util.c
index 6e8c1d4..008792c 100644
--- a/util.c
+++ b/util.c
@@ -57,13 +57,41 @@ extern Widget scratch;
extern Widget vpanes[2], labels[3], texts[3], forms[3];
extern XawTextWrapMode wrapmodes[3];
+#ifndef va_copy
+# ifdef __va_copy
+# define va_copy __va_copy
+# else
+# error "no working va_copy was found"
+# endif
+#endif
+
/*
* Implementation
*/
void
-XeditPrintf(char *str)
+XeditPrintf(const char *format, ...)
{
- XawTextBlock text;
+ char *str;
+ size_t size;
+ va_list va,
+ va2;
+ XawTextBlock text;
+
+ va_start(va, format);
+
+ va_copy(va2, va);
+ size = vsnprintf(NULL, 0, format, va2);
+ va_end(va2);
+
+ str = (char *)malloc(size + 1);
+ if (str == NULL)
+ return;
+
+ vsnprintf(str, size + 1, format, va);
+ str[size] = 0;
+
+ va_end(va);
+
XawTextPosition pos = XawTextSourceScan(XawTextGetSource(messwidget),
0, XawstAll, XawsdRight, 1, True);
@@ -75,6 +103,8 @@ XeditPrintf(char *str)
XawTextReplace(messwidget, pos, pos, &text);
XawTextSetInsertionPoint(messwidget, pos + text.length);
+
+ free(str);
}
Widget