diff options
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/ui-shared.c b/ui-shared.c index 09c4c94..225a363 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -22,10 +22,11 @@ static char *http_date(time_t t) | |||
22 | static char month[][4] = | 22 | static char month[][4] = |
23 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", | 23 | {"Jan", "Feb", "Mar", "Apr", "May", "Jun", |
24 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; | 24 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
25 | struct tm *tm = gmtime(&t); | 25 | struct tm tm; |
26 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday], | 26 | gmtime_r(&t, &tm); |
27 | tm->tm_mday, month[tm->tm_mon], 1900 + tm->tm_year, | 27 | return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm.tm_wday], |
28 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 28 | tm.tm_mday, month[tm.tm_mon], 1900 + tm.tm_year, |
29 | tm.tm_hour, tm.tm_min, tm.tm_sec); | ||
29 | } | 30 | } |
30 | 31 | ||
31 | void cgit_print_error(const char *fmt, ...) | 32 | void cgit_print_error(const char *fmt, ...) |
@@ -521,45 +522,45 @@ static void cgit_self_link(char *name, const char *title, const char *class) | |||
521 | else if (!strcmp(ctx.qry.page, "summary")) | 522 | else if (!strcmp(ctx.qry.page, "summary")) |
522 | cgit_summary_link(name, title, class, ctx.qry.head); | 523 | cgit_summary_link(name, title, class, ctx.qry.head); |
523 | else if (!strcmp(ctx.qry.page, "tag")) | 524 | else if (!strcmp(ctx.qry.page, "tag")) |
524 | cgit_tag_link(name, title, class, ctx.qry.has_sha1 ? | 525 | cgit_tag_link(name, title, class, ctx.qry.has_oid ? |
525 | ctx.qry.sha1 : ctx.qry.head); | 526 | ctx.qry.oid : ctx.qry.head); |
526 | else if (!strcmp(ctx.qry.page, "tree")) | 527 | else if (!strcmp(ctx.qry.page, "tree")) |
527 | cgit_tree_link(name, title, class, ctx.qry.head, | 528 | cgit_tree_link(name, title, class, ctx.qry.head, |
528 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 529 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
529 | ctx.qry.path); | 530 | ctx.qry.path); |
530 | else if (!strcmp(ctx.qry.page, "plain")) | 531 | else if (!strcmp(ctx.qry.page, "plain")) |
531 | cgit_plain_link(name, title, class, ctx.qry.head, | 532 | cgit_plain_link(name, title, class, ctx.qry.head, |
532 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 533 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
533 | ctx.qry.path); | 534 | ctx.qry.path); |
534 | else if (!strcmp(ctx.qry.page, "blame")) | 535 | else if (!strcmp(ctx.qry.page, "blame")) |
535 | cgit_blame_link(name, title, class, ctx.qry.head, | 536 | cgit_blame_link(name, title, class, ctx.qry.head, |
536 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 537 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
537 | ctx.qry.path); | 538 | ctx.qry.path); |
538 | else if (!strcmp(ctx.qry.page, "log")) | 539 | else if (!strcmp(ctx.qry.page, "log")) |
539 | cgit_log_link(name, title, class, ctx.qry.head, | 540 | cgit_log_link(name, title, class, ctx.qry.head, |
540 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 541 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
541 | ctx.qry.path, ctx.qry.ofs, | 542 | ctx.qry.path, ctx.qry.ofs, |
542 | ctx.qry.grep, ctx.qry.search, | 543 | ctx.qry.grep, ctx.qry.search, |
543 | ctx.qry.showmsg, ctx.qry.follow); | 544 | ctx.qry.showmsg, ctx.qry.follow); |
544 | else if (!strcmp(ctx.qry.page, "commit")) | 545 | else if (!strcmp(ctx.qry.page, "commit")) |
545 | cgit_commit_link(name, title, class, ctx.qry.head, | 546 | cgit_commit_link(name, title, class, ctx.qry.head, |
546 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 547 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
547 | ctx.qry.path); | 548 | ctx.qry.path); |
548 | else if (!strcmp(ctx.qry.page, "patch")) | 549 | else if (!strcmp(ctx.qry.page, "patch")) |
549 | cgit_patch_link(name, title, class, ctx.qry.head, | 550 | cgit_patch_link(name, title, class, ctx.qry.head, |
550 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 551 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
551 | ctx.qry.path); | 552 | ctx.qry.path); |
552 | else if (!strcmp(ctx.qry.page, "refs")) | 553 | else if (!strcmp(ctx.qry.page, "refs")) |
553 | cgit_refs_link(name, title, class, ctx.qry.head, | 554 | cgit_refs_link(name, title, class, ctx.qry.head, |
554 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 555 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
555 | ctx.qry.path); | 556 | ctx.qry.path); |
556 | else if (!strcmp(ctx.qry.page, "snapshot")) | 557 | else if (!strcmp(ctx.qry.page, "snapshot")) |
557 | cgit_snapshot_link(name, title, class, ctx.qry.head, | 558 | cgit_snapshot_link(name, title, class, ctx.qry.head, |
558 | ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL, | 559 | ctx.qry.has_oid ? ctx.qry.oid : NULL, |
559 | ctx.qry.path); | 560 | ctx.qry.path); |
560 | else if (!strcmp(ctx.qry.page, "diff")) | 561 | else if (!strcmp(ctx.qry.page, "diff")) |
561 | cgit_diff_link(name, title, class, ctx.qry.head, | 562 | cgit_diff_link(name, title, class, ctx.qry.head, |
562 | ctx.qry.sha1, ctx.qry.sha2, | 563 | ctx.qry.oid, ctx.qry.oid2, |
563 | ctx.qry.path); | 564 | ctx.qry.path); |
564 | else if (!strcmp(ctx.qry.page, "stats")) | 565 | else if (!strcmp(ctx.qry.page, "stats")) |
565 | cgit_stats_link(name, title, class, ctx.qry.head, | 566 | cgit_stats_link(name, title, class, ctx.qry.head, |
@@ -927,10 +928,10 @@ void cgit_add_hidden_formfields(int incl_head, int incl_search, | |||
927 | strcmp(ctx.qry.head, ctx.repo->defbranch)) | 928 | strcmp(ctx.qry.head, ctx.repo->defbranch)) |
928 | html_hidden("h", ctx.qry.head); | 929 | html_hidden("h", ctx.qry.head); |
929 | 930 | ||
930 | if (ctx.qry.sha1) | 931 | if (ctx.qry.oid) |
931 | html_hidden("id", ctx.qry.sha1); | 932 | html_hidden("id", ctx.qry.oid); |
932 | if (ctx.qry.sha2) | 933 | if (ctx.qry.oid2) |
933 | html_hidden("id2", ctx.qry.sha2); | 934 | html_hidden("id2", ctx.qry.oid2); |
934 | if (ctx.qry.showmsg) | 935 | if (ctx.qry.showmsg) |
935 | html_hidden("showmsg", "1"); | 936 | html_hidden("showmsg", "1"); |
936 | 937 | ||
@@ -1059,7 +1060,7 @@ void cgit_print_pageheader(void) | |||
1059 | ctx.qry.head); | 1060 | ctx.qry.head); |
1060 | html(" "); | 1061 | html(" "); |
1061 | cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, | 1062 | cgit_refs_link("refs", NULL, hc("refs"), ctx.qry.head, |
1062 | ctx.qry.sha1, NULL); | 1063 | ctx.qry.oid, NULL); |
1063 | html(" "); | 1064 | html(" "); |
1064 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, | 1065 | cgit_log_link("log", NULL, hc("log"), ctx.qry.head, |
1065 | NULL, ctx.qry.vpath, 0, NULL, NULL, | 1066 | NULL, ctx.qry.vpath, 0, NULL, NULL, |
@@ -1067,16 +1068,16 @@ void cgit_print_pageheader(void) | |||
1067 | html(" "); | 1068 | html(" "); |
1068 | if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) | 1069 | if (ctx.qry.page && !strcmp(ctx.qry.page, "blame")) |
1069 | cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, | 1070 | cgit_blame_link("blame", NULL, hc("blame"), ctx.qry.head, |
1070 | ctx.qry.sha1, ctx.qry.vpath); | 1071 | ctx.qry.oid, ctx.qry.vpath); |
1071 | else | 1072 | else |
1072 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, | 1073 | cgit_tree_link("tree", NULL, hc("tree"), ctx.qry.head, |
1073 | ctx.qry.sha1, ctx.qry.vpath); | 1074 | ctx.qry.oid, ctx.qry.vpath); |
1074 | html(" "); | 1075 | html(" "); |
1075 | cgit_commit_link("commit", NULL, hc("commit"), | 1076 | cgit_commit_link("commit", NULL, hc("commit"), |
1076 | ctx.qry.head, ctx.qry.sha1, ctx.qry.vpath); | 1077 | ctx.qry.head, ctx.qry.oid, ctx.qry.vpath); |
1077 | html(" "); | 1078 | html(" "); |
1078 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, | 1079 | cgit_diff_link("diff", NULL, hc("diff"), ctx.qry.head, |
1079 | ctx.qry.sha1, ctx.qry.sha2, ctx.qry.vpath); | 1080 | ctx.qry.oid, ctx.qry.oid2, ctx.qry.vpath); |
1080 | if (ctx.repo->max_stats) { | 1081 | if (ctx.repo->max_stats) { |
1081 | html(" "); | 1082 | html(" "); |
1082 | cgit_stats_link("stats", NULL, hc("stats"), | 1083 | cgit_stats_link("stats", NULL, hc("stats"), |