summaryrefslogtreecommitdiffabout
path: root/cgit.c
Unidiff
Diffstat (limited to 'cgit.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index 1d7a83f..67ad103 100644
--- a/cgit.c
+++ b/cgit.c
@@ -198,63 +198,63 @@ static void cgit_print_cache(struct cacheitem *item)
198 198
199 close(fd); 199 close(fd);
200} 200}
201 201
202static void cgit_parse_args(int argc, const char **argv) 202static void cgit_parse_args(int argc, const char **argv)
203{ 203{
204 int i; 204 int i;
205 205
206 for (i = 1; i < argc; i++) { 206 for (i = 1; i < argc; i++) {
207 if (!strncmp(argv[i], "--cache=", 8)) { 207 if (!strncmp(argv[i], "--cache=", 8)) {
208 cgit_cache_root = xstrdup(argv[i]+8); 208 cgit_cache_root = xstrdup(argv[i]+8);
209 } 209 }
210 if (!strcmp(argv[i], "--nocache")) { 210 if (!strcmp(argv[i], "--nocache")) {
211 cgit_nocache = 1; 211 cgit_nocache = 1;
212 } 212 }
213 if (!strncmp(argv[i], "--query=", 8)) { 213 if (!strncmp(argv[i], "--query=", 8)) {
214 cgit_querystring = xstrdup(argv[i]+8); 214 cgit_querystring = xstrdup(argv[i]+8);
215 } 215 }
216 if (!strncmp(argv[i], "--repo=", 7)) { 216 if (!strncmp(argv[i], "--repo=", 7)) {
217 cgit_query_repo = xstrdup(argv[i]+7); 217 cgit_query_repo = xstrdup(argv[i]+7);
218 } 218 }
219 if (!strncmp(argv[i], "--page=", 7)) { 219 if (!strncmp(argv[i], "--page=", 7)) {
220 cgit_query_page = xstrdup(argv[i]+7); 220 cgit_query_page = xstrdup(argv[i]+7);
221 } 221 }
222 if (!strncmp(argv[i], "--head=", 7)) { 222 if (!strncmp(argv[i], "--head=", 7)) {
223 cgit_query_head = xstrdup(argv[i]+7); 223 cgit_query_head = xstrdup(argv[i]+7);
224 cgit_query_has_symref = 1; 224 cgit_query_has_symref = 1;
225 } 225 }
226 if (!strncmp(argv[i], "--sha1=", 7)) { 226 if (!strncmp(argv[i], "--sha1=", 7)) {
227 cgit_query_sha1 = xstrdup(argv[i]+7); 227 cgit_query_sha1 = xstrdup(argv[i]+7);
228 cgit_query_has_sha1 = 1; 228 cgit_query_has_sha1 = 1;
229 } 229 }
230 if (!strncmp(argv[i], "--ofs=", 6)) { 230 if (!strncmp(argv[i], "--ofs=", 6)) {
231 cgit_query_ofs = atoi(argv[i]+6); 231 cgit_query_ofs = atoi(argv[i]+6);
232 } 232 }
233 } 233 }
234} 234}
235 235
236int main(int argc, const char **argv) 236int main(int argc, const char **argv)
237{ 237{
238 struct cacheitem item; 238 struct cacheitem item;
239 239
240 htmlfd = STDOUT_FILENO; 240 htmlfd = STDOUT_FILENO;
241 item.st.st_mtime = time(NULL); 241 item.st.st_mtime = time(NULL);
242 cgit_repolist.length = 0; 242 cgit_repolist.length = 0;
243 cgit_repolist.count = 0; 243 cgit_repolist.count = 0;
244 cgit_repolist.repos = NULL; 244 cgit_repolist.repos = NULL;
245 245
246 cgit_read_config("/etc/cgitrc", cgit_global_config_cb); 246 cgit_read_config(CGIT_CONFIG, cgit_global_config_cb);
247 if (getenv("QUERY_STRING")) 247 if (getenv("QUERY_STRING"))
248 cgit_querystring = xstrdup(getenv("QUERY_STRING")); 248 cgit_querystring = xstrdup(getenv("QUERY_STRING"));
249 cgit_parse_args(argc, argv); 249 cgit_parse_args(argc, argv);
250 cgit_parse_query(cgit_querystring, cgit_querystring_cb); 250 cgit_parse_query(cgit_querystring, cgit_querystring_cb);
251 if (!cgit_prepare_cache(&item)) 251 if (!cgit_prepare_cache(&item))
252 return 0; 252 return 0;
253 if (cgit_nocache) { 253 if (cgit_nocache) {
254 cgit_fill_cache(&item, 0); 254 cgit_fill_cache(&item, 0);
255 } else { 255 } else {
256 cgit_check_cache(&item); 256 cgit_check_cache(&item);
257 cgit_print_cache(&item); 257 cgit_print_cache(&item);
258 } 258 }
259 return 0; 259 return 0;
260} 260}