xmlencodeline(FILE *fp, const char *s, size_t len)
{
size_t i;
-
- for (i = 0; *s && i < len; s++, i++) {
- switch(*s) {
- case '<': fputs("<", fp); break;
- case '>': fputs(">", fp); break;
- case '\'': fputs("'", fp); break;
- case '&': fputs("&", fp); break;
- case '"': fputs(""", fp); break;
- case '\r': break; /* ignore CR */
- case '\n': break; /* ignore LF */
- default: putc(*s, fp);
- }
- }
-}
-
-/* Escape characters below as HTML 2.0 / XML 1.0, ignore printing '\n', '\r' */
-void
-xmlencodeline(FILE *fp, const char *s, size_t len)
-{
- size_t i;
-
- for (i = 0; *s && i < len; s++, i++) {
- switch(*s) {
- case '<': fputs("<", fp); break;
- case '>': fputs(">", fp); break;
- case '\'': fputs("'", fp); break;
- case '&': fputs("&", fp); break;
- case '"': fputs(""", fp); break;
- case '\r': break; /* ignore CR */
- case '\n': break; /* ignore LF */
- default: putc(*s, fp);
- }
- }
-}
-
-/* Escape characters below as HTML 2.0 / XML 1.0, ignore printing '\n', '\r' */
-void
-xmlencodeline(FILE *fp, const char *s, size_t len)
-{
- size_t i;
-
for (i = 0; *s && i < len; s++, i++) {
switch(*s) {
case '<': fputs("<", fp); break;
name, relpath);
fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath);
fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%ssyntax.css\" />\n", relpath);
- fputs("</head>\n<body>\n<table><tr><td>", fp);
- fprintf(fp, "<a href=\"../%s\"><img alt=\"Home\" src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
+ fputs("</head>\n<body>\n", fp);
+ fprintf(fp, "<a href=\"../%s\"><img class=\"logo\" src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>",
relpath, relpath);
- fputs("</td><td><h1>", fp);
+ fputs("<h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
- fputs("</h1></td></tr><tr><td></td><td><span class=\"desc\">", fp);
+ fputs("</h1><p class=\"desc\">", fp);
xmlencode(fp, description, strlen(description));
- fputs("</span></td></tr>", fp);
+ fputs("</p>", fp);
if (cloneurl[0]) {
- fputs("<tr class=\"url\"><td></td><td><span class=\"clone\">git clone <a href=\"", fp);
+ fputs("<p class=\"clone\">git clone <a href=\"", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
fputs("\">", fp);
xmlencode(fp, cloneurl, strlen(cloneurl));
- fputs("</a></span></td></tr>", fp);
+ fputs("</a></p>", fp);
}
- fputs("<tr><td></td><td>\n", fp);
fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
relpath, license);
fprintf(fp, " | <a href=\"%s%s.tar.gz\">Download</a>",
relpath, strippedname);
- fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp);
+ fputs("<hr/>\n<div id=\"content\">\n", fp);
}
void
#else
fprintf(fp, "<pre>%s</pre>", s);
#endif
+ free(html);
}
void
xmlencode(fp, ci->author->email, strlen(ci->author->email));
fputs("</a>>\n<b>Date:</b> ", fp);
printtime(fp, &(ci->author->when));
- fputc('\n', fp);
+ putc('\n', fp);
}
if (ci->msg) {
- fputc('\n', fp);
+ putc('\n', fp);
xmlencode(fp, ci->msg, strlen(ci->msg));
- fputc('\n', fp);
+ putc('\n', fp);
}
}
git_revwalk_new(&w, repo);
git_revwalk_push(w, oid);
- git_revwalk_simplify_first_parent(w);
while (!git_revwalk_next(&id, w)) {
relpath = "";
xmlencode(fp, ci->author->email, strlen(ci->author->email));
fputs(">\nDate: ", fp);
printtime(fp, &(ci->author->when));
- fputc('\n', fp);
+ putc('\n', fp);
}
if (ci->msg) {
- fputc('\n', fp);
+ putc('\n', fp);
xmlencode(fp, ci->msg, strlen(ci->msg));
}
fputs("\n</content>\n</entry>\n", fp);
git_revwalk_new(&w, repo);
git_revwalk_push_head(w);
- git_revwalk_simplify_first_parent(w);
for (i = 0; i < m && !git_revwalk_next(&id, w); i++) {
if (!(ci = commitinfo_getbyoid(&id)))
void
usage(char *argv0)
{
- fprintf(stderr, "%s [-c cachefile | -l commits] repodir\n", argv0);
+ fprintf(stderr, "%s [-c cachefile | -l commits] "
+ "[-u baseurl] repodir\n", argv0);
exit(1);
}
if (argv[i][0] == '\0' || *p != '\0' ||
nlogcommits <= 0 || errno)
usage(argv[0]);
+ } else if (argv[i][1] == 'u') {
+ if (i + 1 >= argc)
+ usage(argv[0]);
+ baseurl = argv[++i];
}
}
if (!repodir)
}
#endif
- if ((p = getenv("STAGIT_BASEURL")))
- baseurl = p;
-
if (git_repository_open_ext(&repo, repodir,
GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
fprintf(stderr, "%s: cannot open repository\n", argv[0]);
/* cleanup */
git_repository_free(repo);
git_libgit2_shutdown();
+ free(strippedname);
return 0;
}