removed support for -r, -h, and rmail
[unix-history] / usr / src / usr.bin / window / wwprintf.c
CommitLineData
60de5df9 1/*
46e9ea25
KB
2 * Copyright (c) 1983 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.
60de5df9
EW
11 */
12
46e9ea25
KB
13#ifndef lint
14static char sccsid[] = "@(#)wwprintf.c 3.7 (Berkeley) %G%";
15#endif /* not lint */
16
972e1ce8 17#include "ww.h"
b15b4a3f 18#include <varargs.h>
972e1ce8 19
85af59e4 20/*VARARGS2*/
b15b4a3f 21wwprintf(w, fmt, va_alist)
972e1ce8
EW
22struct ww *w;
23char *fmt;
b15b4a3f 24va_dcl
972e1ce8 25{
b1189050 26#include <stdio.h>
972e1ce8 27 struct _iobuf _wwbuf;
4222244b 28 char buf[1024];
b15b4a3f 29 va_list ap;
972e1ce8
EW
30
31 /*
32 * A danger is that when buf overflows, _flsbuf() will be
33 * called automatically. It doesn't check for _IOSTR.
34 * We set the file descriptor to -1 so no actual io will be done.
35 */
36 _wwbuf._flag = _IOWRT+_IOSTRG;
37 _wwbuf._base = _wwbuf._ptr = buf;
38 _wwbuf._cnt = sizeof buf;
39 _wwbuf._file = -1; /* safe */
b15b4a3f
EW
40 va_start(ap);
41 _doprnt(fmt, ap, &_wwbuf);
42 va_end(ap);
b1189050 43 (void) wwwrite(w, buf, _wwbuf._ptr - buf);
972e1ce8 44}