:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / crtdll / stdio / sprintf.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
3 /* Copyright (C) 1991, 1995 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB.  If
18 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 Cambridge, MA 02139, USA.  */
20
21 #include <stdarg.h>
22 #include <crtdll/stdio.h>
23 #include <crtdll/wchar.h>
24 #include <limits.h>
25 #include <crtdll/internal/file.h>
26
27 #undef sprintf
28 #undef wsprintf
29 int
30 sprintf(char *str, const char *fmt, ...)
31 {
32   va_list arg;
33   int done;
34
35   va_start (arg, fmt);
36   done = vsprintf (str, fmt, arg);
37   va_end (arg);
38   return done;
39 }
40
41 int
42 swprintf(wchar_t *str, const wchar_t *fmt, ...)
43 {
44   va_list arg;
45   int done;
46
47   va_start (arg, fmt);
48   done = vswprintf (str, fmt, arg);
49   va_end (arg);
50   return done;
51 }
52
53
54
55 /* Write formatted output into S, according to the format
56    string FORMAT, writing no more than MAXLEN characters.  */
57 /* VARARGS3 */
58 int
59 _snprintf (char *s, size_t maxlen,const char *format, ...)
60 {
61   va_list arg;
62   int done;
63
64   va_start (arg, format);
65   done = _vsnprintf (s, maxlen, format, arg);
66   va_end (arg);
67
68   return done;
69 }
70
71 int
72 _snwprintf (wchar_t *s, size_t maxlen,const wchar_t *format, ...)
73 {
74   va_list arg;
75   int done;
76
77   va_start (arg, format);
78   done = _vsnwprintf (s, maxlen, format, arg);
79   va_end (arg);
80
81   return done;
82 }
83
84