Skip to content

Commit

Permalink
Merge pull request #1 from tseemann/master
Browse files Browse the repository at this point in the history
Add -v flag to print version
  • Loading branch information
Kevin Howe authored Apr 10, 2017
2 parents 6003647 + f3102e4 commit 7a9141d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ all: quicktree
quicktree : $(QUICKTREEOBJ)
$(CC) $(LFLAGS) -o $@ $(QUICKTREEOBJ) -lm

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

$(OBJ)/align.o : $(SRC)/align.c $(INC)/align.h
Expand Down
27 changes: 27 additions & 0 deletions include/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**********************************************************************
* File: version.h
* Author: Torsten Seemann
*-------------------------------------------------------------------
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------
* NOTES:
* This file contains general utiliy functions used throughout the
* application, such as those for memory management and error
* messaging. I have used it as a place to put other general stuff
* until I have somewhere better to put it.
**********************************************************************/
#ifndef _VERSION
#define _VERSION

#define VERSION_MAJOR 2
#define VERSION_MINOR 0

#endif
12 changes: 9 additions & 3 deletions src/quicktree.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "buildtree.h"
#include "distancemat.h"
#include "tree.h"

#include "version.h"

/********************* command-line options * ************************/

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

static struct Option options[] = {
Expand All @@ -53,7 +54,8 @@ static struct Option options[] = {
{ "-upgma", NO_ARGS },
{ "-kimura", NO_ARGS },
{ "-boot", INT_ARG },
{ "-h", NO_ARGS }
{ "-h", NO_ARGS },
{ "-v", NO_ARGS },
};

static unsigned int use_kimura = 0;
Expand Down Expand Up @@ -191,6 +193,10 @@ int main (int argc, char *argv[]) {
fprintf( stderr, "%s", usage );
exit(0);
}
else if (strcmp(optname, "-v") == 0) {
printf( "quicktree %d.%d\n", VERSION_MAJOR, VERSION_MINOR );
exit(0);
}
}

if (argc - optindex != 1) {
Expand Down
Empty file modified src/util.c
100755 → 100644
Empty file.

0 comments on commit 7a9141d

Please sign in to comment.