summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2007-07-22 22:11:15 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2007-07-22 22:27:32 (UTC)
commiteb45342e735818b3c68cbab9b61b23e79ae74418 (patch) (unidiff)
tree43fed08927a2118a22cf686ee58b8d464233cd5d
parent1d4aaff696ee1b9085dda0f0f3d84d9d20d96db0 (diff)
downloadcgit-eb45342e735818b3c68cbab9b61b23e79ae74418.zip
cgit-eb45342e735818b3c68cbab9b61b23e79ae74418.tar.gz
cgit-eb45342e735818b3c68cbab9b61b23e79ae74418.tar.bz2
cgit_print_snapshot_links: use url to specify snapshot name
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.c4
-rw-r--r--cgit.h11
-rw-r--r--ui-commit.c3
-rw-r--r--ui-shared.c6
-rw-r--r--ui-snapshot.c38
5 files changed, 41 insertions, 21 deletions
diff --git a/cgit.c b/cgit.c
index 6597529..c86d290 100644
--- a/cgit.c
+++ b/cgit.c
@@ -47,51 +47,51 @@ static int cgit_prepare_cache(struct cacheitem *item)
47 47
48static void cgit_print_repo_page(struct cacheitem *item) 48static void cgit_print_repo_page(struct cacheitem *item)
49{ 49{
50 char *title; 50 char *title;
51 int show_search; 51 int show_search;
52 52
53 if (!cgit_query_head) 53 if (!cgit_query_head)
54 cgit_query_head = cgit_repo->defbranch; 54 cgit_query_head = cgit_repo->defbranch;
55 55
56 if (chdir(cgit_repo->path)) { 56 if (chdir(cgit_repo->path)) {
57 title = fmt("%s - %s", cgit_root_title, "Bad request"); 57 title = fmt("%s - %s", cgit_root_title, "Bad request");
58 cgit_print_docstart(title, item); 58 cgit_print_docstart(title, item);
59 cgit_print_pageheader(title, 0); 59 cgit_print_pageheader(title, 0);
60 cgit_print_error(fmt("Unable to scan repository: %s", 60 cgit_print_error(fmt("Unable to scan repository: %s",
61 strerror(errno))); 61 strerror(errno)));
62 cgit_print_docend(); 62 cgit_print_docend();
63 return; 63 return;
64 } 64 }
65 65
66 title = fmt("%s - %s", cgit_repo->name, cgit_repo->desc); 66 title = fmt("%s - %s", cgit_repo->name, cgit_repo->desc);
67 show_search = 0; 67 show_search = 0;
68 setenv("GIT_DIR", cgit_repo->path, 1); 68 setenv("GIT_DIR", cgit_repo->path, 1);
69 69
70 if ((cgit_cmd == CMD_SNAPSHOT) && cgit_repo->snapshots) { 70 if ((cgit_cmd == CMD_SNAPSHOT) && cgit_repo->snapshots) {
71 cgit_print_snapshot(item, cgit_query_sha1, 71 cgit_print_snapshot(item, cgit_query_head, cgit_query_sha1,
72 cgit_repobasename(cgit_repo->url), 72 cgit_repobasename(cgit_repo->url),
73 cgit_query_name, 73 cgit_query_path,
74 cgit_repo->snapshots ); 74 cgit_repo->snapshots );
75 return; 75 return;
76 } 76 }
77 77
78 if (cgit_cmd == CMD_BLOB) { 78 if (cgit_cmd == CMD_BLOB) {
79 cgit_print_blob(item, cgit_query_sha1, cgit_query_path); 79 cgit_print_blob(item, cgit_query_sha1, cgit_query_path);
80 return; 80 return;
81 } 81 }
82 82
83 show_search = (cgit_cmd == CMD_LOG); 83 show_search = (cgit_cmd == CMD_LOG);
84 cgit_print_docstart(title, item); 84 cgit_print_docstart(title, item);
85 if (!cgit_cmd) { 85 if (!cgit_cmd) {
86 cgit_print_pageheader("summary", show_search); 86 cgit_print_pageheader("summary", show_search);
87 cgit_print_summary(); 87 cgit_print_summary();
88 cgit_print_docend(); 88 cgit_print_docend();
89 return; 89 return;
90 } 90 }
91 91
92 cgit_print_pageheader(cgit_query_page, show_search); 92 cgit_print_pageheader(cgit_query_page, show_search);
93 93
94 switch(cgit_cmd) { 94 switch(cgit_cmd) {
95 case CMD_LOG: 95 case CMD_LOG:
96 cgit_print_log(cgit_query_sha1, cgit_query_ofs, 96 cgit_print_log(cgit_query_sha1, cgit_query_ofs,
97 cgit_max_commit_count, cgit_query_search, 97 cgit_max_commit_count, cgit_query_search,
diff --git a/cgit.h b/cgit.h
index eddcaa3..e3d9cb8 100644
--- a/cgit.h
+++ b/cgit.h
@@ -193,54 +193,57 @@ extern struct commitinfo *cgit_parse_commit(struct commit *commit);
193extern struct taginfo *cgit_parse_tag(struct tag *tag); 193extern struct taginfo *cgit_parse_tag(struct tag *tag);
194extern void cgit_parse_url(const char *url); 194extern void cgit_parse_url(const char *url);
195 195
196extern char *cache_safe_filename(const char *unsafe); 196extern char *cache_safe_filename(const char *unsafe);
197extern int cache_lock(struct cacheitem *item); 197extern int cache_lock(struct cacheitem *item);
198extern int cache_unlock(struct cacheitem *item); 198extern int cache_unlock(struct cacheitem *item);
199extern int cache_cancel_lock(struct cacheitem *item); 199extern int cache_cancel_lock(struct cacheitem *item);
200extern int cache_exist(struct cacheitem *item); 200extern int cache_exist(struct cacheitem *item);
201extern int cache_expired(struct cacheitem *item); 201extern int cache_expired(struct cacheitem *item);
202 202
203extern char *cgit_repourl(const char *reponame); 203extern char *cgit_repourl(const char *reponame);
204extern char *cgit_fileurl(const char *reponame, const char *pagename, 204extern char *cgit_fileurl(const char *reponame, const char *pagename,
205 const char *filename, const char *query); 205 const char *filename, const char *query);
206extern char *cgit_pageurl(const char *reponame, const char *pagename, 206extern char *cgit_pageurl(const char *reponame, const char *pagename,
207 const char *query); 207 const char *query);
208 208
209extern const char *cgit_repobasename(const char *reponame); 209extern const char *cgit_repobasename(const char *reponame);
210 210
211extern void cgit_tree_link(char *name, char *title, char *class, char *head, 211extern void cgit_tree_link(char *name, char *title, char *class, char *head,
212 char *rev, char *path); 212 char *rev, char *path);
213extern void cgit_log_link(char *name, char *title, char *class, char *head, 213extern void cgit_log_link(char *name, char *title, char *class, char *head,
214 char *rev, char *path, int ofs); 214 char *rev, char *path, int ofs);
215extern void cgit_commit_link(char *name, char *title, char *class, char *head, 215extern void cgit_commit_link(char *name, char *title, char *class, char *head,
216 char *rev); 216 char *rev);
217extern void cgit_snapshot_link(char *name, char *title, char *class,
218 char *head, char *rev, char *archivename);
217extern void cgit_diff_link(char *name, char *title, char *class, char *head, 219extern void cgit_diff_link(char *name, char *title, char *class, char *head,
218 char *new_rev, char *old_rev, char *path); 220 char *new_rev, char *old_rev, char *path);
219 221
220extern void cgit_object_link(struct object *obj); 222extern void cgit_object_link(struct object *obj);
221 223
222extern void cgit_print_error(char *msg); 224extern void cgit_print_error(char *msg);
223extern void cgit_print_date(time_t secs, char *format); 225extern void cgit_print_date(time_t secs, char *format);
224extern void cgit_print_age(time_t t, time_t max_relative, char *format); 226extern void cgit_print_age(time_t t, time_t max_relative, char *format);
225extern void cgit_print_docstart(char *title, struct cacheitem *item); 227extern void cgit_print_docstart(char *title, struct cacheitem *item);
226extern void cgit_print_docend(); 228extern void cgit_print_docend();
227extern void cgit_print_pageheader(char *title, int show_search); 229extern void cgit_print_pageheader(char *title, int show_search);
228extern void cgit_print_snapshot_start(const char *mimetype, 230extern void cgit_print_snapshot_start(const char *mimetype,
229 const char *filename, 231 const char *filename,
230 struct cacheitem *item); 232 struct cacheitem *item);
231 233
232extern void cgit_print_repolist(struct cacheitem *item); 234extern void cgit_print_repolist(struct cacheitem *item);
233extern void cgit_print_summary(); 235extern void cgit_print_summary();
234extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager); 236extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *path, int pager);
235extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path); 237extern void cgit_print_blob(struct cacheitem *item, const char *hex, char *path);
236extern void cgit_print_tree(const char *rev, char *path); 238extern void cgit_print_tree(const char *rev, char *path);
237extern void cgit_print_commit(char *hex); 239extern void cgit_print_commit(char *hex);
238extern void cgit_print_tag(char *revname); 240extern void cgit_print_tag(char *revname);
239extern void cgit_print_diff(const char *new_hex, const char *old_hex); 241extern void cgit_print_diff(const char *new_hex, const char *old_hex);
240extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, 242extern void cgit_print_snapshot(struct cacheitem *item, const char *head,
241 const char *prefix, const char *filename, 243 const char *hex, const char *prefix,
242 int snapshot); 244 const char *filename, int snapshot);
243extern void cgit_print_snapshot_links(const char *repo, const char *hex,int snapshots); 245extern void cgit_print_snapshot_links(const char *repo, const char *head,
246 const char *hex, int snapshots);
244extern int cgit_parse_snapshots_mask(const char *str); 247extern int cgit_parse_snapshots_mask(const char *str);
245 248
246#endif /* CGIT_H */ 249#endif /* CGIT_H */
diff --git a/ui-commit.c b/ui-commit.c
index 50e9e11..90e09ed 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -175,49 +175,50 @@ void cgit_print_commit(char *hex)
175 html("<tr><th>tree</th><td colspan='2' class='sha1'>"); 175 html("<tr><th>tree</th><td colspan='2' class='sha1'>");
176 tmp = xstrdup(hex); 176 tmp = xstrdup(hex);
177 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, 177 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
178 cgit_query_head, tmp, NULL); 178 cgit_query_head, tmp, NULL);
179 html("</td></tr>\n"); 179 html("</td></tr>\n");
180 for (p = commit->parents; p ; p = p->next) { 180 for (p = commit->parents; p ; p = p->next) {
181 parent = lookup_commit_reference(p->item->object.sha1); 181 parent = lookup_commit_reference(p->item->object.sha1);
182 if (!parent) { 182 if (!parent) {
183 html("<tr><td colspan='3'>"); 183 html("<tr><td colspan='3'>");
184 cgit_print_error("Error reading parent commit"); 184 cgit_print_error("Error reading parent commit");
185 html("</td></tr>"); 185 html("</td></tr>");
186 continue; 186 continue;
187 } 187 }
188 html("<tr><th>parent</th>" 188 html("<tr><th>parent</th>"
189 "<td colspan='2' class='sha1'>"); 189 "<td colspan='2' class='sha1'>");
190 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, 190 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
191 cgit_query_head, sha1_to_hex(p->item->object.sha1)); 191 cgit_query_head, sha1_to_hex(p->item->object.sha1));
192 html(" ("); 192 html(" (");
193 cgit_diff_link("diff", NULL, NULL, cgit_query_head, hex, 193 cgit_diff_link("diff", NULL, NULL, cgit_query_head, hex,
194 sha1_to_hex(p->item->object.sha1), NULL); 194 sha1_to_hex(p->item->object.sha1), NULL);
195 html(")</td></tr>"); 195 html(")</td></tr>");
196 } 196 }
197 if (cgit_repo->snapshots) { 197 if (cgit_repo->snapshots) {
198 html("<tr><th>download</th><td colspan='2' class='sha1'>"); 198 html("<tr><th>download</th><td colspan='2' class='sha1'>");
199 cgit_print_snapshot_links(cgit_query_repo,hex,cgit_repo->snapshots); 199 cgit_print_snapshot_links(cgit_query_repo, cgit_query_head,
200 hex, cgit_repo->snapshots);
200 html("</td></tr>"); 201 html("</td></tr>");
201 } 202 }
202 html("</table>\n"); 203 html("</table>\n");
203 html("<div class='commit-subject'>"); 204 html("<div class='commit-subject'>");
204 html_txt(info->subject); 205 html_txt(info->subject);
205 html("</div>"); 206 html("</div>");
206 html("<div class='commit-msg'>"); 207 html("<div class='commit-msg'>");
207 html_txt(info->msg); 208 html_txt(info->msg);
208 html("</div>"); 209 html("</div>");
209 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { 210 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
210 html("<div class='diffstat-header'>Diffstat</div>"); 211 html("<div class='diffstat-header'>Diffstat</div>");
211 html("<table class='diffstat'>"); 212 html("<table class='diffstat'>");
212 max_changes = 0; 213 max_changes = 0;
213 cgit_diff_commit(commit, inspect_filepair); 214 cgit_diff_commit(commit, inspect_filepair);
214 for(i = 0; i<files; i++) 215 for(i = 0; i<files; i++)
215 print_fileinfo(&items[i]); 216 print_fileinfo(&items[i]);
216 html("</table>"); 217 html("</table>");
217 html("<div class='diffstat-summary'>"); 218 html("<div class='diffstat-summary'>");
218 htmlf("%d files changed, %d insertions, %d deletions (", 219 htmlf("%d files changed, %d insertions, %d deletions (",
219 files, total_adds, total_rems); 220 files, total_adds, total_rems);
220 cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex, 221 cgit_diff_link("show diff", NULL, NULL, cgit_query_head, hex,
221 NULL, NULL); 222 NULL, NULL);
222 html(")</div>"); 223 html(")</div>");
223 } 224 }
diff --git a/ui-shared.c b/ui-shared.c
index ca2ee82..5c5bcf3 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -206,48 +206,54 @@ void cgit_log_link(char *name, char *title, char *class, char *head,
206 delim = "&"; 206 delim = "&";
207 } 207 }
208 if (ofs > 0) { 208 if (ofs > 0) {
209 html(delim); 209 html(delim);
210 html("ofs="); 210 html("ofs=");
211 htmlf("%d", ofs); 211 htmlf("%d", ofs);
212 } 212 }
213 html("'>"); 213 html("'>");
214 html_txt(name); 214 html_txt(name);
215 html("</a>"); 215 html("</a>");
216} 216}
217 217
218void cgit_commit_link(char *name, char *title, char *class, char *head, 218void cgit_commit_link(char *name, char *title, char *class, char *head,
219 char *rev) 219 char *rev)
220{ 220{
221 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) { 221 if (strlen(name) > cgit_max_msg_len && cgit_max_msg_len >= 15) {
222 name[cgit_max_msg_len] = '\0'; 222 name[cgit_max_msg_len] = '\0';
223 name[cgit_max_msg_len - 1] = '.'; 223 name[cgit_max_msg_len - 1] = '.';
224 name[cgit_max_msg_len - 2] = '.'; 224 name[cgit_max_msg_len - 2] = '.';
225 name[cgit_max_msg_len - 3] = '.'; 225 name[cgit_max_msg_len - 3] = '.';
226 } 226 }
227 reporevlink("commit", name, title, class, head, rev, NULL); 227 reporevlink("commit", name, title, class, head, rev, NULL);
228} 228}
229 229
230void cgit_snapshot_link(char *name, char *title, char *class, char *head,
231 char *rev, char *archivename)
232{
233 reporevlink("snapshot", name, title, class, head, rev, archivename);
234}
235
230void cgit_diff_link(char *name, char *title, char *class, char *head, 236void cgit_diff_link(char *name, char *title, char *class, char *head,
231 char *new_rev, char *old_rev, char *path) 237 char *new_rev, char *old_rev, char *path)
232{ 238{
233 char *delim; 239 char *delim;
234 240
235 delim = repolink(title, class, "diff", head, path); 241 delim = repolink(title, class, "diff", head, path);
236 if (new_rev && strcmp(new_rev, cgit_query_head)) { 242 if (new_rev && strcmp(new_rev, cgit_query_head)) {
237 html(delim); 243 html(delim);
238 html("id="); 244 html("id=");
239 html_attr(new_rev); 245 html_attr(new_rev);
240 delim = "&amp;"; 246 delim = "&amp;";
241 } 247 }
242 if (old_rev) { 248 if (old_rev) {
243 html(delim); 249 html(delim);
244 html("id2="); 250 html("id2=");
245 html_attr(old_rev); 251 html_attr(old_rev);
246 } 252 }
247 html("'>"); 253 html("'>");
248 html_txt(name); 254 html_txt(name);
249 html("</a>"); 255 html("</a>");
250} 256}
251 257
252void cgit_object_link(struct object *obj) 258void cgit_object_link(struct object *obj)
253{ 259{
diff --git a/ui-snapshot.c b/ui-snapshot.c
index d6be55b..f9879ed 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -44,99 +44,109 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f
44 return rv; 44 return rv;
45} 45}
46 46
47static int write_tar_gzip_archive(struct archiver_args *args) 47static int write_tar_gzip_archive(struct archiver_args *args)
48{ 48{
49 return write_compressed_tar_archive(args,"gzip"); 49 return write_compressed_tar_archive(args,"gzip");
50} 50}
51static int write_tar_bzip2_archive(struct archiver_args *args) 51static int write_tar_bzip2_archive(struct archiver_args *args)
52{ 52{
53 return write_compressed_tar_archive(args,"bzip2"); 53 return write_compressed_tar_archive(args,"bzip2");
54} 54}
55 55
56static const struct snapshot_archive_t { 56static const struct snapshot_archive_t {
57 const char *suffix; 57 const char *suffix;
58 const char *mimetype; 58 const char *mimetype;
59 write_archive_fn_t write_func; 59 write_archive_fn_t write_func;
60 int bit; 60 int bit;
61 }snapshot_archives[] = { 61 }snapshot_archives[] = {
62 { ".zip", "application/x-zip", write_zip_archive, 0x1 }, 62 { ".zip", "application/x-zip", write_zip_archive, 0x1 },
63 { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 }, 63 { ".tar.gz", "application/x-tar", write_tar_gzip_archive, 0x2 },
64 { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 }, 64 { ".tar.bz2", "application/x-tar", write_tar_bzip2_archive, 0x4 },
65 { ".tar", "application/x-tar", write_tar_archive, 0x8 } 65 { ".tar", "application/x-tar", write_tar_archive, 0x8 }
66}; 66};
67 67
68void cgit_print_snapshot(struct cacheitem *item, const char *hex, 68void cgit_print_snapshot(struct cacheitem *item, const char *head,
69 const char *prefix, const char *filename, 69 const char *hex, const char *prefix,
70 int snapshots) 70 const char *filename, int snapshots)
71{ 71{
72 int fnl = strlen(filename); 72 int fnl = strlen(filename);
73 int f; 73 int f, n;
74 for(f=0;f<(sizeof(snapshot_archives)/sizeof(*snapshot_archives));++f) { 74
75 n = sizeof(snapshot_archives) / sizeof(*snapshot_archives);
76 for(f=0; f<n; f++) {
75 const struct snapshot_archive_t* sat = &snapshot_archives[f]; 77 const struct snapshot_archive_t* sat = &snapshot_archives[f];
76 int sl; 78 int sl;
77 if(!(snapshots&sat->bit)) continue; 79 if(!(snapshots & sat->bit))
80 continue;
78 sl = strlen(sat->suffix); 81 sl = strlen(sat->suffix);
79 if(fnl<sl || strcmp(&filename[fnl-sl],sat->suffix)) 82 if(fnl<sl || strcmp(&filename[fnl-sl],sat->suffix))
80 continue; 83 continue;
81 84
82 struct archiver_args args; 85 struct archiver_args args;
83 struct commit *commit; 86 struct commit *commit;
84 unsigned char sha1[20]; 87 unsigned char sha1[20];
85 88
89 if (!hex)
90 hex = head;
86 if(get_sha1(hex, sha1)) { 91 if(get_sha1(hex, sha1)) {
87 cgit_print_error(fmt("Bad object id: %s", hex)); 92 cgit_print_error(fmt("Bad object id: %s", hex));
88 return; 93 return;
89 } 94 }
90 commit = lookup_commit_reference(sha1); 95 commit = lookup_commit_reference(sha1);
91 96
92 if(!commit) { 97 if(!commit) {
93 cgit_print_error(fmt("Not a commit reference: %s", hex)); 98 cgit_print_error(fmt("Not a commit reference: %s", hex));
94 return;; 99 return;;
95 } 100 }
96 101
97 memset(&args,0,sizeof(args)); 102 memset(&args,0,sizeof(args));
98 args.base = fmt("%s/", prefix); 103 args.base = fmt("%s/", prefix);
99 args.tree = commit->tree; 104 args.tree = commit->tree;
100 105
101 cgit_print_snapshot_start(sat->mimetype, filename, item); 106 cgit_print_snapshot_start(sat->mimetype, filename, item);
102 (*sat->write_func)(&args); 107 (*sat->write_func)(&args);
103 return; 108 return;
104 } 109 }
105 cgit_print_error(fmt("Unsupported snapshot format: %s", filename)); 110 cgit_print_error(fmt("Unsupported snapshot format: %s", filename));
106} 111}
107 112
108void cgit_print_snapshot_links(const char *repo,const char *hex,int snapshots) 113void cgit_print_snapshot_links(const char *repo, const char *head,
114 const char *hex, int snapshots)
109{ 115{
110 char *filename; 116 char *filename;
111 int f; 117 int f, n;
112 for(f=0;f<(sizeof(snapshot_archives)/sizeof(*snapshot_archives));++f) { 118
119 n = sizeof(snapshot_archives) / sizeof(*snapshot_archives);
120 for(f=0; f<n ;f++) {
113 const struct snapshot_archive_t* sat = &snapshot_archives[f]; 121 const struct snapshot_archive_t* sat = &snapshot_archives[f];
114 if(!(snapshots&sat->bit)) continue; 122 if(!(snapshots & sat->bit))
115 filename = fmt("%s-%s%s",cgit_repobasename(repo),hex,sat->suffix); 123 continue;
116 htmlf("<a href='%s'>%s</a><br/>", 124 filename = fmt("%s-%s%s", cgit_repobasename(repo), hex,
117 cgit_fileurl(repo,"snapshot",filename, 125 sat->suffix);
118 fmt("id=%s&amp;name=%s",hex,filename)), filename); 126 cgit_snapshot_link(filename, NULL, NULL, (char *)head,
127 (char *)hex, filename);
128 html("<br/>");
119 } 129 }
120} 130}
121 131
122int cgit_parse_snapshots_mask(const char *str) 132int cgit_parse_snapshots_mask(const char *str)
123{ 133{
124 static const char *delim = " \t,:/|;"; 134 static const char *delim = " \t,:/|;";
125 int f, tl, rv = 0; 135 int f, tl, rv = 0;
126 /* favor legacy setting */ 136 /* favor legacy setting */
127 if(atoi(str)) return 1; 137 if(atoi(str)) return 1;
128 for(;;) { 138 for(;;) {
129 str += strspn(str,delim); 139 str += strspn(str,delim);
130 tl = strcspn(str,delim); 140 tl = strcspn(str,delim);
131 if(!tl) 141 if(!tl)
132 break; 142 break;
133 for(f=0;f<(sizeof(snapshot_archives)/sizeof(*snapshot_archives));++f) { 143 for(f=0;f<(sizeof(snapshot_archives)/sizeof(*snapshot_archives));++f) {
134 const struct snapshot_archive_t* sat = &snapshot_archives[f]; 144 const struct snapshot_archive_t* sat = &snapshot_archives[f];
135 if(! ( strncmp(sat->suffix,str,tl) && strncmp(sat->suffix+1,str,tl-1) ) ) { 145 if(! ( strncmp(sat->suffix,str,tl) && strncmp(sat->suffix+1,str,tl-1) ) ) {
136 rv |= sat->bit; 146 rv |= sat->bit;
137 break; 147 break;
138 } 148 }
139 } 149 }
140 str += tl; 150 str += tl;
141 } 151 }
142 return rv; 152 return rv;