1bfb274ad7bd54f120b88f2cb7b7b73811df6d9b
[jabaws.git] / binaries / src / muscle / main.cpp
1 //@@TODO reconcile /muscle with /muscle3.6\r
2 \r
3 #include "muscle.h"\r
4 #include <stdio.h>\r
5 #ifdef  WIN32\r
6 #include <windows.h>    // for SetPriorityClass()\r
7 #include <io.h>                 // for isatty()\r
8 #else\r
9 #include <unistd.h>             // for isatty()\r
10 #endif\r
11 \r
12 int g_argc;\r
13 char **g_argv;\r
14 \r
15 int main(int argc, char **argv)\r
16         {\r
17 #if     WIN32\r
18 // Multi-tasking does not work well in CPU-bound\r
19 // console apps running under Win32.\r
20 // Reducing the process priority allows GUI apps\r
21 // to run responsively in parallel.\r
22         SetPriorityClass(GetCurrentProcess(), BELOW_NORMAL_PRIORITY_CLASS);\r
23 #endif\r
24         g_argc = argc;\r
25         g_argv = argv;\r
26 \r
27         SetNewHandler();\r
28         SetStartTime();\r
29         ProcessArgVect(argc - 1, argv + 1);\r
30         SetParams();\r
31         SetLogFile();\r
32 \r
33         //extern void TestSubFams(const char *);\r
34         //TestSubFams(g_pstrInFileName);\r
35         //return 0;\r
36 \r
37         if (g_bVersion)\r
38                 {\r
39                 printf(MUSCLE_LONG_VERSION "\n");\r
40                 exit(EXIT_SUCCESS);\r
41                 }\r
42 \r
43         if (!g_bQuiet)\r
44                 Credits();\r
45 \r
46         if (MissingCommand() && isatty(0))\r
47                 {\r
48                 Usage();\r
49                 exit(EXIT_SUCCESS);\r
50                 }\r
51 \r
52         if (g_bCatchExceptions)\r
53                 {\r
54                 try\r
55                         {\r
56                         Run();\r
57                         }\r
58                 catch (...)\r
59                         {\r
60                         OnException();\r
61                         exit(EXIT_Except);\r
62                         }\r
63                 }\r
64         else\r
65                 Run();\r
66 \r
67         exit(EXIT_Success);\r
68         }\r