Next version of JABA
[jabaws.git] / binaries / src / mafft / core / seq2regtable.c
1 #include "mltaln.h"
2
3 #define DEBUG 0
4
5 char *weboutfile = NULL;
6
7
8 void arguments( int argc, char *argv[] )
9 {
10     int c;
11
12     while( --argc > 0 && (*++argv)[0] == '-' )
13         {
14         while ( (c = *++argv[0]) )
15                 {
16             switch( c )
17             {
18                                 case 'i':
19                                         inputfile = *++argv;
20                                         fprintf( stderr, "inputfile = %s\n", inputfile );
21                                         --argc;
22                                         goto nextoption;
23                                 case 'w':
24                                         weboutfile = *++argv;
25                                         fprintf( stderr, "weboutfile = %s\n", weboutfile );
26                                         --argc;
27                                         goto nextoption;
28                 default:
29                     fprintf( stderr, "illegal option %c\n", c );
30                     argc = 0;
31                     break;
32             }
33                 }
34                 nextoption:
35                         ;
36         }
37     if( argc != 0 ) 
38     {
39         fprintf( stderr, "options: Check source file !\n" );
40         exit( 1 );
41     }
42 }
43
44
45 int main( int argc, char *argv[] )
46 {
47         FILE *infp;
48         FILE *weboutfp;
49         int nlenmin;
50         int isaligned = 0;
51
52         arguments( argc, argv );
53
54         if( inputfile )
55         {
56                 infp = fopen( inputfile, "r" );
57                 if( !infp )
58                 {
59                         fprintf( stderr, "Cannot open %s\n", inputfile );
60                         exit( 1 );
61                 }
62         }
63         else
64                 infp = stdin;
65
66         if( weboutfile )
67         {
68                 weboutfp = fopen( weboutfile, "w" );
69                 if( !weboutfp )
70                 {
71                         fprintf( stderr, "Cannot open %s\n", weboutfp );
72                         exit( 1 );
73                 }
74         }
75
76         dorp = NOTSPECIFIED;
77         if( weboutfile )
78         {
79                 getnumlen_nogap_outallreg_web( infp, weboutfp, &nlenmin, &isaligned );
80                 if( isaligned ) fprintf( stdout, "Aligned\n" );
81                 else fprintf( stdout, "Not aligned\n" );
82         }
83         else
84                 getnumlen_nogap_outallreg( infp, &nlenmin );
85
86 }