don't allow negative zero; ``printf("%.3f", (double)-0.00005);''
[unix-history] / usr / src / lib / libc / stdio / printf.c
CommitLineData
6c8ba8e3
KB
1/*
2 * Copyright (c) 1987 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
11 */
12
2ce81398 13#if defined(LIBC_SCCS) && !defined(lint)
6c8ba8e3
KB
14static char sccsid[] = "@(#)printf.c 5.3 (Berkeley) %G%";
15#endif /* LIBC_SCCS and not lint */
b8f253e8 16
6c8ba8e3 17#include <stdio.h>
842c3449
BJ
18
19printf(fmt, args)
6c8ba8e3
KB
20 char *fmt;
21 int args;
842c3449 22{
6c8ba8e3
KB
23 int len;
24
25 len = _doprnt(fmt, &args, stdout);
26 return(ferror(stdout) ? EOF : len);
842c3449 27}