diff -r c59fe73459fd -r 7ce5c4b51959 src/c2html.c --- a/src/c2html.c Wed Jul 10 13:38:28 2013 +0200 +++ b/src/c2html.c Wed Jul 10 13:45:26 2013 +0200 @@ -47,6 +47,7 @@ typedef struct { char* outfilename; char* infilename; + int highlight; } settings_t; typedef struct { @@ -227,15 +228,19 @@ settings_t settings; settings.outfilename = NULL; + settings.highlight = 1; char optc; - while ((optc = getopt(argc, argv, "ho:")) != -1) { + while ((optc = getopt(argc, argv, "ho:p")) != -1) { switch (optc) { case 'o': if (!(optarg[0] == '-' && optarg[1] == 0)) { settings.outfilename = optarg; } break; + case 'p': + settings.highlight = 0; + break; case 'h': printhelp(); return 0; @@ -259,10 +264,15 @@ fout = stdout; } fprintf(fout, "
\n");
-      char *line = (char*) malloc(inputfile->maxlinewidth*64);
+      char *line = (char*) malloc(inputfile->maxlinewidth
+          * (settings.highlight?64:0));
       int lnw = lnint(inputfile->count);
       for (int i = 0 ; i < inputfile->count ; i++) {
-        parseline(inputfile->lines[i], line);
+        if (settings.highlight) {
+          parseline(inputfile->lines[i], line);
+        } else {
+          line = inputfile->lines[i];
+        }
         fprintf(fout, "%*d: %s",
             lnw, i, line);
       }