#include "print.h"

/* Just like vfprintf, but takes a file descriptor instead of a 
   FILE *. used in the following two functions in this file. */
void vfdprintf(int fd, char *format, va_list ap)
{
	char buf[2048];

	vsprintf(buf, format, ap);
	write(fd, buf, strlen(buf));
}

/* Print stuff onto file-descriptor fd. */
void fdprintf(int fd, char *format,...)
{
	va_list ap;

	va_start(ap, format);
	vfdprintf(fd, format, ap);
	va_end(ap);
}

/* Print stuff onto the tty we were invoked on. this actually 
   may one day become syslog. */
void ttyprintf(char *format,...)
{
	va_list ap;

	va_start(ap, format);
	vfdprintf(tty_fd, format, ap);
	va_end(ap);
}
