00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "CheckStatus.h"
00021 #include <stdio.h>
00022 #include <string.h>
00023
00024 #include <lal/LALRCSID.h>
00025 NRCSID (CHECKSTATUSC,"$Id: CheckStatus.c,v 1.3 2007/06/08 14:41:52 bema Exp $");
00026
00027 extern BOOLEAN optVerbose;
00028
00029 INT4
00030 CheckStatus(LALStatus *status, const INT4 code, const CHAR *message,
00031 const INT4 exitcode, const CHAR *error)
00032 {
00033
00034 if (optVerbose)
00035 {
00036 REPORTSTATUS (status);
00037 }
00038 if (status->statusCode!= code)
00039 {
00040 if (code) printf (" FAIL: did not recognize \"%s\"\n", message);
00041 if (optVerbose) printf("Exiting with error: %s\n", error);
00042 return(exitcode);
00043 }
00044 else if (code && strcmp(message, status->statusDescription))
00045 {
00046 printf(" FAIL: incorrect error message \"%s\" not \"%s\"\n",
00047 status->statusDescription, message);
00048 if (optVerbose) printf("Exiting with error: %s\n", error);
00049 return(exitcode);
00050 }
00051 return 0;
00052 }