X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=common.c;h=ba61341dc9bc45c457feba0ba87b112190df3c6a;hb=04d38304c34c5cac06e7fed4c20e3fe108330b7b;hp=b87dedb3110950267c54157283a03d9592f5c1b0;hpb=f5fef8bc75d9d5658705763fa7c083ae75a501ba;p=moebius2.git diff --git a/common.c b/common.c index b87dedb..ba61341 100644 --- a/common.c +++ b/common.c @@ -2,9 +2,6 @@ * Generally useful stuff. */ -#include -#include - #include "common.h" double magnD(const double pq[D3]) { @@ -46,5 +43,15 @@ void xprod(double r[D3], const double a[D3], const double b[D3]) { r[2]= a[0]*b[1] - a[1]*b[0]; } +void libdie(const char *lib, int l, const char *str) { + fprintf(stderr,"%s library call failed, line %d: %s\n", lib, l, str); +} + +void gsldie(int l, const char *what, int status) { + fprintf(stderr,"gsl function failed, line %d: %s: %s\n", + l, what, gsl_strerror(status)); + exit(-1); +} + void diee(const char *what) { perror(what); exit(16); } void flushoutput(void) { if (fflush(stdout)||ferror(stdout)) diee("stdout"); }