mirror of
https://git.zx2c4.com/cgit
synced 2024-11-26 02:18:42 +00:00
Fix several whitespace errors
* Remove whitespace at the end of lines. * Replace space indentation by tabs. * Add whitespace before/after several operators ("+", "-", "*", ...) * Add whitespace to assignments ("foo = bar;"). * Fix whitespace in parameter lists ("foobar(foo, bar, 42)"). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
This commit is contained in:
parent
7f4e8c33ae
commit
53bc747d31
6
cache.c
6
cache.c
@ -105,7 +105,7 @@ static int is_expired(struct cache_slot *slot)
|
|||||||
if (slot->ttl < 0)
|
if (slot->ttl < 0)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return slot->cache_st.st_mtime + slot->ttl*60 < time(NULL);
|
return slot->cache_st.st_mtime + slot->ttl * 60 < time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the slot has been modified since we opened it.
|
/* Check if the slot has been modified since we opened it.
|
||||||
@ -141,8 +141,8 @@ static int close_lock(struct cache_slot *slot)
|
|||||||
*/
|
*/
|
||||||
static int lock_slot(struct cache_slot *slot)
|
static int lock_slot(struct cache_slot *slot)
|
||||||
{
|
{
|
||||||
slot->lock_fd = open(slot->lock_name, O_RDWR|O_CREAT|O_EXCL,
|
slot->lock_fd = open(slot->lock_name, O_RDWR | O_CREAT | O_EXCL,
|
||||||
S_IRUSR|S_IWUSR);
|
S_IRUSR | S_IWUSR);
|
||||||
if (slot->lock_fd == -1)
|
if (slot->lock_fd == -1)
|
||||||
return errno;
|
return errno;
|
||||||
if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0)
|
if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0)
|
||||||
|
16
cgit.c
16
cgit.c
@ -741,7 +741,7 @@ static void cgit_parse_args(int argc, const char **argv)
|
|||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strncmp(argv[i], "--cache=", 8)) {
|
if (!strncmp(argv[i], "--cache=", 8)) {
|
||||||
ctx.cfg.cache_root = xstrdup(argv[i]+8);
|
ctx.cfg.cache_root = xstrdup(argv[i] + 8);
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "--nocache")) {
|
if (!strcmp(argv[i], "--nocache")) {
|
||||||
ctx.cfg.nocache = 1;
|
ctx.cfg.nocache = 1;
|
||||||
@ -750,24 +750,24 @@ static void cgit_parse_args(int argc, const char **argv)
|
|||||||
ctx.env.no_http = "1";
|
ctx.env.no_http = "1";
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--query=", 8)) {
|
if (!strncmp(argv[i], "--query=", 8)) {
|
||||||
ctx.qry.raw = xstrdup(argv[i]+8);
|
ctx.qry.raw = xstrdup(argv[i] + 8);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--repo=", 7)) {
|
if (!strncmp(argv[i], "--repo=", 7)) {
|
||||||
ctx.qry.repo = xstrdup(argv[i]+7);
|
ctx.qry.repo = xstrdup(argv[i] + 7);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--page=", 7)) {
|
if (!strncmp(argv[i], "--page=", 7)) {
|
||||||
ctx.qry.page = xstrdup(argv[i]+7);
|
ctx.qry.page = xstrdup(argv[i] + 7);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--head=", 7)) {
|
if (!strncmp(argv[i], "--head=", 7)) {
|
||||||
ctx.qry.head = xstrdup(argv[i]+7);
|
ctx.qry.head = xstrdup(argv[i] + 7);
|
||||||
ctx.qry.has_symref = 1;
|
ctx.qry.has_symref = 1;
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--sha1=", 7)) {
|
if (!strncmp(argv[i], "--sha1=", 7)) {
|
||||||
ctx.qry.sha1 = xstrdup(argv[i]+7);
|
ctx.qry.sha1 = xstrdup(argv[i] + 7);
|
||||||
ctx.qry.has_sha1 = 1;
|
ctx.qry.has_sha1 = 1;
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--ofs=", 6)) {
|
if (!strncmp(argv[i], "--ofs=", 6)) {
|
||||||
ctx.qry.ofs = atoi(argv[i]+6);
|
ctx.qry.ofs = atoi(argv[i] + 6);
|
||||||
}
|
}
|
||||||
if (!strncmp(argv[i], "--scan-tree=", 12) ||
|
if (!strncmp(argv[i], "--scan-tree=", 12) ||
|
||||||
!strncmp(argv[i], "--scan-path=", 12)) {
|
!strncmp(argv[i], "--scan-path=", 12)) {
|
||||||
@ -856,7 +856,7 @@ int main(int argc, const char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ttl = calc_ttl();
|
ttl = calc_ttl();
|
||||||
ctx.page.expires += ttl*60;
|
ctx.page.expires += ttl * 60;
|
||||||
if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
|
if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
|
||||||
ctx.cfg.nocache = 1;
|
ctx.cfg.nocache = 1;
|
||||||
if (ctx.cfg.nocache)
|
if (ctx.cfg.nocache)
|
||||||
|
22
configfile.c
22
configfile.c
@ -13,9 +13,9 @@
|
|||||||
int next_char(FILE *f)
|
int next_char(FILE *f)
|
||||||
{
|
{
|
||||||
int c = fgetc(f);
|
int c = fgetc(f);
|
||||||
if (c=='\r') {
|
if (c == '\r') {
|
||||||
c = fgetc(f);
|
c = fgetc(f);
|
||||||
if (c!='\n') {
|
if (c != '\n') {
|
||||||
ungetc(c, f);
|
ungetc(c, f);
|
||||||
c = '\r';
|
c = '\r';
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ void skip_line(FILE *f)
|
|||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while((c=next_char(f)) && c!='\n' && c!=EOF)
|
while((c = next_char(f)) && c != '\n' && c != EOF)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,31 +36,31 @@ int read_config_line(FILE *f, char *line, const char **value, int bufsize)
|
|||||||
int i = 0, isname = 0;
|
int i = 0, isname = 0;
|
||||||
|
|
||||||
*value = NULL;
|
*value = NULL;
|
||||||
while(i<bufsize-1) {
|
while(i < bufsize - 1) {
|
||||||
int c = next_char(f);
|
int c = next_char(f);
|
||||||
if (!isname && (c=='#' || c==';')) {
|
if (!isname && (c == '#' || c == ';')) {
|
||||||
skip_line(f);
|
skip_line(f);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isname && isspace(c))
|
if (!isname && isspace(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c=='=' && !*value) {
|
if (c == '=' && !*value) {
|
||||||
line[i] = 0;
|
line[i] = 0;
|
||||||
*value = &line[i+1];
|
*value = &line[i + 1];
|
||||||
} else if (c=='\n' && !isname) {
|
} else if (c == '\n' && !isname) {
|
||||||
i = 0;
|
i = 0;
|
||||||
continue;
|
continue;
|
||||||
} else if (c=='\n' || c==EOF) {
|
} else if (c == '\n' || c == EOF) {
|
||||||
line[i] = 0;
|
line[i] = 0;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
line[i]=c;
|
line[i] = c;
|
||||||
}
|
}
|
||||||
isname = 1;
|
isname = 1;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
line[i+1] = 0;
|
line[i + 1] = 0;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
78
html.c
78
html.c
@ -54,7 +54,7 @@ char *fmt(const char *format, ...)
|
|||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
|
len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
if (len>sizeof(buf[bufidx])) {
|
if (len > sizeof(buf[bufidx])) {
|
||||||
fprintf(stderr, "[html.c] string truncated: %s\n", format);
|
fprintf(stderr, "[html.c] string truncated: %s\n", format);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -94,19 +94,19 @@ void html_txt(const char *txt)
|
|||||||
const char *t = txt;
|
const char *t = txt;
|
||||||
while(t && *t){
|
while(t && *t){
|
||||||
int c = *t;
|
int c = *t;
|
||||||
if (c=='<' || c=='>' || c=='&') {
|
if (c == '<' || c == '>' || c == '&') {
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
if (c=='>')
|
if (c == '>')
|
||||||
html(">");
|
html(">");
|
||||||
else if (c=='<')
|
else if (c == '<')
|
||||||
html("<");
|
html("<");
|
||||||
else if (c=='&')
|
else if (c == '&')
|
||||||
html("&");
|
html("&");
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
html(txt);
|
html(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,21 +115,21 @@ void html_ntxt(int len, const char *txt)
|
|||||||
const char *t = txt;
|
const char *t = txt;
|
||||||
while(t && *t && len--){
|
while(t && *t && len--){
|
||||||
int c = *t;
|
int c = *t;
|
||||||
if (c=='<' || c=='>' || c=='&') {
|
if (c == '<' || c == '>' || c == '&') {
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
if (c=='>')
|
if (c == '>')
|
||||||
html(">");
|
html(">");
|
||||||
else if (c=='<')
|
else if (c == '<')
|
||||||
html("<");
|
html("<");
|
||||||
else if (c=='&')
|
else if (c == '&')
|
||||||
html("&");
|
html("&");
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
if (len<0)
|
if (len < 0)
|
||||||
html("...");
|
html("...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,23 +138,23 @@ void html_attr(const char *txt)
|
|||||||
const char *t = txt;
|
const char *t = txt;
|
||||||
while(t && *t){
|
while(t && *t){
|
||||||
int c = *t;
|
int c = *t;
|
||||||
if (c=='<' || c=='>' || c=='\'' || c=='\"' || c=='&') {
|
if (c == '<' || c == '>' || c == '\'' || c == '\"' || c == '&') {
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
if (c=='>')
|
if (c == '>')
|
||||||
html(">");
|
html(">");
|
||||||
else if (c=='<')
|
else if (c == '<')
|
||||||
html("<");
|
html("<");
|
||||||
else if (c=='\'')
|
else if (c == '\'')
|
||||||
html("'");
|
html("'");
|
||||||
else if (c=='"')
|
else if (c == '"')
|
||||||
html(""");
|
html(""");
|
||||||
else if (c=='&')
|
else if (c == '&')
|
||||||
html("&");
|
html("&");
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
html(txt);
|
html(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,14 +164,14 @@ void html_url_path(const char *txt)
|
|||||||
while(t && *t){
|
while(t && *t){
|
||||||
unsigned char c = *t;
|
unsigned char c = *t;
|
||||||
const char *e = url_escape_table[c];
|
const char *e = url_escape_table[c];
|
||||||
if (e && c!='+' && c!='&') {
|
if (e && c != '+' && c != '&') {
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
html(e);
|
html(e);
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
html(txt);
|
html(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,11 +186,11 @@ void html_url_arg(const char *txt)
|
|||||||
if (e) {
|
if (e) {
|
||||||
html_raw(txt, t - txt);
|
html_raw(txt, t - txt);
|
||||||
html(e);
|
html(e);
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
html(txt);
|
html(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,14 +286,14 @@ char *convert_query_hexchar(char *txt)
|
|||||||
*txt = '\0';
|
*txt = '\0';
|
||||||
return txt-1;
|
return txt-1;
|
||||||
}
|
}
|
||||||
d1 = hextoint(*(txt+1));
|
d1 = hextoint(*(txt + 1));
|
||||||
d2 = hextoint(*(txt+2));
|
d2 = hextoint(*(txt + 2));
|
||||||
if (d1<0 || d2<0) {
|
if (d1 < 0 || d2 < 0) {
|
||||||
memmove(txt, txt+3, n-2);
|
memmove(txt, txt + 3, n - 2);
|
||||||
return txt-1;
|
return txt-1;
|
||||||
} else {
|
} else {
|
||||||
*txt = d1 * 16 + d2;
|
*txt = d1 * 16 + d2;
|
||||||
memmove(txt+1, txt+3, n-2);
|
memmove(txt + 1, txt + 3, n - 2);
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,22 +311,22 @@ int http_parse_querystring(const char *txt_, void (*fn)(const char *name, const
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
while((c=*t) != '\0') {
|
while((c=*t) != '\0') {
|
||||||
if (c=='=') {
|
if (c == '=') {
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
value = t+1;
|
value = t + 1;
|
||||||
} else if (c=='+') {
|
} else if (c == '+') {
|
||||||
*t = ' ';
|
*t = ' ';
|
||||||
} else if (c=='%') {
|
} else if (c == '%') {
|
||||||
t = convert_query_hexchar(t);
|
t = convert_query_hexchar(t);
|
||||||
} else if (c=='&') {
|
} else if (c == '&') {
|
||||||
*t = '\0';
|
*t = '\0';
|
||||||
(*fn)(txt, value);
|
(*fn)(txt, value);
|
||||||
txt = t+1;
|
txt = t + 1;
|
||||||
value = NULL;
|
value = NULL;
|
||||||
}
|
}
|
||||||
t++;
|
t++;
|
||||||
}
|
}
|
||||||
if (t!=txt)
|
if (t != txt)
|
||||||
(*fn)(txt, value);
|
(*fn)(txt, value);
|
||||||
free(o);
|
free(o);
|
||||||
return 0;
|
return 0;
|
||||||
|
10
shared.c
10
shared.c
@ -29,7 +29,7 @@ int chk_positive(int result, char *msg)
|
|||||||
int chk_non_negative(int result, char *msg)
|
int chk_non_negative(int result, char *msg)
|
||||||
{
|
{
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
die("%s: %s",msg, strerror(errno));
|
die("%s: %s", msg, strerror(errno));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ struct cgit_repo *cgit_get_repoinfo(const char *url)
|
|||||||
int i;
|
int i;
|
||||||
struct cgit_repo *repo;
|
struct cgit_repo *repo;
|
||||||
|
|
||||||
for (i=0; i<cgit_repolist.count; i++) {
|
for (i = 0; i < cgit_repolist.count; i++) {
|
||||||
repo = &cgit_repolist.repos[i];
|
repo = &cgit_repolist.repos[i];
|
||||||
if (!strcmp(repo->url, url))
|
if (!strcmp(repo->url, url))
|
||||||
return repo;
|
return repo;
|
||||||
@ -354,14 +354,14 @@ int cgit_parse_snapshots_mask(const char *str)
|
|||||||
if(atoi(str))
|
if(atoi(str))
|
||||||
return 1;
|
return 1;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
str += strspn(str,delim);
|
str += strspn(str, delim);
|
||||||
tl = strcspn(str,delim);
|
tl = strcspn(str, delim);
|
||||||
if (!tl)
|
if (!tl)
|
||||||
break;
|
break;
|
||||||
for (f = cgit_snapshot_formats; f->suffix; f++) {
|
for (f = cgit_snapshot_formats; f->suffix; f++) {
|
||||||
sl = strlen(f->suffix);
|
sl = strlen(f->suffix);
|
||||||
if((tl == sl && !strncmp(f->suffix, str, tl)) ||
|
if((tl == sl && !strncmp(f->suffix, str, tl)) ||
|
||||||
(tl == sl-1 && !strncmp(f->suffix+1, str, tl-1))) {
|
(tl == sl - 1 && !strncmp(f->suffix + 1, str, tl - 1))) {
|
||||||
rv |= f->bit;
|
rv |= f->bit;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
10
ui-blob.c
10
ui-blob.c
@ -15,12 +15,12 @@ static char *match_path;
|
|||||||
static unsigned char *matched_sha1;
|
static unsigned char *matched_sha1;
|
||||||
static int found_path;
|
static int found_path;
|
||||||
|
|
||||||
static int walk_tree(const unsigned char *sha1, const char *base,int baselen,
|
static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
|
||||||
const char *pathname, unsigned mode, int stage, void *cbdata) {
|
const char *pathname, unsigned mode, int stage, void *cbdata) {
|
||||||
if(strncmp(base,match_path,baselen)
|
if(strncmp(base, match_path, baselen)
|
||||||
|| strcmp(match_path+baselen,pathname) )
|
|| strcmp(match_path + baselen, pathname))
|
||||||
return READ_TREE_RECURSIVE;
|
return READ_TREE_RECURSIVE;
|
||||||
memmove(matched_sha1,sha1,20);
|
memmove(matched_sha1, sha1, 20);
|
||||||
found_path = 1;
|
found_path = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (get_sha1(head,sha1)) {
|
if (get_sha1(head, sha1)) {
|
||||||
cgit_print_error(fmt("Bad ref: %s", head));
|
cgit_print_error(fmt("Bad ref: %s", head));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ void cgit_print_commit(char *hex, const char *prefix)
|
|||||||
cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix);
|
cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix);
|
||||||
}
|
}
|
||||||
html("</td></tr>\n");
|
html("</td></tr>\n");
|
||||||
for (p = commit->parents; p ; p = p->next) {
|
for (p = commit->parents; p; p = p->next) {
|
||||||
parent = lookup_commit_reference(p->item->object.sha1);
|
parent = lookup_commit_reference(p->item->object.sha1);
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
html("<tr><td colspan='3'>");
|
html("<tr><td colspan='3'>");
|
||||||
|
@ -200,7 +200,7 @@ void cgit_print_branches(int maxcount)
|
|||||||
qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name);
|
qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<maxcount; i++)
|
for(i = 0; i < maxcount; i++)
|
||||||
print_branch(list.refs[i]);
|
print_branch(list.refs[i]);
|
||||||
|
|
||||||
if (maxcount < list.count)
|
if (maxcount < list.count)
|
||||||
@ -224,7 +224,7 @@ void cgit_print_tags(int maxcount)
|
|||||||
else if (maxcount > list.count)
|
else if (maxcount > list.count)
|
||||||
maxcount = list.count;
|
maxcount = list.count;
|
||||||
print_tag_header();
|
print_tag_header();
|
||||||
for(i=0; i<maxcount; i++)
|
for(i = 0; i < maxcount; i++)
|
||||||
print_tag(list.refs[i]);
|
print_tag(list.refs[i]);
|
||||||
|
|
||||||
if (maxcount < list.count)
|
if (maxcount < list.count)
|
||||||
|
@ -131,8 +131,8 @@ void print_pager(int items, int pagelen, char *search, char *sort)
|
|||||||
html("<div class='pager'>");
|
html("<div class='pager'>");
|
||||||
for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
|
for(i = 0, ofs = 0; ofs < items; i++, ofs = i * pagelen) {
|
||||||
class = (ctx.qry.ofs == ofs) ? "current" : NULL;
|
class = (ctx.qry.ofs == ofs) ? "current" : NULL;
|
||||||
cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), class,
|
cgit_index_link(fmt("[%d]", i + 1), fmt("Page %d", i + 1),
|
||||||
search, sort, ofs);
|
class, search, sort, ofs);
|
||||||
}
|
}
|
||||||
html("</div>");
|
html("</div>");
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ void cgit_print_repolist()
|
|||||||
sort_repolist("section");
|
sort_repolist("section");
|
||||||
|
|
||||||
html("<table summary='repository list' class='list nowrap'>");
|
html("<table summary='repository list' class='list nowrap'>");
|
||||||
for (i=0; i<cgit_repolist.count; i++) {
|
for (i = 0; i < cgit_repolist.count; i++) {
|
||||||
ctx.repo = &cgit_repolist.repos[i];
|
ctx.repo = &cgit_repolist.repos[i];
|
||||||
if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
|
if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
|
||||||
continue;
|
continue;
|
||||||
|
14
ui-shared.c
14
ui-shared.c
@ -23,7 +23,7 @@ static char *http_date(time_t t)
|
|||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||||
struct tm *tm = gmtime(&t);
|
struct tm *tm = gmtime(&t);
|
||||||
return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday],
|
return fmt("%s, %02d %s %04d %02d:%02d:%02d GMT", day[tm->tm_wday],
|
||||||
tm->tm_mday, month[tm->tm_mon], 1900+tm->tm_year,
|
tm->tm_mday, month[tm->tm_mon], 1900 + tm->tm_year,
|
||||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ char *cgit_fileurl(const char *reponame, const char *pagename,
|
|||||||
char *cgit_pageurl(const char *reponame, const char *pagename,
|
char *cgit_pageurl(const char *reponame, const char *pagename,
|
||||||
const char *query)
|
const char *query)
|
||||||
{
|
{
|
||||||
return cgit_fileurl(reponame,pagename,0,query);
|
return cgit_fileurl(reponame, pagename, 0, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cgit_repobasename(const char *reponame)
|
const char *cgit_repobasename(const char *reponame)
|
||||||
@ -102,18 +102,18 @@ const char *cgit_repobasename(const char *reponame)
|
|||||||
static char rvbuf[1024];
|
static char rvbuf[1024];
|
||||||
int p;
|
int p;
|
||||||
const char *rv;
|
const char *rv;
|
||||||
strncpy(rvbuf,reponame,sizeof(rvbuf));
|
strncpy(rvbuf, reponame, sizeof(rvbuf));
|
||||||
if(rvbuf[sizeof(rvbuf)-1])
|
if(rvbuf[sizeof(rvbuf)-1])
|
||||||
die("cgit_repobasename: truncated repository name '%s'", reponame);
|
die("cgit_repobasename: truncated repository name '%s'", reponame);
|
||||||
p = strlen(rvbuf)-1;
|
p = strlen(rvbuf)-1;
|
||||||
/* strip trailing slashes */
|
/* strip trailing slashes */
|
||||||
while(p && rvbuf[p]=='/') rvbuf[p--]=0;
|
while(p && rvbuf[p] == '/') rvbuf[p--] = 0;
|
||||||
/* strip trailing .git */
|
/* strip trailing .git */
|
||||||
if(p>=3 && !strncmp(&rvbuf[p-3],".git",4)) {
|
if(p >= 3 && !strncmp(&rvbuf[p-3], ".git", 4)) {
|
||||||
p -= 3; rvbuf[p--] = 0;
|
p -= 3; rvbuf[p--] = 0;
|
||||||
}
|
}
|
||||||
/* strip more trailing slashes if any */
|
/* strip more trailing slashes if any */
|
||||||
while( p && rvbuf[p]=='/') rvbuf[p--]=0;
|
while( p && rvbuf[p] == '/') rvbuf[p--] = 0;
|
||||||
/* find last slash in the remaining string */
|
/* find last slash in the remaining string */
|
||||||
rv = strrchr(rvbuf,'/');
|
rv = strrchr(rvbuf,'/');
|
||||||
if(rv)
|
if(rv)
|
||||||
@ -736,7 +736,7 @@ int print_archive_ref(const char *refname, const unsigned char *sha1,
|
|||||||
|
|
||||||
if (prefixcmp(refname, "refs/archives"))
|
if (prefixcmp(refname, "refs/archives"))
|
||||||
return 0;
|
return 0;
|
||||||
strncpy(buf, refname+14, sizeof(buf));
|
strncpy(buf, refname + 14, sizeof(buf));
|
||||||
obj = parse_object(sha1);
|
obj = parse_object(sha1);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -153,7 +153,7 @@ int cgit_find_stats_period(const char *expr, struct cgit_period **period)
|
|||||||
if (periods[i].code == code || !strcmp(periods[i].name, expr)) {
|
if (periods[i].code == code || !strcmp(periods[i].name, expr)) {
|
||||||
if (period)
|
if (period)
|
||||||
*period = &periods[i];
|
*period = &periods[i];
|
||||||
return i+1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
|
|||||||
|
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
memcpy(buffer, base, baselen);
|
memcpy(buffer, base, baselen);
|
||||||
strcpy(buffer+baselen, pathname);
|
strcpy(buffer + baselen, pathname);
|
||||||
if (strcmp(match_path, buffer))
|
if (strcmp(match_path, buffer))
|
||||||
return READ_TREE_RECURSIVE;
|
return READ_TREE_RECURSIVE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user