wm: 5552

ref: 00a90ab613d802127bc3108eb160711153aafbfa
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;
}