summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cgit.c b/cgit.c
index 6ece411..a792fe4 100644
--- a/cgit.c
+++ b/cgit.c
@@ -518,65 +518,66 @@ static void cgit_parse_args(int argc, const char **argv)
518 int scan = 0; 518 int scan = 0;
519 519
520 for (i = 1; i < argc; i++) { 520 for (i = 1; i < argc; i++) {
521 if (!strncmp(argv[i], "--cache=", 8)) { 521 if (!strncmp(argv[i], "--cache=", 8)) {
522 ctx.cfg.cache_root = xstrdup(argv[i]+8); 522 ctx.cfg.cache_root = xstrdup(argv[i]+8);
523 } 523 }
524 if (!strcmp(argv[i], "--nocache")) { 524 if (!strcmp(argv[i], "--nocache")) {
525 ctx.cfg.nocache = 1; 525 ctx.cfg.nocache = 1;
526 } 526 }
527 if (!strcmp(argv[i], "--nohttp")) { 527 if (!strcmp(argv[i], "--nohttp")) {
528 ctx.env.no_http = "1"; 528 ctx.env.no_http = "1";
529 } 529 }
530 if (!strncmp(argv[i], "--query=", 8)) { 530 if (!strncmp(argv[i], "--query=", 8)) {
531 ctx.qry.raw = xstrdup(argv[i]+8); 531 ctx.qry.raw = xstrdup(argv[i]+8);
532 } 532 }
533 if (!strncmp(argv[i], "--repo=", 7)) { 533 if (!strncmp(argv[i], "--repo=", 7)) {
534 ctx.qry.repo = xstrdup(argv[i]+7); 534 ctx.qry.repo = xstrdup(argv[i]+7);
535 } 535 }
536 if (!strncmp(argv[i], "--page=", 7)) { 536 if (!strncmp(argv[i], "--page=", 7)) {
537 ctx.qry.page = xstrdup(argv[i]+7); 537 ctx.qry.page = xstrdup(argv[i]+7);
538 } 538 }
539 if (!strncmp(argv[i], "--head=", 7)) { 539 if (!strncmp(argv[i], "--head=", 7)) {
540 ctx.qry.head = xstrdup(argv[i]+7); 540 ctx.qry.head = xstrdup(argv[i]+7);
541 ctx.qry.has_symref = 1; 541 ctx.qry.has_symref = 1;
542 } 542 }
543 if (!strncmp(argv[i], "--sha1=", 7)) { 543 if (!strncmp(argv[i], "--sha1=", 7)) {
544 ctx.qry.sha1 = xstrdup(argv[i]+7); 544 ctx.qry.sha1 = xstrdup(argv[i]+7);
545 ctx.qry.has_sha1 = 1; 545 ctx.qry.has_sha1 = 1;
546 } 546 }
547 if (!strncmp(argv[i], "--ofs=", 6)) { 547 if (!strncmp(argv[i], "--ofs=", 6)) {
548 ctx.qry.ofs = atoi(argv[i]+6); 548 ctx.qry.ofs = atoi(argv[i]+6);
549 } 549 }
550 if (!strncmp(argv[i], "--scan-tree=", 12)) { 550 if (!strncmp(argv[i], "--scan-tree=", 12) ||
551 !strncmp(argv[i], "--scan-path=", 12)) {
551 scan++; 552 scan++;
552 scan_tree(argv[i] + 12); 553 scan_tree(argv[i] + 12);
553 } 554 }
554 } 555 }
555 if (scan) { 556 if (scan) {
556 qsort(cgit_repolist.repos, cgit_repolist.count, 557 qsort(cgit_repolist.repos, cgit_repolist.count,
557 sizeof(struct cgit_repo), cmp_repos); 558 sizeof(struct cgit_repo), cmp_repos);
558 print_repolist(stdout, &cgit_repolist, 0); 559 print_repolist(stdout, &cgit_repolist, 0);
559 exit(0); 560 exit(0);
560 } 561 }
561} 562}
562 563
563static int calc_ttl() 564static int calc_ttl()
564{ 565{
565 if (!ctx.repo) 566 if (!ctx.repo)
566 return ctx.cfg.cache_root_ttl; 567 return ctx.cfg.cache_root_ttl;
567 568
568 if (!ctx.qry.page) 569 if (!ctx.qry.page)
569 return ctx.cfg.cache_repo_ttl; 570 return ctx.cfg.cache_repo_ttl;
570 571
571 if (ctx.qry.has_symref) 572 if (ctx.qry.has_symref)
572 return ctx.cfg.cache_dynamic_ttl; 573 return ctx.cfg.cache_dynamic_ttl;
573 574
574 if (ctx.qry.has_sha1) 575 if (ctx.qry.has_sha1)
575 return ctx.cfg.cache_static_ttl; 576 return ctx.cfg.cache_static_ttl;
576 577
577 return ctx.cfg.cache_repo_ttl; 578 return ctx.cfg.cache_repo_ttl;
578} 579}
579 580
580int main(int argc, const char **argv) 581int main(int argc, const char **argv)
581{ 582{
582 const char *path; 583 const char *path;