summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/printf.3
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-14 21:18:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-07-14 21:18:08 +0000
commitc3127fa847687d0146f420acd6752346df3237cf (patch)
tree8db46f7bfdba34a6d057bd9482c73513a5048112 /lib/libc/stdio/printf.3
parenta32148ed2eb34c6a1d41643355c0fca4acbfa387 (diff)
formatting flaws
Diffstat (limited to 'lib/libc/stdio/printf.3')
-rw-r--r--lib/libc/stdio/printf.36
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index bae119cce12..653699fd458 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: printf.3,v 1.9 1998/06/15 17:54:48 mickey Exp $
+.\" $OpenBSD: printf.3,v 1.10 1998/07/14 21:18:07 deraadt Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -587,6 +587,7 @@ and
are pointers to strings:
.Bd -literal -offset indent
#include <stdio.h>
+
fprintf(stdout, "%s, %s %d, %.2d:%.2d\en",
weekday, month, day, hour, min);
.Ed
@@ -596,6 +597,7 @@ to five decimal places:
.Bd -literal -offset indent
#include <math.h>
#include <stdio.h>
+
fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));
.Ed
.Pp
@@ -604,10 +606,12 @@ To allocate a 128 byte string and print into it:
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+
char *newfmt(const char *fmt, ...)
{
char *p;
va_list ap;
+
if ((p = malloc(128)) == NULL)
return (NULL);
va_start(ap, fmt);