LALVersionTest.c

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Bernd Machenschalk, Jolien Creighton
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 #if 0 /* autodoc block */
00021 <lalVerbatim file="LALVersionTestCV">
00022 $Id: LALVersionTest.c,v 1.3 2007/06/08 14:41:54 bema Exp $
00023 </lalVerbatim>
00024 
00025 <lalLaTeX>
00026 \subsection{Program \texttt{LALVersionTest.c}}
00027 \label{s:LALVersionTest.c}
00028 
00029 Prints the version and configure options of the LAL library being used.
00030 
00031 \subsubsection*{Usage}
00032 \begin{verbatim}
00033 LALVersionTest
00034 \end{verbatim}
00035 
00036 \subsubsection*{Description}
00037 
00038 This program prints the current version of LAL.\@  If the version information
00039 in the library differs from the version information in the header file, this
00040 program prints the two versions and exits with code 1.  This is useful for
00041 determining which version of the LAL library and header files you are linking
00042 to.
00043 
00044 \subsubsection*{Exit codes}
00045 \begin{tabular}{|c|l|}
00046 \hline
00047  Code & Explanation                   \00048 \hline
00049 \tt 0 & Success, normal exit.         \00050 \tt 1 & Version info in library disagrees with header file. \00051 \tt 2 & Subroutine failed.            \00052 \hline
00053 \end{tabular}
00054 
00055 
00056 \vfill{\footnotesize\input{LALVersionTestCV}}
00057 
00058 
00059 </lalLaTeX>
00060 #endif /* autodoc block */
00061 
00062 #include <stdio.h>
00063 #include <string.h>
00064 #include <lal/LALStdlib.h>
00065 #include <lal/LALVersion.h>
00066 
00067 NRCSID (LALVERSIONTESTC,"$Id: LALVersionTest.c,v 1.3 2007/06/08 14:41:54 bema Exp $");
00068 
00069 int lalDebugLevel = 0;
00070 
00071 int main( void )
00072 {
00073   static LALStatus status;
00074   char msg[1024];
00075   int verbose = 1;
00076 
00077   if ( strcmp( LAL_VERSION, lalVersion ) ||
00078        strcmp( LAL_CONFIGURE_ARGS, lalConfigureArgs ) ||
00079        strcmp( LAL_CONFIGURE_DATE, lalConfigureDate ) )
00080   {
00081     fputs( "LAL Version Mismatch!\n\n", stderr );
00082     fputs( "Header Version ",           stderr );
00083     fputs( LAL_VERSION,                 stderr );
00084     fputs( "\nCompiled on ",            stderr );
00085     fputs( LAL_CONFIGURE_DATE,          stderr );
00086     fputs( "\nWith arguments ",         stderr );
00087     fputs( LAL_CONFIGURE_ARGS,          stderr );
00088     fputs( "\n\n",                      stderr );
00089     fputs( "Library Version ",          stderr );
00090     fputs( lalVersion,                  stderr );
00091     fputs( "\nCompiled on ",            stderr );
00092     fputs( lalConfigureDate,            stderr );
00093     fputs( "\nWith arguments ",         stderr );
00094     fputs( lalConfigureArgs,            stderr );
00095     fputs( "\n",                        stderr );
00096     return 1;
00097   }
00098 
00099   LALVersion( &status, msg, sizeof( msg ), verbose );
00100 
00101   if ( status.statusCode )
00102   {
00103     LALStatus *next = &status;
00104     do
00105     {
00106       fputs( next->statusDescription, stderr );
00107       fputs( "\n", stderr );
00108       next = next->statusPtr;
00109     }
00110     while ( next );
00111     return 2;
00112   }
00113 
00114   puts( msg );
00115 
00116   return 0;
00117 }

Generated on Sun Oct 12 02:32:09 2008 for LAL by  doxygen 1.5.2