wm: 5552

ref: 000040ac39bcca98a50c39ca04964ec338f112fd
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;
}