Loading [MathJax]/extensions/TeX/AMSsymbols.js
LAL 7.7.0.1-00ddc7f
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
version.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Karl Wette
3 * Copyright (C) 2007 Jolien Creighton
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20
21#include <stdio.h>
22#include <config.h>
23
24#include <lal/LALStdlib.h>
25
26#include "LALVCSInfo.h"
27
28/*
29 * Utility for printing version information for LAL
30 */
31
32int main(int argc, char **argv) {
33
34 /* Parse command line */
35 int verbose = 0;
36 if ( argc == 2 && ( strcmp( argv[1], "-v" ) == 0 || strcmp( argv[1], "-verbose" ) == 0 || strcmp( argv[1], "--verbose" ) == 0 ) ) {
37 verbose = 1;
38 } else if ( argc > 1 ) {
39 fprintf(stderr,
40 "Usage: %s [-h|--help] [-v|--verbose]\n\n"
41 "Print version information for LAL and upstream LALSuite components\n\n"
42 "Options:\n"
43 " --help display this messgage and exit\n"
44 " --verbose display verbose version information\n",
45 argv[0]
46 );
47 if ( strcmp( argv[1], "-h" ) == 0 || strcmp( argv[1], "-help" ) == 0 || strcmp( argv[1], "--help" ) == 0 ) {
48 return EXIT_SUCCESS;
49 } else {
50 return EXIT_FAILURE;
51 }
52 }
53
54 /* Print version information */
55 char *str = XLALVCSInfoString( lalVCSInfoList, verbose, NULL );
56 XLAL_CHECK_MAIN( str != NULL, XLAL_EFUNC );
57 fprintf( stdout, "%s", str );
58
59 /* Cleanup */
60 XLALFree( str );
62
63 return EXIT_SUCCESS;
64
65}
void LALCheckMemoryLeaks(void)
Definition: LALMalloc.c:784
const LALVCSInfoList lalVCSInfoList
NULL-terminated list of VCS and build information for LAL and its dependencies
#define fprintf
#define XLALFree(p)
Definition: LALMalloc.h:47
char * XLALVCSInfoString(const LALVCSInfoList vcs_list, const int verbose, const char *prefix)
Generate a multi-line string containing VCS and build information for a library and its dependencies,...
#define XLAL_CHECK_MAIN(assertion,...)
Macro to test an assertion and invoke a failure if it is not true in a C main() routine.
Definition: XLALError.h:885
@ XLAL_EFUNC
Internal function call failed bit: "or" this with existing error number.
Definition: XLALError.h:462
int verbose
Definition: tconvert.c:103
int main(int argc, char **argv)
Definition: version.c:32