add missing -static
[AROS.git] / tools / toollib / mystream.c
blob7f980f094bbee592266298b54d5822b0c1c14605
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <string.h>
7 #include <toollib/mystream.h>
8 #include <toollib/error.h>
10 int
11 Str_Init (MyStream * ms, const char * name)
13 memset (ms, 0, sizeof (MyStream));
15 ms->line = 1;
16 ms->name = xstrdup (name);
18 return 1;
21 void
22 Str_Delete (MyStream * ms)
24 xfree (ms->name);
27 int
28 Str_Puts (MyStream * ms, const char * str, CBD data)
30 int c;
32 if (ms->puts)
33 c = CallCB (ms->puts, ms, str, data);
34 else
36 c = 0;
38 while (*str && (c = Str_Put(ms,NULL + *str,data)) > 0)
39 str ++;
42 return c;
45 void
46 Str_PushError (MyStream * ms, const char * fmt, ...)
48 va_list args;
49 VA_START (args, fmt);
50 PushMsg (" ", fmt, args, NULL);
51 va_end (args);
52 PushError ("in %s:%d:", Str_GetName(ms), Str_GetLine(ms));
55 void
56 Str_PushWarn (MyStream * ms, const char * fmt, ...)
58 va_list args;
59 VA_START (args, fmt);
60 PushMsg (" ", fmt, args, NULL);
61 va_end (args);
62 PushWarn ("in %s:%d:", Str_GetName(ms), Str_GetLine(ms));