Unidiff1 files changed, 0 insertions, 49 deletions
|
diff --git a/parsing.c b/parsing.c index 9a4a7a3..66e8b3d 100644 --- a/ parsing.c+++ b/ parsing.c |
|
@@ -3,65 +3,16 @@ |
3 | * Copyright (C) 2006 Lars Hjemli |
3 | * Copyright (C) 2006 Lars Hjemli |
4 | * |
4 | * |
5 | * Licensed under GNU General Public License v2 |
5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) |
6 | * (see COPYING for full license text) |
7 | */ |
7 | */ |
8 | |
8 | |
9 | #include "cgit.h" |
9 | #include "cgit.h" |
10 | |
10 | |
11 | char *convert_query_hexchar(char *txt) |
| |
12 | { |
| |
13 | int d1, d2; |
| |
14 | if (strlen(txt) < 3) { |
| |
15 | *txt = '\0'; |
| |
16 | return txt-1; |
| |
17 | } |
| |
18 | d1 = hextoint(*(txt+1)); |
| |
19 | d2 = hextoint(*(txt+2)); |
| |
20 | if (d1<0 || d2<0) { |
| |
21 | strcpy(txt, txt+3); |
| |
22 | return txt-1; |
| |
23 | } else { |
| |
24 | *txt = d1 * 16 + d2; |
| |
25 | strcpy(txt+1, txt+3); |
| |
26 | return txt; |
| |
27 | } |
| |
28 | } |
| |
29 | |
| |
30 | int cgit_parse_query(char *txt, configfn fn) |
| |
31 | { |
| |
32 | char *t, *value = NULL, c; |
| |
33 | |
| |
34 | if (!txt) |
| |
35 | return 0; |
| |
36 | |
| |
37 | t = txt = xstrdup(txt); |
| |
38 | |
| |
39 | while((c=*t) != '\0') { |
| |
40 | if (c=='=') { |
| |
41 | *t = '\0'; |
| |
42 | value = t+1; |
| |
43 | } else if (c=='+') { |
| |
44 | *t = ' '; |
| |
45 | } else if (c=='%') { |
| |
46 | t = convert_query_hexchar(t); |
| |
47 | } else if (c=='&') { |
| |
48 | *t = '\0'; |
| |
49 | (*fn)(txt, value); |
| |
50 | txt = t+1; |
| |
51 | value = NULL; |
| |
52 | } |
| |
53 | t++; |
| |
54 | } |
| |
55 | if (t!=txt) |
| |
56 | (*fn)(txt, value); |
| |
57 | return 0; |
| |
58 | } |
| |
59 | |
| |
60 | /* |
11 | /* |
61 | * url syntax: [repo ['/' cmd [ '/' path]]] |
12 | * url syntax: [repo ['/' cmd [ '/' path]]] |
62 | * repo: any valid repo url, may contain '/' |
13 | * repo: any valid repo url, may contain '/' |
63 | * cmd: log | commit | diff | tree | view | blob | snapshot |
14 | * cmd: log | commit | diff | tree | view | blob | snapshot |
64 | * path: any valid path, may contain '/' |
15 | * path: any valid path, may contain '/' |
65 | * |
16 | * |
66 | */ |
17 | */ |
67 | void cgit_parse_url(const char *url) |
18 | void cgit_parse_url(const char *url) |
|