wm: 5552

ref: 1bdf54041fbe740c98bae75f879678141dc494c9
dir: /unix.c/

View raw version
#include <stdio.h>
#include <stdlib.h>

_Noreturn void
sysfatal(char *fmt, ...)
{
	va_list arg;

	va_start(arg, fmt);
	vfprintf(stderr, fmt, arg);
	fprintf(stderr, "\n");
	va_end(arg);

	exit(1);
}

int
fprint(int fd, char *fmt, ...)
{
	int n;
	FILE *f;

	f = fdopen(fd, "w");

	va_list arg;
	va_start(arg, fmt);
	
	n = vfprintf(fd, fmt, arg);
	va_end(arg);

	fdclose(f);
	return n;
}