Index: trunk/debs/squid/redirector.c |
— | — | @@ -19,16 +19,22 @@ |
20 | 20 | #define OVECCOUNT 30 /* should be a multiple of 3 */ |
21 | 21 | |
22 | 22 | struct IN_BUFF { |
| 23 | + char *chan; |
23 | 24 | char *url; |
24 | 25 | }; |
25 | 26 | |
26 | 27 | int load_in_buff(char *buff, struct IN_BUFF *in_buff) { |
27 | | - in_buff->url = strtok(buff, " "); |
| 28 | + in_buff->chan = strtok(buff, " "); |
| 29 | + in_buff->url = strtok(NULL, " "); |
28 | 30 | |
29 | | - if(strlen(in_buff->url) <= 4) { |
| 31 | + if(strlen(in_buff->chan) < 1) { |
30 | 32 | return 1; |
31 | 33 | } |
32 | 34 | |
| 35 | + if(in_buff->url == NULL || strlen(in_buff->url) <= 4) { |
| 36 | + return 1; |
| 37 | + } |
| 38 | + |
33 | 39 | return 0; |
34 | 40 | } |
35 | 41 | |
— | — | @@ -94,7 +100,7 @@ |
95 | 101 | if (rc < 0) { |
96 | 102 | switch(rc) { |
97 | 103 | case PCRE_ERROR_NOMATCH: |
98 | | - printf("%s", in_buff.url); |
| 104 | + printf("%s %s\n", in_buff.chan, in_buff.url); |
99 | 105 | fflush(stdout); |
100 | 106 | |
101 | 107 | break; |
— | — | @@ -128,6 +134,7 @@ |
129 | 135 | } |
130 | 136 | |
131 | 137 | if (strlen(path) > 0) { |
| 138 | + printf("%s ", in_buff.chan); |
132 | 139 | printf(replacement_url, lang, path); |
133 | 140 | } |
134 | 141 | |