summaryrefslogtreecommitdiffabout
path: root/cgit.h
Unidiff
Diffstat (limited to 'cgit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/cgit.h b/cgit.h
index 8927236..4da2d3d 100644
--- a/cgit.h
+++ b/cgit.h
@@ -16,32 +16,51 @@
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_VIEW 5
29#define CMD_BLOB 6 29#define CMD_BLOB 6
30#define CMD_SNAPSHOT 7 30#define CMD_SNAPSHOT 7
31 31
32
33/*
34 * Dateformats used on misc. pages
35 */
36#define FMT_LONGDATE "%Y-%m-%d %H:%M:%S"
37#define FMT_SHORTDATE "%Y-%m-%d"
38
39
40/*
41 * Limits used for relative dates
42 */
43#define TM_MIN 60
44#define TM_HOUR (TM_MIN * 60)
45#define TM_DAY (TM_HOUR * 24)
46#define TM_WEEK (TM_DAY * 7)
47#define TM_YEAR (TM_DAY * 365)
48#define TM_MONTH (TM_YEAR / 12.0)
49
50
32typedef void (*configfn)(const char *name, const char *value); 51typedef void (*configfn)(const char *name, const char *value);
33typedef void (*filepair_fn)(struct diff_filepair *pair); 52typedef void (*filepair_fn)(struct diff_filepair *pair);
34typedef void (*linediff_fn)(char *line, int len); 53typedef void (*linediff_fn)(char *line, int len);
35 54
36struct cacheitem { 55struct cacheitem {
37 char *name; 56 char *name;
38 struct stat st; 57 struct stat st;
39 int ttl; 58 int ttl;
40 int fd; 59 int fd;
41}; 60};
42 61
43struct repoinfo { 62struct repoinfo {
44 char *url; 63 char *url;
45 char *name; 64 char *name;
46 char *path; 65 char *path;
47 char *desc; 66 char *desc;
@@ -168,33 +187,34 @@ extern int cgit_parse_query(char *txt, configfn fn);
168extern struct commitinfo *cgit_parse_commit(struct commit *commit); 187extern struct commitinfo *cgit_parse_commit(struct commit *commit);
169extern struct taginfo *cgit_parse_tag(struct tag *tag); 188extern struct taginfo *cgit_parse_tag(struct tag *tag);
170extern void cgit_parse_url(const char *url); 189extern void cgit_parse_url(const char *url);
171 190
172extern char *cache_safe_filename(const char *unsafe); 191extern char *cache_safe_filename(const char *unsafe);
173extern int cache_lock(struct cacheitem *item); 192extern int cache_lock(struct cacheitem *item);
174extern int cache_unlock(struct cacheitem *item); 193extern int cache_unlock(struct cacheitem *item);
175extern int cache_cancel_lock(struct cacheitem *item); 194extern int cache_cancel_lock(struct cacheitem *item);
176extern int cache_exist(struct cacheitem *item); 195extern int cache_exist(struct cacheitem *item);
177extern int cache_expired(struct cacheitem *item); 196extern int cache_expired(struct cacheitem *item);
178 197
179extern char *cgit_repourl(const char *reponame); 198extern char *cgit_repourl(const char *reponame);
180extern char *cgit_pageurl(const char *reponame, const char *pagename, 199extern char *cgit_pageurl(const char *reponame, const char *pagename,
181 const char *query); 200 const char *query);
182 201
183extern void cgit_print_error(char *msg); 202extern void cgit_print_error(char *msg);
184extern void cgit_print_date(unsigned long secs); 203extern void cgit_print_date(time_t secs, char *format);
204extern void cgit_print_age(time_t t, time_t max_relative, char *format);
185extern void cgit_print_docstart(char *title, struct cacheitem *item); 205extern void cgit_print_docstart(char *title, struct cacheitem *item);
186extern void cgit_print_docend(); 206extern void cgit_print_docend();
187extern void cgit_print_pageheader(char *title, int show_search); 207extern void cgit_print_pageheader(char *title, int show_search);
188extern void cgit_print_snapshot_start(const char *mimetype, 208extern void cgit_print_snapshot_start(const char *mimetype,
189 const char *filename, 209 const char *filename,
190 struct cacheitem *item); 210 struct cacheitem *item);
191 211
192extern void cgit_print_repolist(struct cacheitem *item); 212extern void cgit_print_repolist(struct cacheitem *item);
193extern void cgit_print_summary(); 213extern void cgit_print_summary();
194extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); 214extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path);
195extern void cgit_print_view(const char *hex, char *path); 215extern void cgit_print_view(const char *hex, char *path);
196extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 216extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
197extern void cgit_print_tree(const char *rev, const char *hex, char *path); 217extern void cgit_print_tree(const char *rev, const char *hex, char *path);
198extern void cgit_print_commit(const char *hex); 218extern void cgit_print_commit(const char *hex);
199extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, 219extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex,
200 char *path); 220 char *path);