|
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 | |
32 | typedef void (*configfn)(const char *name, const char *value); |
51 | typedef void (*configfn)(const char *name, const char *value); |
33 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
52 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
34 | typedef void (*linediff_fn)(char *line, int len); |
53 | typedef void (*linediff_fn)(char *line, int len); |
35 | |
54 | |
36 | struct cacheitem { |
55 | struct 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 | |
43 | struct repoinfo { |
62 | struct 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); |
168 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
187 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
169 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
188 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
170 | extern void cgit_parse_url(const char *url); |
189 | extern void cgit_parse_url(const char *url); |
171 | |
190 | |
172 | extern char *cache_safe_filename(const char *unsafe); |
191 | extern char *cache_safe_filename(const char *unsafe); |
173 | extern int cache_lock(struct cacheitem *item); |
192 | extern int cache_lock(struct cacheitem *item); |
174 | extern int cache_unlock(struct cacheitem *item); |
193 | extern int cache_unlock(struct cacheitem *item); |
175 | extern int cache_cancel_lock(struct cacheitem *item); |
194 | extern int cache_cancel_lock(struct cacheitem *item); |
176 | extern int cache_exist(struct cacheitem *item); |
195 | extern int cache_exist(struct cacheitem *item); |
177 | extern int cache_expired(struct cacheitem *item); |
196 | extern int cache_expired(struct cacheitem *item); |
178 | |
197 | |
179 | extern char *cgit_repourl(const char *reponame); |
198 | extern char *cgit_repourl(const char *reponame); |
180 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
199 | extern char *cgit_pageurl(const char *reponame, const char *pagename, |
181 | const char *query); |
200 | const char *query); |
182 | |
201 | |
183 | extern void cgit_print_error(char *msg); |
202 | extern void cgit_print_error(char *msg); |
184 | extern void cgit_print_date(unsigned long secs); |
203 | extern void cgit_print_date(time_t secs, char *format); |
| |
204 | extern void cgit_print_age(time_t t, time_t max_relative, char *format); |
185 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
205 | extern void cgit_print_docstart(char *title, struct cacheitem *item); |
186 | extern void cgit_print_docend(); |
206 | extern void cgit_print_docend(); |
187 | extern void cgit_print_pageheader(char *title, int show_search); |
207 | extern void cgit_print_pageheader(char *title, int show_search); |
188 | extern void cgit_print_snapshot_start(const char *mimetype, |
208 | extern 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 | |
192 | extern void cgit_print_repolist(struct cacheitem *item); |
212 | extern void cgit_print_repolist(struct cacheitem *item); |
193 | extern void cgit_print_summary(); |
213 | extern void cgit_print_summary(); |
194 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); |
214 | extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path); |
195 | extern void cgit_print_view(const char *hex, char *path); |
215 | extern void cgit_print_view(const char *hex, char *path); |
196 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
216 | extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); |
197 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); |
217 | extern void cgit_print_tree(const char *rev, const char *hex, char *path); |
198 | extern void cgit_print_commit(const char *hex); |
218 | extern void cgit_print_commit(const char *hex); |
199 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, |
219 | extern void cgit_print_diff(const char *head, const char *old_hex, const char *new_hex, |
200 | char *path); |
220 | char *path); |
|