Skip to content

Commit 7a9141d

Browse files
author
Kevin Howe
authored
Merge pull request #1 from tseemann/master
Add -v flag to print version
2 parents 6003647 + f3102e4 commit 7a9141d

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

Makefile

100755100644
+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ all: quicktree
2424
quicktree : $(QUICKTREEOBJ)
2525
$(CC) $(LFLAGS) -o $@ $(QUICKTREEOBJ) -lm
2626

27-
$(OBJ)/quicktree.o : $(SRC)/quicktree.c
27+
$(OBJ)/quicktree.o : $(SRC)/quicktree.c $(INC)/version.h
2828
$(CC) $(CFLAGS) -o $(OBJ)/quicktree.o $(SRC)/quicktree.c
2929

3030
$(OBJ)/align.o : $(SRC)/align.c $(INC)/align.h

include/version.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**********************************************************************
2+
* File: version.h
3+
* Author: Torsten Seemann
4+
*-------------------------------------------------------------------
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*-------------------------------------------------------------------
15+
* NOTES:
16+
* This file contains general utiliy functions used throughout the
17+
* application, such as those for memory management and error
18+
* messaging. I have used it as a place to put other general stuff
19+
* until I have somewhere better to put it.
20+
**********************************************************************/
21+
#ifndef _VERSION
22+
#define _VERSION
23+
24+
#define VERSION_MAJOR 2
25+
#define VERSION_MINOR 0
26+
27+
#endif

src/quicktree.c

+9-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "buildtree.h"
2828
#include "distancemat.h"
2929
#include "tree.h"
30-
30+
#include "version.h"
3131

3232
/********************* command-line options * ************************/
3333

@@ -44,7 +44,8 @@ Advanced options :\n\
4444
-kimura : Use the kimura translation for pairwise distances\n\
4545
(ignored for distance matrix inputs)\n\
4646
-boot <n> : Calcuate bootstrap values with n iterations\n\
47-
(ignored for distance matrix outputs)\n\n\
47+
(ignored for distance matrix outputs)\n\
48+
-v : print version and exit\n\n\
4849
*Use sreformat, part of the HMMer package to convert your alignment to Stockholm format\n";
4950

5051
static struct Option options[] = {
@@ -53,7 +54,8 @@ static struct Option options[] = {
5354
{ "-upgma", NO_ARGS },
5455
{ "-kimura", NO_ARGS },
5556
{ "-boot", INT_ARG },
56-
{ "-h", NO_ARGS }
57+
{ "-h", NO_ARGS },
58+
{ "-v", NO_ARGS },
5759
};
5860

5961
static unsigned int use_kimura = 0;
@@ -191,6 +193,10 @@ int main (int argc, char *argv[]) {
191193
fprintf( stderr, "%s", usage );
192194
exit(0);
193195
}
196+
else if (strcmp(optname, "-v") == 0) {
197+
printf( "quicktree %d.%d\n", VERSION_MAJOR, VERSION_MINOR );
198+
exit(0);
199+
}
194200
}
195201

196202
if (argc - optindex != 1) {

src/util.c

100755100644
File mode changed.

0 commit comments

Comments
 (0)