Package: emmax / 0~beta.20100307-6

aborts.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Author: Steffen Moeller
Last-Update: 2013-06-11
Description: Clean exit when no options are given

Index: emmax-0~beta.20100307/emmax-kin.c
===================================================================
--- emmax-0~beta.20100307.orig/emmax-kin.c
+++ emmax-0~beta.20100307/emmax-kin.c
@@ -46,7 +46,7 @@
 FILE* readfile(char* filename);
 
 void print_help(void) {
-  fprintf(stderr,"Usage: emmax_IBS_kin [tpedf]\n");
+  fprintf(stderr,"Usage: emmax-kin [tpedf]\n");
   fprintf(stderr,"Required parameters\n");
   fprintf(stderr,"\t[tpedf]     : tped file\n");
   fprintf(stderr,"\t[outf]     : output file name\n");
@@ -114,6 +114,12 @@
     }
   }
 
+  // With no options given, present help but do not abort.
+  if (1 == argc) {
+    print_help();
+    exit(-1);
+  }
+
   if ( ( rand_fill_flag == 1 ) && ( hetero_division_flag == 1 ) ) {
     emmax_error("-r and -h option cannot be combined");
   }
Index: emmax-0~beta.20100307/emmax.c
===================================================================
--- emmax-0~beta.20100307.orig/emmax.c
+++ emmax-0~beta.20100307/emmax.c
@@ -200,6 +200,12 @@
     }
   }
 
+  if (1 == argc) {
+    // when called with no arguments, just some help is fine, a crash is not.
+    print_help();
+    exit(-1);
+  }
+
   // Sanity check for the number of required parameters
   if ( argc > optind ) {
     print_help();
@@ -1580,7 +1586,6 @@
   fprintf(stderr,"\t-k [kinf] : n * n matrix containing kinship values in the individual order consistent to [tpedf].tfam file. [tpedf].kinf will be used if not specified\n");
   fprintf(stderr,"\t-c [covf] : multi-column covariate file with FAMID, INDID at the first two colmns, in the same order of .tfam file");
   fprintf(stderr,"Optional parameters\n");
-  fprintf(stderr,"Optional parameters\n");
   fprintf(stderr,"\t-i [in_prefix] : input file name prefix including eigenvectors\n");
   fprintf(stderr,"\t-d [# digits]  : precision of the output values (default : 5)\n");
   fprintf(stderr,"\t-s [start index of SNP] : start index of SNP (default : 0)\n");