diff options
author | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 1999-11-19 10:25:13 +0000 |
---|---|---|
committer | sai <sai@eec4d7dc-71c2-46d6-addf-10296150bf52> | 1999-11-19 10:25:13 +0000 |
commit | 8fe9c3a66c1dc44e137e176ff5018f4d8d65eb4d (patch) | |
tree | ef1843f2785495a801fcf16dfbb466b2649c0863 /src/error_exit.c | |
parent | 909b808371a09670aa67f2854aab337632412e9e (diff) |
Recreating code after origin /data crash.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Cartoon2D/trunk@6 eec4d7dc-71c2-46d6-addf-10296150bf52
Diffstat (limited to 'src/error_exit.c')
-rw-r--r-- | src/error_exit.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/src/error_exit.c b/src/error_exit.c deleted file mode 100644 index 748de99..0000000 --- a/src/error_exit.c +++ /dev/null @@ -1,63 +0,0 @@ -/* error_exit.c -- print an error message and cleanly shutdown cactus */ -/* $Id$ */ - -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> - -#include "cactus.h" -#include "thorn_cartoon_2d/src/error_exit.h" - -/* - * Jonathan Thornburg's favorite syntactic sugar to make the two branches - * of an if-else statement symmetrical: - * - * Also note (in)famous joke saying - * "syntactic sugar causes cancer of the semicolon" - * :) :) :) - */ -#define then /* empty */ - -/*****************************************************************************/ - -/* - * This function prints an error message (formatted via vfprintf(3S)), - * then cleanly shuts down cactus. It does *not* return to its caller. - * - * Despite not actually returning, this function is declared as returning - * an int , so it may be easily used in conditional expressions like - * foo = bar_ok ? baz(bar) : error_exit(...); - * - * Usage: - * error_exit(exit_code, message, args...) - * where exit_code is one of the codes defined in "error_exit.h" - * - * ***** THIS VERSION IS FOR ANSI/ISO C ***** - * - * Arguments: - * exit_code = (in) One of the codes defined in "error_exit.h", or any - * other integer to pass back to the shell as our exit - * status. - * format = (in) vprintf(3S) format string for error message to be printed. - * args... = (in) Any additional arguments are (presumably) used in formatting - * the error message string. - */ -#ifdef __cplusplus -extern "C" -#endif -/*VARARGS*/ -/* PUBLIC */ -int error_exit(const int exit_code, const char *const format, ...) -{ -va_list ap; - -va_start(ap, format); -vfprintf(stderr, format, ap); -va_end(ap); - - if (exit_code == 0) { - then STOP; /*NOTREACHED*/ - } else if (exit_code > 0) { - then ERROR_STOP(exit_code); /*NOTREACHED*/ - } else ERROR_ABORT(exit_code); /*NOTREACHED*/ -} |