Added copyright headers
[libfirm] / ir / common / xoprintf.c
1 /*
2  * Project:     libFIRM
3  * File name:   ir/common/xoprintf.c
4  * Purpose:     Xoprintf --- extended formatted output to obstacks.
5  * Author:      Christian von Roques
6  * Modified by:
7  * Created:     1999 by getting from fiasco
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 1995, 1996 Christian von Roques
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifdef HAVE_CONFIG_H
14 # include <config.h>
15 #endif
16
17 #ifndef USE_PRINTF
18
19 #include <obstack.h>
20 #include <string.h>
21 #include <assert.h>
22 #include "xprintf.h"
23
24 /* bcopy is not ISO C */
25 #define bcopy(X, Y, Z) memcpy((Y), (X), (Z))
26
27 static int
28 xoprinter (void *obst, const char *data, size_t len)
29 {
30   obstack_grow ((struct obstack *)obst, data, len);
31   return len;
32 }
33
34
35 int
36 xoprintf (struct obstack *obst, const char *fmt, ...)
37 {
38   va_list args;
39   int res;
40
41   va_start (args, fmt);
42   res = xvgprintf (xoprinter, obst, fmt, args);
43   va_end (args);
44   return res;
45 }
46
47 int
48 xvoprintf (struct obstack *obst, const char *fmt, va_list args)
49 {
50   return xvgprintf (xoprinter, obst, fmt, args);
51 }
52
53 #endif /* USE_PRINTF */