printf.c revision 22993
1203954Srdivacky/*-
2203954Srdivacky * Copyright (c) 1990, 1993
3203954Srdivacky *	The Regents of the University of California.  All rights reserved.
4203954Srdivacky *
5203954Srdivacky * This code is derived from software contributed to Berkeley by
6203954Srdivacky * Chris Torek.
7203954Srdivacky *
8203954Srdivacky * Redistribution and use in source and binary forms, with or without
9203954Srdivacky * modification, are permitted provided that the following conditions
10203954Srdivacky * are met:
11203954Srdivacky * 1. Redistributions of source code must retain the above copyright
12203954Srdivacky *    notice, this list of conditions and the following disclaimer.
13203954Srdivacky * 2. Redistributions in binary form must reproduce the above copyright
14203954Srdivacky *    notice, this list of conditions and the following disclaimer in the
15203954Srdivacky *    documentation and/or other materials provided with the distribution.
16203954Srdivacky * 3. All advertising materials mentioning features or use of this software
17203954Srdivacky *    must display the following acknowledgement:
18203954Srdivacky *	This product includes software developed by the University of
19203954Srdivacky *	California, Berkeley and its contributors.
20203954Srdivacky * 4. Neither the name of the University nor the names of its contributors
21203954Srdivacky *    may be used to endorse or promote products derived from this software
22203954Srdivacky *    without specific prior written permission.
23203954Srdivacky *
24203954Srdivacky * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25203954Srdivacky * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26203954Srdivacky * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27203954Srdivacky * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28203954Srdivacky * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29203954Srdivacky * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30203954Srdivacky * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31203954Srdivacky * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32203954Srdivacky * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33203954Srdivacky * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34203954Srdivacky * SUCH DAMAGE.
35203954Srdivacky */
36203954Srdivacky
37203954Srdivacky#if defined(LIBC_SCCS) && !defined(lint)
38203954Srdivacky#if 0
39203954Srdivackystatic char sccsid[] = "@(#)printf.c	8.1 (Berkeley) 6/4/93";
40203954Srdivacky#endif
41203954Srdivackystatic const char rcsid[] =
42203954Srdivacky		"$Id$";
43203954Srdivacky#endif /* LIBC_SCCS and not lint */
44203954Srdivacky
45203954Srdivacky#include <stdio.h>
46203954Srdivacky#if __STDC__
47203954Srdivacky#include <stdarg.h>
48203954Srdivacky#else
49203954Srdivacky#include <varargs.h>
50203954Srdivacky#endif
51203954Srdivacky
52203954Srdivackyint
53203954Srdivacky#if __STDC__
54203954Srdivackyprintf(char const *fmt, ...)
55203954Srdivacky#else
56203954Srdivackyprintf(fmt, va_alist)
57203954Srdivacky	char *fmt;
58203954Srdivacky	va_dcl
59203954Srdivacky#endif
60203954Srdivacky{
61203954Srdivacky	int ret;
62203954Srdivacky	va_list ap;
63
64#if __STDC__
65	va_start(ap, fmt);
66#else
67	va_start(ap);
68#endif
69	ret = vfprintf(stdout, fmt, ap);
70	va_end(ap);
71	return (ret);
72}
73