unix/fiss

lib/libfmt/fmtvprint.c in master
Repositories | Summary | Log | Files | LICENSE

fmtvprint.c (642B) download


 1/* Copyright (c) 2002-2006 Lucent Technologies; see LICENSE */
 2#include "fmt.h"
 3#include "fmtdef.h"
 4#include "plan9.h"
 5
 6#include <stdarg.h>
 7#include <string.h>
 8
 9
10/*
11 * format a string into the output buffer
12 * designed for formats which themselves call fmt,
13 * but ignore any width flags
14 */
15int fmtvprint(Fmt* f, char* fmt, va_list args) {
16	va_list va;
17	int     n;
18
19	f->flags = 0;
20	f->width = 0;
21	f->prec  = 0;
22	VA_COPY(va, f->args);
23	VA_END(f->args);
24	VA_COPY(f->args, args);
25	n        = dofmt(f, fmt);
26	f->flags = 0;
27	f->width = 0;
28	f->prec  = 0;
29	VA_END(f->args);
30	VA_COPY(f->args, va);
31	VA_END(va);
32	if (n >= 0)
33		return 0;
34	return n;
35}