/* Mis-connector - user-space router and NATP for misconfigured hosts on LAN.
Miscelanous garbage.
This file is part of mis-connector.
Copyright (C) 2004,2021 Petr Silhavy <petr.silhavy@yandex.com>
SPDX-License-Identifier: GPL-3.0-or-later
Mis-connector is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the
License, or (at your option) any later version.
Mis-connector is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with mis-connector. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "whackparam.h"
void
_fail(char *file,int line,char *fce,char *msg,char *opt,int exit_now)
{
fprintf(stderr,"FAIL: %s:%d %s() %s [%s] - %s errno %d\n",
file,line,fce,
msg, opt ? opt : "" ,
strerror(errno), errno );
if ( exit_now )
abort();
}
void *
Malloc(size_t size)
{
void *r ;
if ( ( r = malloc(size)) == NULL )
BUG("malloc failed");
return r ;
}
void *
Malloc0(size_t size)
{
void *r = Malloc(size);
memset(r, 0, size);
return r ;
}