error.c
author viric@llimona
Fri, 14 Sep 2007 23:47:40 +0200
changeset 15 0acf8c3c4fe0
parent 14 286b248e402a
permissions -rw-r--r--
Good routing of app's stderr.

/*
    stdin mix - a mixer/multiplexer for stdin to processes
    Copyright (C) 2007  LluĂ­s Batlle i Rossell

    Please find the license in the provided COPYING file.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>

#include "main.h"

void error(const char *msg, ...)
{
    va_list v;

    va_start(v, msg);
    vfprintf(stderr, msg, v);
    putc('\n', stderr);
    fprintf(stderr, " errno %i: %s\n", errno, strerror(errno));
    exit(-1);
}