--- trunk/main.c 2007/11/27 22:26:32 81 +++ trunk/main.c 2008/09/20 23:27:14 174 @@ -1,6 +1,6 @@ /* main.c - JSCoverage main routine - Copyright (C) 2007 siliconforks.com + Copyright (C) 2007, 2008 siliconforks.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,16 +17,20 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + #include #include #include -#include "config.h" +#include "global.h" #include "instrument.h" #include "instrument-js.h" #include "resource-manager.h" #include "util.h" +const char * jscoverage_encoding = "ISO-8859-1"; + int main(int argc, char ** argv) { int verbose = 0; @@ -36,10 +40,10 @@ char * source = NULL; char * destination = NULL; - char ** no_instrument = xmalloc((argc - 1) * sizeof(char *)); + char ** no_instrument = xnew(char *, argc - 1); int num_no_instrument = 0; - char ** exclude = xmalloc((argc - 1) * sizeof(char *)); + char ** exclude = xnew(char *, argc - 1); int num_exclude = 0; for (int i = 1; i < argc; i++) { @@ -78,6 +82,16 @@ exclude[num_exclude] = argv[i] + 10; num_exclude++; } + else if (strcmp(argv[i], "--encoding") == 0) { + i++; + if (i == argc) { + fatal("--encoding: option requires an argument"); + } + jscoverage_encoding = argv[i]; + } + else if (strncmp(argv[i], "--encoding=", 11) == 0) { + jscoverage_encoding = argv[i] + 11; + } else if (strncmp(argv[i], "-", 1) == 0) { fatal("unrecognized option `%s'", argv[i]); }