error.c
author Lluís Batlle <viric@viric.name>
Thu, 20 Mar 2014 16:29:13 +0100
branchsaveflie
changeset 96 d090ddac5131
parent 82 5cbe47923060
permissions -rw-r--r--
Fixing the build on linux, gcc linking parameters order

/*
    Terminal Mixer - multi-point multi-user access to terminal applications
    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));
    finish(-1);
}

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

    va_start(v, msg);
    vfprintf(stderr, msg, v);
    putc('\n', stderr);
}

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

    va_start(v, msg);
    if (0)
    {
        vfprintf(stderr, msg, v);
        putc('\n', stderr);
    }
}

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

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