#include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */

/* Initially we put data to stdout. */
int cur_out = 1;

/* Put data to current output. */
void putd(const char *data, unsigned long len)
	{
	(void)write(cur_out,data,len);
	}

void put(const char *data)
	{
	putd(data, strlen(data));
	}

void put_ch(char ch)
	{
	char buf[1];
	buf[0] = ch;
	putd(buf,1);
	}

void put_long(long x)
	{
	put(format_long(x));
	}

void put_ulong(unsigned long x)
	{
	put(format_ulong(x));
	}

void put_double(double x)
	{
	put(format_double(x));
	}

void nl(void)
	{
	putd("\n",1);
	}

void set_output(int fd)
	{
	fsync(cur_out);
	cur_out = fd;
	}

void put_to_error(void)
	{
	set_output(2);
	}

#include <format.h>
#include <string.h> /* strlen */
#include <output.h>
#include <unistd.h> /* write */

/* Initially we put data to stdout. */
int cur_out = 1;

/* Put data to current output. */
void putd(const char *data, unsigned long len)
	{
	ssize_t n = write(cur_out,data,len);
	(void)n;
	}

void put(const char *data)
	{
	putd(data, strlen(data));
	}

void put_ch(char ch)
	{
	char buf[1];
	buf[0] = ch;
	putd(buf,1);
	}

void put_long(long x)
	{
	put(format_long(x));
	}

void put_ulong(unsigned long x)
	{
	put(format_ulong(x));
	}

void put_double(double x)
	{
	put(format_double(x));
	}

void nl(void)
	{
	putd("\n",1);
	}

void set_output(int fd)
	{
	fsync(cur_out);
	cur_out = fd;
	}

void put_to_error(void)
	{
	set_output(2);
	}

Work around incompatibility of warn_unused_result on one machine.
Work around incompatibility of warn_unused_result on one machine.

On one machine, the call to "write" in output.c gave this compiler error:
ignoring return value of ‘write’, declared with attribute warn_unused_result

To work around that, the code now grabs the return value and ignores it with
(void).
