/* ui-blob.c: show blob content
*
* Copyright (C) 2008 Lars Hjemli
* Copyright (C) 2010 Jason A. Donenfeld <Jason@zx2c4.com>
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
#include "html.h"
#include "ui-shared.h"
struct walk_tree_context {
char *match_path;
unsigned char *matched_sha1;
int found_path;
};
static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
const char *pathname, unsigned mode, int stage, void *cbdata)
{
struct walk_tree_context *walk_tree_ctx = cbdata;
if (strncmp(base, walk_tree_ctx->match_path, baselen)
|| strcmp(walk_tree_ctx->match_path + baselen, pathname))
return READ_TREE_RECURSIVE;
memmove(walk_tree_ctx->matched_sha1, sha1, 20);
walk_tree_ctx->found_path = 1;
return 0;
}
int cgit_print_file(char *path, const char<