]> mj.ucw.cz Git - moe.git/blob - sherlock/obj-format.c
Status file docs: A couple of minor improvements
[moe.git] / sherlock / obj-format.c
1 /*
2  *      Sherlock Library -- Adding Formatted Attributes
3  *
4  *      (c) 2005 Martin Mares <mj@ucw.cz>
5  *      (c) 2007 Pavel Charvat <pchar@ucw.cz>
6  *
7  *      This software may be freely distributed and used according to the terms
8  *      of the GNU Lesser General Public License.
9  */
10
11 #include "sherlock/sherlock.h"
12 #include "sherlock/object.h"
13 #include "ucw/stkstring.h"
14
15 #include <stdio.h>
16
17 struct oattr *
18 obj_add_attr_vformat(struct odes *o, uns x, char *fmt, va_list args)
19 {
20   return obj_add_attr(o, x, stk_vprintf(fmt, args));
21 }
22
23 struct oattr *obj_add_attr_format(struct odes *o, uns x, char *fmt, ...)
24 {
25   va_list va;
26   va_start(va, fmt);
27   struct oattr *a = obj_add_attr_vformat(o, x, fmt, va);
28   va_end(va);
29   return a;
30 }
31
32 struct oattr *
33 obj_set_attr_vformat(struct odes *o, uns x, char *fmt, va_list args)
34 {
35   return obj_set_attr(o, x, stk_vprintf(fmt, args));
36 }
37
38 struct oattr *obj_set_attr_format(struct odes *o, uns x, char *fmt, ...)
39 {
40   va_list va;
41   va_start(va, fmt);
42   struct oattr *a = obj_set_attr_vformat(o, x, fmt, va);
43   va_end(va);
44   return a;
45 }