]> git.armaanb.net Git - stagit.git/blobdiff - stagit.c
Added syntax highlighting.
[stagit.git] / stagit.c
index 9a8ccd0245b1e55af35fad1dd86f3477ec779e22..bb64869c5ac99adcbd444805d8672adfe1fdbd28 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -397,12 +397,14 @@ writefooter(FILE *fp)
 int
 syntax_highlight(const char *filename, FILE *fp, const char *s, size_t len)
 {
+       // Flush HTML-file
+       fflush(fp);
        // Copy STDOUT
        int stdout_copy = dup(1);
        // Redirect STDOUT
        dup2(fileno(fp), 1);
 
-       // Ruby script for syntax highlighting.
+       // Python Pygments script for syntax highlighting.
        FILE *child = popen("./highlight", "w");
        if (child == NULL) {
                printf("child is null: %s", strerror(errno));
@@ -419,6 +421,7 @@ syntax_highlight(const char *filename, FILE *fp, const char *s, size_t len)
        }
 
        pclose(child);
+       fflush(stdout);
        // Give back STDOUT.
        dup2(stdout_copy, 1);
        return lc;