initial commit

This commit is contained in:
TLINDEN
2013-10-28 22:50:05 +01:00
parent 92c0dcbebf
commit 2d7babae35
113 changed files with 61619 additions and 4 deletions

29
libpcp/fatal.c Normal file
View File

@@ -0,0 +1,29 @@
#include "defines.h"
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void fatal(const char * fmt, ...) {
va_list ap;
va_start(ap, fmt);
vasprintf(&PCP_ERR, fmt, ap);
va_end(ap);
PCP_ERRSET = 1;
}
void fatals_ifany() {
if(PCP_ERRSET == 1) {
fprintf(stderr, PCP_ERR);
if(errno) {
fprintf(stderr, "Error: %s\n", strerror(errno));
}
free(PCP_ERR);
PCP_EXIT = 1;
}
}