aboutsummaryrefslogtreecommitdiff
path: root/manual/examples/rprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'manual/examples/rprintf.c')
-rw-r--r--manual/examples/rprintf.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/manual/examples/rprintf.c b/manual/examples/rprintf.c
index bac17b49e5..2b8f6bfe74 100644
--- a/manual/examples/rprintf.c
+++ b/manual/examples/rprintf.c
@@ -1,32 +1,33 @@
#include <stdio.h>
+#include <stdlib.h>
#include <printf.h>
-#include <stdarg.h>
/*@group*/
typedef struct
- {
- char *name;
- } Widget;
+{
+ char *name;
+}
+Widget;
/*@end group*/
int
print_widget (FILE *stream,
const struct printf_info *info,
- va_list *app)
+ const void *const *args)
{
- Widget *w;
+ const Widget *w;
char *buffer;
int len;
/* Format the output into a string. */
- w = va_arg (*app, Widget *);
+ w = *((const Widget **) (args[0]));
len = asprintf (&buffer, "<Widget %p: %s>", w, w->name);
if (len == -1)
return -1;
/* Pad to the minimum field width and print to the stream. */
len = fprintf (stream, "%*s",
- (info->left ? - info->width : info->width),
+ (info->left ? -info->width : info->width),
buffer);
/* Clean up and return. */