summaryrefslogtreecommitdiffstats
path: root/system_part.h
blob: 9c4cc2688c9d9a1e98c9f3090e94ee556e0defb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef VOLGIT_SYSTEM_PART_H
#define VOLGIT_SYSTEM_PART_H VOLGIT_SYSTEM_PART_H
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>


#define NO_TREE_CUTOFF -1
#define MAX_CUTOFF 1024

extern const char *const default_header;
extern const char *const default_footer;

extern struct Volgit_State
{
	const char *input_path;
	const char *output_path;

	/*pointers to the actual text from the header and footer files*/
	const char *header;
	const char *footer;

	int output_dir_fd;
	int tree_cutoff; /*-1 means no cutoff*/
	_Bool output_is_tree_like;
}state;

void die(const char *format, ...);

void parse_options(int argc,char **argv);
char* read_file(const char *filename);
int create_branch_dir(const char *branch_name);
FILE* create_file(int branch_dir,const char *filename);
void close_file(FILE *file);
int create_dir(int base_dir,const char *dir_name);

void push_html_link_for_blob(FILE *out,const char *filename,const char *oid);
void push_html_link_for_tree(FILE *out,const char *filename,const char *oid);

#endif