/[jscoverage]/trunk/main.c
ViewVC logotype

Diff of /trunk/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 87 by siliconforks, Mon May 5 20:05:27 2008 UTC revision 191 by siliconforks, Tue Sep 23 03:49:29 2008 UTC
# Line 17  Line 17 
17      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */  */
19    
20    #include <config.h>
21    
22  #include <stdio.h>  #include <stdio.h>
23  #include <stdlib.h>  #include <stdlib.h>
24  #include <string.h>  #include <string.h>
25    
26  #include "config.h"  #include "global.h"
27  #include "instrument.h"  #include "instrument.h"
28  #include "instrument-js.h"  #include "instrument-js.h"
29  #include "resource-manager.h"  #include "resource-manager.h"
30  #include "util.h"  #include "util.h"
31    
32    const char * jscoverage_encoding = "ISO-8859-1";
33    bool jscoverage_highlight = true;
34    
35  int main(int argc, char ** argv) {  int main(int argc, char ** argv) {
36    int verbose = 0;    int verbose = 0;
37    
# Line 36  Line 41 
41    char * source = NULL;    char * source = NULL;
42    char * destination = NULL;    char * destination = NULL;
43    
44    char ** no_instrument = xmalloc((argc - 1) * sizeof(char *));    char ** no_instrument = xnew(char *, argc - 1);
45    int num_no_instrument = 0;    int num_no_instrument = 0;
46    
47    char ** exclude = xmalloc((argc - 1) * sizeof(char *));    char ** exclude = xnew(char *, argc - 1);
48    int num_exclude = 0;    int num_exclude = 0;
49    
50    for (int i = 1; i < argc; i++) {    for (int i = 1; i < argc; i++) {
# Line 54  Line 59 
59      else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {      else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {
60        verbose = 1;        verbose = 1;
61      }      }
62        else if (strcmp(argv[i], "--no-highlight") == 0) {
63          jscoverage_highlight = false;
64        }
65      else if (strcmp(argv[i], "--no-instrument") == 0) {      else if (strcmp(argv[i], "--no-instrument") == 0) {
66        i++;        i++;
67        if (i == argc) {        if (i == argc) {
68          fatal("--no-instrument: option requires an argument");          fatal_command_line("--no-instrument: option requires an argument");
69        }        }
70        no_instrument[num_no_instrument] = argv[i];        no_instrument[num_no_instrument] = argv[i];
71        num_no_instrument++;        num_no_instrument++;
# Line 69  Line 77 
77      else if (strcmp(argv[i], "--exclude") == 0) {      else if (strcmp(argv[i], "--exclude") == 0) {
78        i++;        i++;
79        if (i == argc) {        if (i == argc) {
80          fatal("--exclude: option requires an argument");          fatal_command_line("--exclude: option requires an argument");
81        }        }
82        exclude[num_exclude] = argv[i];        exclude[num_exclude] = argv[i];
83        num_exclude++;        num_exclude++;
# Line 78  Line 86 
86        exclude[num_exclude] = argv[i] + 10;        exclude[num_exclude] = argv[i] + 10;
87        num_exclude++;        num_exclude++;
88      }      }
89        else if (strcmp(argv[i], "--encoding") == 0) {
90          i++;
91          if (i == argc) {
92            fatal_command_line("--encoding: option requires an argument");
93          }
94          jscoverage_encoding = argv[i];
95        }
96        else if (strncmp(argv[i], "--encoding=", 11) == 0) {
97          jscoverage_encoding = argv[i] + 11;
98        }
99      else if (strncmp(argv[i], "-", 1) == 0) {      else if (strncmp(argv[i], "-", 1) == 0) {
100        fatal("unrecognized option `%s'", argv[i]);        fatal_command_line("unrecognized option `%s'", argv[i]);
101      }      }
102      else if (source == NULL) {      else if (source == NULL) {
103        source = argv[i];        source = argv[i];
# Line 88  Line 106 
106        destination = argv[i];        destination = argv[i];
107      }      }
108      else {      else {
109        fatal("too many arguments");        fatal_command_line("too many arguments");
110      }      }
111    }    }
112    
113    if (source == NULL || destination == NULL) {    if (source == NULL || destination == NULL) {
114      fatal("missing argument");      fatal_command_line("missing argument");
115    }    }
116    
117    source = make_canonical_path(source);    source = make_canonical_path(source);

Legend:
Removed from v.87  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.24