#include <git2.h>
#include "compat.h"
-#include "config.h"
static git_repository *repo;
static const char *relpath = "";
-static const char *repodir;
static char description[255] = "Repositories";
static char *name = "";
static char owner[255];
+#ifndef USE_PLEDGE
+int
+pledge(const char *promises, const char *paths[])
+{
+ return 0;
+}
+#endif
+
+void
+joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
+{
+ int r;
+
+ r = snprintf(buf, bufsiz, "%s%s%s",
+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
+ if (r == -1 || (size_t)r >= bufsiz)
+ errx(1, "path truncated: '%s%s%s'",
+ path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
+}
+
/* Escape characters below as HTML 2.0 / XML 1.0. */
void
xmlencode(FILE *fp, const char *s, size_t len)
fputs(out, fp);
}
-int
+void
writeheader(FILE *fp)
{
fputs("<!DOCTYPE html>\n"
"<table id=\"index\"><thead>\n"
"<tr><td>Name</td><td>Description</td><td>Owner</td><td>Last commit</td></tr>"
"</thead><tbody>\n", fp);
-
- return 0;
}
-int
+void
writefooter(FILE *fp)
{
- return !fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp);
+ fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp);
}
int
return ret;
}
-void
-joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
-{
- int r;
-
- r = snprintf(buf, bufsiz, "%s%s%s",
- repodir, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
- if (r == -1 || (size_t)r >= bufsiz)
- errx(1, "path truncated: '%s%s%s'",
- path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
-}
-
int
main(int argc, char *argv[])
{
const git_error *e = NULL;
FILE *fp;
char path[PATH_MAX], repodirabs[PATH_MAX + 1];
+ const char *repodir;
int i, ret = 0;
+ if (pledge("stdio rpath", NULL) == -1)
+ err(1, "pledge");
+
if (argc < 2) {
fprintf(stderr, "%s [repodir...]\n", argv[0]);
return 1;