author | Lars Hjemli <hjemli@gmail.com> | 2008-02-23 21:45:33 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-03-18 07:13:10 (UTC) |
commit | b1f9b9c1459cb9a30ebf80721aff6ef788d1f891 (patch) (unidiff) | |
tree | 05796a741faef90c12aadd3a5c92b702ec870c48 /cgit.c | |
parent | b88fb016d0209f7041ac7d3b4d2c077318407a4d (diff) | |
download | cgit-b1f9b9c1459cb9a30ebf80721aff6ef788d1f891.zip cgit-b1f9b9c1459cb9a30ebf80721aff6ef788d1f891.tar.gz cgit-b1f9b9c1459cb9a30ebf80721aff6ef788d1f891.tar.bz2 |
Introduce html.h
All html-functions can be quite easily separated from the rest of cgit, so
lets do it; the only issue was html_filemode which uses some git-defined
macros so the function is moved into ui-shared.c::cgit_print_filemode().
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | cgit.c | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -262,56 +262,55 @@ static void cgit_parse_args(int argc, const char **argv) | |||
262 | if (!strcmp(argv[i], "--nocache")) { | 262 | if (!strcmp(argv[i], "--nocache")) { |
263 | ctx.cfg.nocache = 1; | 263 | ctx.cfg.nocache = 1; |
264 | } | 264 | } |
265 | if (!strncmp(argv[i], "--query=", 8)) { | 265 | if (!strncmp(argv[i], "--query=", 8)) { |
266 | ctx.qry.raw = xstrdup(argv[i]+8); | 266 | ctx.qry.raw = xstrdup(argv[i]+8); |
267 | } | 267 | } |
268 | if (!strncmp(argv[i], "--repo=", 7)) { | 268 | if (!strncmp(argv[i], "--repo=", 7)) { |
269 | ctx.qry.repo = xstrdup(argv[i]+7); | 269 | ctx.qry.repo = xstrdup(argv[i]+7); |
270 | } | 270 | } |
271 | if (!strncmp(argv[i], "--page=", 7)) { | 271 | if (!strncmp(argv[i], "--page=", 7)) { |
272 | ctx.qry.page = xstrdup(argv[i]+7); | 272 | ctx.qry.page = xstrdup(argv[i]+7); |
273 | } | 273 | } |
274 | if (!strncmp(argv[i], "--head=", 7)) { | 274 | if (!strncmp(argv[i], "--head=", 7)) { |
275 | ctx.qry.head = xstrdup(argv[i]+7); | 275 | ctx.qry.head = xstrdup(argv[i]+7); |
276 | ctx.qry.has_symref = 1; | 276 | ctx.qry.has_symref = 1; |
277 | } | 277 | } |
278 | if (!strncmp(argv[i], "--sha1=", 7)) { | 278 | if (!strncmp(argv[i], "--sha1=", 7)) { |
279 | ctx.qry.sha1 = xstrdup(argv[i]+7); | 279 | ctx.qry.sha1 = xstrdup(argv[i]+7); |
280 | ctx.qry.has_sha1 = 1; | 280 | ctx.qry.has_sha1 = 1; |
281 | } | 281 | } |
282 | if (!strncmp(argv[i], "--ofs=", 6)) { | 282 | if (!strncmp(argv[i], "--ofs=", 6)) { |
283 | ctx.qry.ofs = atoi(argv[i]+6); | 283 | ctx.qry.ofs = atoi(argv[i]+6); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | } | 286 | } |
287 | 287 | ||
288 | int main(int argc, const char **argv) | 288 | int main(int argc, const char **argv) |
289 | { | 289 | { |
290 | struct cacheitem item; | 290 | struct cacheitem item; |
291 | const char *cgit_config_env = getenv("CGIT_CONFIG"); | 291 | const char *cgit_config_env = getenv("CGIT_CONFIG"); |
292 | 292 | ||
293 | cgit_prepare_context(&ctx); | 293 | cgit_prepare_context(&ctx); |
294 | htmlfd = STDOUT_FILENO; | ||
295 | item.st.st_mtime = time(NULL); | 294 | item.st.st_mtime = time(NULL); |
296 | cgit_repolist.length = 0; | 295 | cgit_repolist.length = 0; |
297 | cgit_repolist.count = 0; | 296 | cgit_repolist.count = 0; |
298 | cgit_repolist.repos = NULL; | 297 | cgit_repolist.repos = NULL; |
299 | 298 | ||
300 | cgit_read_config(cgit_config_env ? cgit_config_env : CGIT_CONFIG, | 299 | cgit_read_config(cgit_config_env ? cgit_config_env : CGIT_CONFIG, |
301 | cgit_global_config_cb); | 300 | cgit_global_config_cb); |
302 | if (getenv("SCRIPT_NAME")) | 301 | if (getenv("SCRIPT_NAME")) |
303 | ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME")); | 302 | ctx.cfg.script_name = xstrdup(getenv("SCRIPT_NAME")); |
304 | if (getenv("QUERY_STRING")) | 303 | if (getenv("QUERY_STRING")) |
305 | ctx.qry.raw = xstrdup(getenv("QUERY_STRING")); | 304 | ctx.qry.raw = xstrdup(getenv("QUERY_STRING")); |
306 | cgit_parse_args(argc, argv); | 305 | cgit_parse_args(argc, argv); |
307 | cgit_parse_query(ctx.qry.raw, cgit_querystring_cb); | 306 | cgit_parse_query(ctx.qry.raw, cgit_querystring_cb); |
308 | if (!cgit_prepare_cache(&item)) | 307 | if (!cgit_prepare_cache(&item)) |
309 | return 0; | 308 | return 0; |
310 | if (ctx.cfg.nocache) { | 309 | if (ctx.cfg.nocache) { |
311 | cgit_fill_cache(&item, 0); | 310 | cgit_fill_cache(&item, 0); |
312 | } else { | 311 | } else { |
313 | cgit_check_cache(&item); | 312 | cgit_check_cache(&item); |
314 | cgit_print_cache(&item); | 313 | cgit_print_cache(&item); |
315 | } | 314 | } |
316 | return 0; | 315 | return 0; |
317 | } | 316 | } |