Merge 13511:13830 from trunk
[reactos.git] / reactos / lib / crt / 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 <stdio.h>
23 #include <wchar.h>
24 #include <limits.h>
25 #include <internal/file.h>
26 #include <tchar.h>
27
28 #undef sprintf
29 #undef wsprintf
30
31 int
32 crt_sprintf(_TCHAR *str, const _TCHAR *fmt, ...)
33 {
34 va_list arg;
35 int done;
36
37 va_start (arg, fmt);
38 done = _vstprintf (str, fmt, arg);
39 va_end (arg);
40 return done;
41 }
42
43
44 /* Write formatted output into S, according to the format
45 string FORMAT, writing no more than MAXLEN characters. */
46 /* VARARGS3 */
47 int
48 crt__snprintf (_TCHAR *s, size_t maxlen,const _TCHAR *format, ...)
49 {
50 va_list arg;
51 int done;
52
53 va_start (arg, format);
54 done = _vsntprintf(s, maxlen, format, arg);
55 va_end (arg);
56
57 return done;
58 }
59
60