summaryrefslogtreecommitdiffabout
path: root/cgit.h
authorLars Hjemli <hjemli@gmail.com>2006-12-16 12:33:32 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2006-12-16 12:38:45 (UTC)
commit521dc7a4bf4af6115ffc3a94d447689bbaa22272 (patch) (unidiff)
treecacb8ba6567e4f36a588d0e659318e0acbc7ea75 /cgit.h
parenta1a79998f22fe8279be51fc1d31bfcf14031c109 (diff)
downloadcgit-521dc7a4bf4af6115ffc3a94d447689bbaa22272.zip
cgit-521dc7a4bf4af6115ffc3a94d447689bbaa22272.tar.gz
cgit-521dc7a4bf4af6115ffc3a94d447689bbaa22272.tar.bz2
Add argument parsing + switch for uncached operation
This adds support for the following options to cgit: --root=<path> --cache=<path> --nocache --query=<querystring> --repo=<reponame> --page=<pagename> --head=<branchname> --sha1=<sha1> --ofs=<number> On startup, /etc/cgitrc is parsed, followed by argument parsing and finally querystring parsing. If --nocache is specified (or set in /etc/gitrc), caching is disabled and cgit instead generates pages to stdout. The combined effect of these two changes makes testing/debugging a lot less painfull. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.h') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/cgit.h b/cgit.h
index a54f2b5..b6b60c6 100644
--- a/cgit.h
+++ b/cgit.h
@@ -1,100 +1,101 @@
1#ifndef CGIT_H 1#ifndef CGIT_H
2#define CGIT_H 2#define CGIT_H
3 3
4#include "git.h" 4#include "git.h"
5#include <openssl/sha.h> 5#include <openssl/sha.h>
6#include <ctype.h> 6#include <ctype.h>
7#include <sched.h> 7#include <sched.h>
8 8
9typedef void (*configfn)(const char *name, const char *value); 9typedef void (*configfn)(const char *name, const char *value);
10 10
11struct cacheitem { 11struct cacheitem {
12 char *name; 12 char *name;
13 struct stat st; 13 struct stat st;
14 int ttl; 14 int ttl;
15 int fd; 15 int fd;
16}; 16};
17 17
18struct commitinfo { 18struct commitinfo {
19 struct commit *commit; 19 struct commit *commit;
20 char *author; 20 char *author;
21 char *committer; 21 char *committer;
22 char *subject; 22 char *subject;
23 char *msg; 23 char *msg;
24}; 24};
25 25
26extern const char cgit_version[]; 26extern const char cgit_version[];
27 27
28extern char *cgit_root; 28extern char *cgit_root;
29extern char *cgit_root_title; 29extern char *cgit_root_title;
30extern char *cgit_css; 30extern char *cgit_css;
31extern char *cgit_logo; 31extern char *cgit_logo;
32extern char *cgit_logo_link; 32extern char *cgit_logo_link;
33extern char *cgit_virtual_root; 33extern char *cgit_virtual_root;
34extern char *cgit_cache_root; 34extern char *cgit_cache_root;
35 35
36extern int cgit_nocache;
36extern int cgit_max_lock_attempts; 37extern int cgit_max_lock_attempts;
37extern int cgit_cache_root_ttl; 38extern int cgit_cache_root_ttl;
38extern int cgit_cache_repo_ttl; 39extern int cgit_cache_repo_ttl;
39extern int cgit_cache_dynamic_ttl; 40extern int cgit_cache_dynamic_ttl;
40extern int cgit_cache_static_ttl; 41extern int cgit_cache_static_ttl;
41extern int cgit_cache_max_create_time; 42extern int cgit_cache_max_create_time;
42 43
43extern char *cgit_repo_name; 44extern char *cgit_repo_name;
44extern char *cgit_repo_desc; 45extern char *cgit_repo_desc;
45extern char *cgit_repo_owner; 46extern char *cgit_repo_owner;
46 47
47extern int cgit_query_has_symref; 48extern int cgit_query_has_symref;
48extern int cgit_query_has_sha1; 49extern int cgit_query_has_sha1;
49 50
50extern char *cgit_querystring; 51extern char *cgit_querystring;
51extern char *cgit_query_repo; 52extern char *cgit_query_repo;
52extern char *cgit_query_page; 53extern char *cgit_query_page;
53extern char *cgit_query_head; 54extern char *cgit_query_head;
54extern char *cgit_query_sha1; 55extern char *cgit_query_sha1;
55extern int cgit_query_ofs; 56extern int cgit_query_ofs;
56 57
57extern int htmlfd; 58extern int htmlfd;
58 59
59extern void cgit_global_config_cb(const char *name, const char *value); 60extern void cgit_global_config_cb(const char *name, const char *value);
60extern void cgit_repo_config_cb(const char *name, const char *value); 61extern void cgit_repo_config_cb(const char *name, const char *value);
61extern void cgit_querystring_cb(const char *name, const char *value); 62extern void cgit_querystring_cb(const char *name, const char *value);
62 63
63extern char *fmt(const char *format,...); 64extern char *fmt(const char *format,...);
64 65
65extern void html(const char *txt); 66extern void html(const char *txt);
66extern void htmlf(const char *format,...); 67extern void htmlf(const char *format,...);
67extern void html_txt(char *txt); 68extern void html_txt(char *txt);
68extern void html_attr(char *txt); 69extern void html_attr(char *txt);
69extern void html_link_open(char *url, char *title, char *class); 70extern void html_link_open(char *url, char *title, char *class);
70extern void html_link_close(void); 71extern void html_link_close(void);
71 72
72extern int cgit_read_config(const char *filename, configfn fn); 73extern int cgit_read_config(const char *filename, configfn fn);
73extern int cgit_parse_query(char *txt, configfn fn); 74extern int cgit_parse_query(char *txt, configfn fn);
74extern struct commitinfo *cgit_parse_commit(struct commit *commit); 75extern struct commitinfo *cgit_parse_commit(struct commit *commit);
75 76
76extern void cache_prepare(struct cacheitem *item); 77extern void cache_prepare(struct cacheitem *item);
77extern int cache_lock(struct cacheitem *item); 78extern int cache_lock(struct cacheitem *item);
78extern int cache_unlock(struct cacheitem *item); 79extern int cache_unlock(struct cacheitem *item);
79extern int cache_cancel_lock(struct cacheitem *item); 80extern int cache_cancel_lock(struct cacheitem *item);
80extern int cache_exist(struct cacheitem *item); 81extern int cache_exist(struct cacheitem *item);
81extern int cache_expired(struct cacheitem *item); 82extern int cache_expired(struct cacheitem *item);
82 83
83extern char *cgit_repourl(const char *reponame); 84extern char *cgit_repourl(const char *reponame);
84extern char *cgit_pageurl(const char *reponame, const char *pagename, 85extern char *cgit_pageurl(const char *reponame, const char *pagename,
85 const char *query); 86 const char *query);
86 87
87extern void cgit_print_error(char *msg); 88extern void cgit_print_error(char *msg);
88extern void cgit_print_date(unsigned long secs); 89extern void cgit_print_date(unsigned long secs);
89extern void cgit_print_docstart(char *title, struct cacheitem *item); 90extern void cgit_print_docstart(char *title, struct cacheitem *item);
90extern void cgit_print_docend(); 91extern void cgit_print_docend();
91extern void cgit_print_pageheader(char *title); 92extern void cgit_print_pageheader(char *title);
92 93
93extern void cgit_print_repolist(struct cacheitem *item); 94extern void cgit_print_repolist(struct cacheitem *item);
94extern void cgit_print_summary(); 95extern void cgit_print_summary();
95extern void cgit_print_log(const char *tip, int ofs, int cnt); 96extern void cgit_print_log(const char *tip, int ofs, int cnt);
96extern void cgit_print_view(const char *hex); 97extern void cgit_print_view(const char *hex);
97extern void cgit_print_tree(const char *hex); 98extern void cgit_print_tree(const char *hex);
98extern void cgit_print_commit(const char *hex); 99extern void cgit_print_commit(const char *hex);
99 100
100#endif /* CGIT_H */ 101#endif /* CGIT_H */