4
|
1 #include <assert.h>
|
|
2 #include <ctype.h>
|
|
3 #include <stdlib.h>
|
|
4 #include <limits.h>
|
|
5 #include <zlib.h>
|
|
6 #include <stdio.h>
|
|
7 #include <getopt.h>
|
|
8 #include <string.h>
|
|
9 #include "sickle.h"
|
|
10
|
|
11 void main_usage (int status) {
|
|
12
|
|
13 fprintf (stdout, "\nUsage: %s <command> [options]\n\
|
|
14 \n\
|
|
15 Command:\n\
|
|
16 pe\tpaired-end sequence trimming\n\
|
|
17 se\tsingle-end sequence trimming\n\
|
|
18 \n\
|
|
19 --help, display this help and exit\n\
|
|
20 --version, output version information and exit\n\n", PROGRAM_NAME);
|
|
21
|
|
22 exit (status);
|
|
23 }
|
|
24
|
|
25 int main (int argc, char *argv[]) {
|
|
26 int retval=0;
|
|
27
|
|
28 if (argc < 2 || (strcmp (argv[1],"pe") != 0 && strcmp (argv[1],"se") != 0 && strcmp (argv[1],"--version") != 0 && strcmp (argv[1],"--help") != 0)) {
|
|
29 main_usage (EXIT_FAILURE);
|
|
30 }
|
|
31
|
|
32 if (strcmp (argv[1],"--version") == 0) {
|
|
33 fprintf(stdout, "%s version %0.2f\nCopyright (c) 2011 The Regents of University of California, Davis Campus.\n%s is free software and comes with ABSOLUTELY NO WARRANTY.\nDistributed under the MIT License.\n\nWritten by %s\n", PROGRAM_NAME, VERSION, PROGRAM_NAME, AUTHORS);
|
|
34
|
|
35 exit (EXIT_SUCCESS);
|
|
36
|
|
37 }
|
|
38
|
|
39 else if (strcmp (argv[1],"--help") == 0) {
|
|
40 main_usage (EXIT_SUCCESS);
|
|
41 }
|
|
42
|
|
43 else if (strcmp (argv[1],"pe") == 0) {
|
|
44 retval = paired_main (argc, argv);
|
|
45 return (retval);
|
|
46 }
|
|
47
|
|
48 else if (strcmp (argv[1],"se") == 0) {
|
|
49 retval = single_main (argc, argv);
|
|
50 return (retval);
|
|
51 }
|
|
52
|
|
53 return 0;
|
|
54 }
|