[ ! -f style.css ] && ln -s ../style.css ./
[ ! -f favicon.png ] && ln -s ../favicon.png ./
[ ! -f logo.png ] && ln -s ../logo.png ./
+ [ ! -f highlight ] && ln -s ../highlight ./
echo "git://git.knutsen.co/$repo" > "/srv/git/$repo.git/url"
{
// Ruby script for syntax highlighting.
FILE *child = popen("./highlight", "w");
+ if (child == NULL) {
+ printf("child is null: %s", strerror(errno));
+ exit(1);
+ }
// Give filename:
fprintf(child, "%s\n", filename);
// Give code to highlight:
size_t i;
for (i = 0; *s && i < len; s++, i++) {
if (*s == '\n') lc++;
- fputc(*s, child);
+ fprintf(child, "%c", *s);
}
// Write returned HTML to the HTML file.
char c;
while ((c = fgetc(child)) != EOF)
- fputc(c, fp);
+ fprintf(fp, "%c", c);
pclose(child);
return lc;