Skip to content

Commit 841da70

Browse files
committed
Merge branch 'tseemann-version_flag'
2 parents 316cc14 + 1dd0664 commit 841da70

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "snp-sites.h"
2727
#include "string-cat.h"
2828

29+
#define PROGRAM_NAME "snp-sites"
30+
#define PROGRAM_VERSION "2.0.2"
31+
2932
static void print_usage()
3033
{
3134
printf("Usage: snp_sites [-mvph] [-o output_filename] <file>\n");
@@ -35,9 +38,15 @@ static void print_usage()
3538
printf(" -p output a phylip file\n");
3639
printf(" -o specify an output filename\n");
3740
printf(" -h this help message\n");
41+
printf(" -V print version and exit\n");
3842
printf(" <file> input alignment file which can optionally be gzipped\n");
3943
}
4044

45+
static void print_version()
46+
{
47+
printf("%s %s\n", PROGRAM_NAME, PROGRAM_VERSION);
48+
}
49+
4150
int main (int argc, char **argv) {
4251
char multi_fasta_filename[FILENAME_MAX] = {""};
4352
char output_filename[FILENAME_MAX] = {""};
@@ -48,7 +57,7 @@ int main (int argc, char **argv) {
4857
int output_vcf_file = 0;
4958
int output_phylip_file = 0;
5059

51-
while ((c = getopt (argc, argv, "mvpo:")) != -1)
60+
while ((c = getopt (argc, argv, "mvpo:V")) != -1)
5261
switch (c)
5362
{
5463
case 'm':
@@ -57,6 +66,9 @@ int main (int argc, char **argv) {
5766
case 'v':
5867
output_vcf_file = 1;
5968
break;
69+
case 'V':
70+
print_version();
71+
return 0;
6072
case 'p':
6173
output_phylip_file = 1;
6274
break;

0 commit comments

Comments
 (0)