Reimplementation of Pijul in C, for education, fun and absolutely no profit
#include <stdint.h>
#include <stddef.h>
#include <unistd.h>
#include <string.h>

#include "common.h"
#include "types.h"
#include "repository.h"
#include "db.h"

static void
formatdbpath(char *dst, const char *repodir)
{
	char *p;

	/* TODO find better ways to format paths */
	p = stpncpy(dst, repodir, PATH_MAX);
	*p++ = '/';
	p = stpncpy(p, DOTPIJUL, 6);
	*p++ = '/';
	p = stpncpy(p, "pristine/db", 11);
}

int
cmd_pristine(int argc, char *argv, struct repository *repo)
{
	char dbpath[4096] = { 0 };

	(void)argc;
	(void)argv;

	formatdbpath(dbpath, repo->path);

	dbrun(dbpath);

	return 0;
}