summaryrefslogtreecommitdiffabout
path: root/cgit.h
Unidiff
Diffstat (limited to 'cgit.h') (more/less context) (show whitespace changes)
-rw-r--r--cgit.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/cgit.h b/cgit.h
index 2f3fca1..b93e2e8 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,78 +1,77 @@
1#ifndef CGIT_H 1#ifndef CGIT_H
2#define CGIT_H 2#define CGIT_H
3 3
4 4
5#include <git-compat-util.h> 5#include <git-compat-util.h>
6#include <cache.h> 6#include <cache.h>
7#include <grep.h> 7#include <grep.h>
8#include <object.h> 8#include <object.h>
9#include <tree.h> 9#include <tree.h>
10#include <commit.h> 10#include <commit.h>
11#include <tag.h> 11#include <tag.h>
12#include <diff.h> 12#include <diff.h>
13#include <diffcore.h> 13#include <diffcore.h>
14#include <refs.h> 14#include <refs.h>
15#include <revision.h> 15#include <revision.h>
16#include <log-tree.h> 16#include <log-tree.h>
17#include <archive.h> 17#include <archive.h>
18#include <xdiff/xdiff.h> 18#include <xdiff/xdiff.h>
19 19
20 20
21/* 21/*
22 * The valid cgit repo-commands 22 * The valid cgit repo-commands
23 */ 23 */
24#define CMD_LOG 1 24#define CMD_LOG 1
25#define CMD_COMMIT 2 25#define CMD_COMMIT 2
26#define CMD_DIFF 3 26#define CMD_DIFF 3
27#define CMD_TREE 4 27#define CMD_TREE 4
28#define CMD_VIEW 5 28#define CMD_BLOB 5
29#define CMD_BLOB 6 29#define CMD_SNAPSHOT 6
30#define CMD_SNAPSHOT 7
31 30
32 31
33/* 32/*
34 * Dateformats used on misc. pages 33 * Dateformats used on misc. pages
35 */ 34 */
36#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S" 35#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
37#define FMT_SHORTDATE "%Y-%m-%d" 36#define FMT_SHORTDATE "%Y-%m-%d"
38 37
39 38
40/* 39/*
41 * Limits used for relative dates 40 * Limits used for relative dates
42 */ 41 */
43#define TM_MIN 60 42#define TM_MIN 60
44#define TM_HOUR (TM_MIN * 60) 43#define TM_HOUR (TM_MIN * 60)
45#define TM_DAY (TM_HOUR * 24) 44#define TM_DAY (TM_HOUR * 24)
46#define TM_WEEK (TM_DAY * 7) 45#define TM_WEEK (TM_DAY * 7)
47#define TM_YEAR (TM_DAY * 365) 46#define TM_YEAR (TM_DAY * 365)
48#define TM_MONTH (TM_YEAR / 12.0) 47#define TM_MONTH (TM_YEAR / 12.0)
49 48
50 49
51typedef void (*configfn)(const char *name, const char *value); 50typedef void (*configfn)(const char *name, const char *value);
52typedef void (*filepair_fn)(struct diff_filepair *pair); 51typedef void (*filepair_fn)(struct diff_filepair *pair);
53typedef void (*linediff_fn)(char *line, int len); 52typedef void (*linediff_fn)(char *line, int len);
54 53
55struct cacheitem { 54struct cacheitem {
56 char *name; 55 char *name;
57 struct stat st; 56 struct stat st;
58 int ttl; 57 int ttl;
59 int fd; 58 int fd;
60}; 59};
61 60
62struct repoinfo { 61struct repoinfo {
63 char *url; 62 char *url;
64 char *name; 63 char *name;
65 char *path; 64 char *path;
66 char *desc; 65 char *desc;
67 char *owner; 66 char *owner;
68 char *defbranch; 67 char *defbranch;
69 char *group; 68 char *group;
70 char *module_link; 69 char *module_link;
71 char *readme; 70 char *readme;
72 int snapshots; 71 int snapshots;
73 int enable_log_filecount; 72 int enable_log_filecount;
74 int enable_log_linecount; 73 int enable_log_linecount;
75}; 74};
76 75
77struct repolist { 76struct repolist {
78 int length; 77 int length;
@@ -170,59 +169,58 @@ extern void cgit_diff_tree(const unsigned char *old_sha1,
170 const unsigned char *new_sha1, 169 const unsigned char *new_sha1,
171 filepair_fn fn); 170 filepair_fn fn);
172 171
173extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); 172extern void cgit_diff_commit(struct commit *commit, filepair_fn fn);
174 173
175extern char *fmt(const char *format,...); 174extern char *fmt(const char *format,...);
176 175
177extern void html(const char *txt); 176extern void html(const char *txt);
178extern void htmlf(const char *format,...); 177extern void htmlf(const char *format,...);
179extern void html_txt(char *txt); 178extern void html_txt(char *txt);
180extern void html_ntxt(int len, char *txt); 179extern void html_ntxt(int len, char *txt);
181extern void html_attr(char *txt); 180extern void html_attr(char *txt);
182extern void html_hidden(char *name, char *value); 181extern void html_hidden(char *name, char *value);
183extern void html_link_open(char *url, char *title, char *class); 182extern void html_link_open(char *url, char *title, char *class);
184extern void html_link_close(void); 183extern void html_link_close(void);
185extern void html_filemode(unsigned short mode); 184extern void html_filemode(unsigned short mode);
186extern int html_include(const char *filename); 185extern int html_include(const char *filename);
187 186
188extern int cgit_read_config(const char *filename, configfn fn); 187extern int cgit_read_config(const char *filename, configfn fn);
189extern int cgit_parse_query(char *txt, configfn fn); 188extern int cgit_parse_query(char *txt, configfn fn);
190extern struct commitinfo *cgit_parse_commit(struct commit *commit); 189extern struct commitinfo *cgit_parse_commit(struct commit *commit);
191extern struct taginfo *cgit_parse_tag(struct tag *tag); 190extern struct taginfo *cgit_parse_tag(struct tag *tag);
192extern void cgit_parse_url(const char *url); 191extern void cgit_parse_url(const char *url);
193 192
194extern char *cache_safe_filename(const char *unsafe); 193extern char *cache_safe_filename(const char *unsafe);
195extern int cache_lock(struct cacheitem *item); 194extern int cache_lock(struct cacheitem *item);
196extern int cache_unlock(struct cacheitem *item); 195extern int cache_unlock(struct cacheitem *item);
197extern int cache_cancel_lock(struct cacheitem *item); 196extern int cache_cancel_lock(struct cacheitem *item);
198extern int cache_exist(struct cacheitem *item); 197extern int cache_exist(struct cacheitem *item);
199extern int cache_expired(struct cacheitem *item); 198extern int cache_expired(struct cacheitem *item);
200 199
201extern char *cgit_repourl(const char *reponame); 200extern char *cgit_repourl(const char *reponame);
202extern char *cgit_pageurl(const char *reponame, const char *pagename, 201extern char *cgit_pageurl(const char *reponame, const char *pagename,
203 const char *query); 202 const char *query);
204 203
205extern void cgit_print_error(char *msg); 204extern void cgit_print_error(char *msg);
206extern void cgit_print_date(time_t secs, char *format); 205extern void cgit_print_date(time_t secs, char *format);
207extern void cgit_print_age(time_t t, time_t max_relative, char *format); 206extern void cgit_print_age(time_t t, time_t max_relative, char *format);
208extern void cgit_print_docstart(char *title, struct cacheitem *item); 207extern void cgit_print_docstart(char *title, struct cacheitem *item);
209extern void cgit_print_docend(); 208extern void cgit_print_docend();
210extern void cgit_print_pageheader(char *title, int show_search); 209extern void cgit_print_pageheader(char *title, int show_search);
211extern void cgit_print_snapshot_start(const char *mimetype, 210extern void cgit_print_snapshot_start(const char *mimetype,
212 const char *filename, 211 const char *filename,
213 struct cacheitem *item); 212 struct cacheitem *item);
214 213
215extern void cgit_print_repolist(struct cacheitem *item); 214extern void cgit_print_repolist(struct cacheitem *item);
216extern void cgit_print_summary(); 215extern void cgit_print_summary();
217extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); 216extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager);
218extern void cgit_print_view(const char *hex, char *path);
219extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 217extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
220extern void cgit_print_tree(const char *rev, const char *hex, char *path); 218extern void cgit_print_tree(const char *rev, char *path);
221extern void cgit_print_commit(const char *hex); 219extern void cgit_print_commit(const char *hex);
222extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, 220extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex,
223 char *path); 221 char *path);
224extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, 222extern void cgit_print_snapshot(struct cacheitem *item, const char *hex,
225 const char *format, const char *prefix, 223 const char *format, const char *prefix,
226 const char *filename); 224 const char *filename);
227 225
228#endif /* CGIT_H */ 226#endif /* CGIT_H */