]> git.armaanb.net Git - stagit.git/blobdiff - stagit-index.c
bump version to 0.5
[stagit.git] / stagit-index.c
index 1d26e0f9a37172ef191acd884df3cea1bbd21f92..1834d8db5e2775b475928dad5b5946dd1b19ee10 100644 (file)
@@ -12,7 +12,6 @@
 #include <git2.h>
 
 #include "compat.h"
-#include "config.h"
 
 static git_repository *repo;
 
@@ -23,6 +22,26 @@ 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)
@@ -55,7 +74,7 @@ printtimeshort(FILE *fp, const git_time *intime)
        fputs(out, fp);
 }
 
-int
+void
 writeheader(FILE *fp)
 {
        fputs("<!DOCTYPE html>\n"
@@ -73,14 +92,12 @@ writeheader(FILE *fp)
              "<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
@@ -134,18 +151,6 @@ err:
        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[])
 {
@@ -154,6 +159,9 @@ main(int argc, char *argv[])
        char path[PATH_MAX], repodirabs[PATH_MAX + 1];
        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;