diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/graph.c | 1 | ||||
-rw-r--r-- | src/html.gram.y | 34 | ||||
-rw-r--r-- | src/html.lex.l | 10 | ||||
-rw-r--r-- | src/log.c | 16 | ||||
-rw-r--r-- | src/main.c | 77 | ||||
-rw-r--r-- | src/readconfig.c | 32 | ||||
-rw-r--r-- | src/report.c | 40 | ||||
-rw-r--r-- | src/stat.c | 65 | ||||
-rw-r--r-- | src/tagr.h | 5 |
9 files changed, 149 insertions, 131 deletions
diff --git a/src/graph.c b/src/graph.c index bfd00cb..1464e8b 100644 --- a/src/graph.c +++ b/src/graph.c | |||
@@ -45,24 +45,25 @@ int color_in[3] = { 0,235,12 }; | |||
45 | int color_out[3] = { 0,94,255 }; | 45 | int color_out[3] = { 0,94,255 }; |
46 | int color_grid[3] = { 0,0,0 }; | 46 | int color_grid[3] = { 0,0,0 }; |
47 | int color_in_max[3] = { 0,166,33 }; | 47 | int color_in_max[3] = { 0,166,33 }; |
48 | int color_out_max[3] = { 255,0,255 }; | 48 | int color_out_max[3] = { 255,0,255 }; |
49 | int color_percent[3] = { 239,159,79 }; | 49 | int color_percent[3] = { 239,159,79 }; |
50 | 50 | ||
51 | int graph_xsize = 460; | 51 | int graph_xsize = 460; |
52 | int graph_ysize = 100; | 52 | int graph_ysize = 100; |
53 | 53 | ||
54 | int graph_h_margin[2] = { 100, 14 }; | 54 | int graph_h_margin[2] = { 100, 14 }; |
55 | int graph_v_margin[2] = { 14, 35 }; | 55 | int graph_v_margin[2] = { 14, 35 }; |
56 | 56 | ||
57 | /* FIXME: I18N?? */ | ||
57 | char *rate_unit = "Bytes per Second"; | 58 | char *rate_unit = "Bytes per Second"; |
58 | 59 | ||
59 | #define make_color_index(g, ar) \ | 60 | #define make_color_index(g, ar) \ |
60 | gdImageColorAllocate (g, (ar)[0], (ar)[1], (ar)[2]) | 61 | gdImageColorAllocate (g, (ar)[0], (ar)[1], (ar)[2]) |
61 | 62 | ||
62 | static void | 63 | static void |
63 | draw_vtext (gdImagePtr graph, int color, const char *text) | 64 | draw_vtext (gdImagePtr graph, int color, const char *text) |
64 | { | 65 | { |
65 | gdImageStringUp (graph, gdFontSmall, | 66 | gdImageStringUp (graph, gdFontSmall, |
66 | 8, | 67 | 8, |
67 | graph_ysize + graph_v_margin[0] - | 68 | graph_ysize + graph_v_margin[0] - |
68 | (graph_ysize - gdFontSmall->w * strlen (text))/2, | 69 | (graph_ysize - gdFontSmall->w * strlen (text))/2, |
diff --git a/src/html.gram.y b/src/html.gram.y index fae64ff..e488494 100644 --- a/src/html.gram.y +++ b/src/html.gram.y | |||
@@ -104,25 +104,25 @@ cbrace: CBRACE | |||
104 | expr : value | 104 | expr : value |
105 | | '(' expr ')' | 105 | | '(' expr ')' |
106 | { | 106 | { |
107 | $$ = $2; | 107 | $$ = $2; |
108 | } | 108 | } |
109 | | expr '+' expr | 109 | | expr '+' expr |
110 | { | 110 | { |
111 | if ($1.type == unspecified_value | 111 | if ($1.type == unspecified_value |
112 | || $3.type == unspecified_value) | 112 | || $3.type == unspecified_value) |
113 | init_value (&$$, unspecified_value, NULL); | 113 | init_value (&$$, unspecified_value, NULL); |
114 | else if ($1.type != $3.type) | 114 | else if ($1.type != $3.type) |
115 | { | 115 | { |
116 | yyerror ("type mismatch in addition"); | 116 | yyerror (_("type mismatch in addition")); |
117 | init_value (&$$, unspecified_value, NULL); | 117 | init_value (&$$, unspecified_value, NULL); |
118 | } | 118 | } |
119 | else | 119 | else |
120 | { | 120 | { |
121 | $$.type = $1.type; | 121 | $$.type = $1.type; |
122 | deduce_format (&$$, &$1, &$3); | 122 | deduce_format (&$$, &$1, &$3); |
123 | switch ($1.type) | 123 | switch ($1.type) |
124 | { | 124 | { |
125 | case numeric_value: | 125 | case numeric_value: |
126 | $$.v.number = $1.v.number + $3.v.number; | 126 | $$.v.number = $1.v.number + $3.v.number; |
127 | break; | 127 | break; |
128 | 128 | ||
@@ -136,110 +136,110 @@ expr : value | |||
136 | default: | 136 | default: |
137 | abort (); /* Should not happen */ | 137 | abort (); /* Should not happen */ |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
141 | | expr '-' expr | 141 | | expr '-' expr |
142 | { | 142 | { |
143 | if ($1.type == unspecified_value | 143 | if ($1.type == unspecified_value |
144 | || $3.type == unspecified_value) | 144 | || $3.type == unspecified_value) |
145 | init_value (&$$, unspecified_value, NULL); | 145 | init_value (&$$, unspecified_value, NULL); |
146 | else if ($1.type != $3.type) | 146 | else if ($1.type != $3.type) |
147 | { | 147 | { |
148 | yyerror ("type mismatch in subtraction"); | 148 | yyerror (_("type mismatch in subtraction")); |
149 | init_value (&$$, unspecified_value, NULL); | 149 | init_value (&$$, unspecified_value, NULL); |
150 | } | 150 | } |
151 | else if ($1.type == string_value) | 151 | else if ($1.type == string_value) |
152 | { | 152 | { |
153 | yyerror ("subtraction not defined for strings"); | 153 | yyerror (_("subtraction not defined for strings")); |
154 | init_value (&$$, unspecified_value, NULL); | 154 | init_value (&$$, unspecified_value, NULL); |
155 | } | 155 | } |
156 | else | 156 | else |
157 | { | 157 | { |
158 | $$.type = $1.type; | 158 | $$.type = $1.type; |
159 | deduce_format (&$$, &$1, &$3); | 159 | deduce_format (&$$, &$1, &$3); |
160 | $$.v.number = $1.v.number - $3.v.number; | 160 | $$.v.number = $1.v.number - $3.v.number; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | | expr '*' expr | 163 | | expr '*' expr |
164 | { | 164 | { |
165 | if ($1.type == unspecified_value | 165 | if ($1.type == unspecified_value |
166 | || $3.type == unspecified_value) | 166 | || $3.type == unspecified_value) |
167 | init_value (&$$, unspecified_value, NULL); | 167 | init_value (&$$, unspecified_value, NULL); |
168 | else if ($1.type != $3.type) | 168 | else if ($1.type != $3.type) |
169 | { | 169 | { |
170 | yyerror ("type mismatch in multiplication"); | 170 | yyerror (_("type mismatch in multiplication")); |
171 | init_value (&$$, unspecified_value, NULL); | 171 | init_value (&$$, unspecified_value, NULL); |
172 | } | 172 | } |
173 | else if ($1.type == string_value) | 173 | else if ($1.type == string_value) |
174 | { | 174 | { |
175 | yyerror ("multiplication not defined for strings"); | 175 | yyerror (_("multiplication not defined for strings")); |
176 | init_value (&$$, unspecified_value, NULL); | 176 | init_value (&$$, unspecified_value, NULL); |
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | $$.type = $1.type; | 180 | $$.type = $1.type; |
181 | deduce_format (&$$, &$1, &$3); | 181 | deduce_format (&$$, &$1, &$3); |
182 | $$.v.number = $1.v.number * $3.v.number; | 182 | $$.v.number = $1.v.number * $3.v.number; |
183 | } | 183 | } |
184 | } | 184 | } |
185 | | expr '/' expr | 185 | | expr '/' expr |
186 | { | 186 | { |
187 | if ($1.type == unspecified_value | 187 | if ($1.type == unspecified_value |
188 | || $3.type == unspecified_value) | 188 | || $3.type == unspecified_value) |
189 | init_value (&$$, unspecified_value, NULL); | 189 | init_value (&$$, unspecified_value, NULL); |
190 | else if ($1.type != $3.type) | 190 | else if ($1.type != $3.type) |
191 | { | 191 | { |
192 | yyerror ("type mismatch in division"); | 192 | yyerror (_("type mismatch in division")); |
193 | init_value (&$$, unspecified_value, NULL); | 193 | init_value (&$$, unspecified_value, NULL); |
194 | } | 194 | } |
195 | else if ($1.type == string_value) | 195 | else if ($1.type == string_value) |
196 | { | 196 | { |
197 | yyerror ("division not defined for strings"); | 197 | yyerror (_("division not defined for strings")); |
198 | init_value (&$$, unspecified_value, NULL); | 198 | init_value (&$$, unspecified_value, NULL); |
199 | } | 199 | } |
200 | else if (fabs ($3.v.number) < 1.0e-5) | 200 | else if (fabs ($3.v.number) < 1.0e-5) |
201 | { | 201 | { |
202 | yyerror ("division by zero"); | 202 | yyerror (_("division by zero")); |
203 | init_value (&$$, unspecified_value, NULL); | 203 | init_value (&$$, unspecified_value, NULL); |
204 | } | 204 | } |
205 | else | 205 | else |
206 | { | 206 | { |
207 | $$.type = $1.type; | 207 | $$.type = $1.type; |
208 | deduce_format (&$$, &$1, &$3); | 208 | deduce_format (&$$, &$1, &$3); |
209 | $$.v.number = $1.v.number / $3.v.number; | 209 | $$.v.number = $1.v.number / $3.v.number; |
210 | } | 210 | } |
211 | } | 211 | } |
212 | | '-' expr %prec UMINUS | 212 | | '-' expr %prec UMINUS |
213 | { | 213 | { |
214 | if ($2.type == unspecified_value) | 214 | if ($2.type == unspecified_value) |
215 | init_value (&$$, unspecified_value, NULL); | 215 | init_value (&$$, unspecified_value, NULL); |
216 | else if ($2.type == string_value) | 216 | else if ($2.type == string_value) |
217 | { | 217 | { |
218 | yyerror ("unary minus not defined for strings"); | 218 | yyerror (_("unary minus not defined for strings")); |
219 | init_value (&$$, unspecified_value, NULL); | 219 | init_value (&$$, unspecified_value, NULL); |
220 | } | 220 | } |
221 | else | 221 | else |
222 | { | 222 | { |
223 | $$ = $2; | 223 | $$ = $2; |
224 | $$.v.number = - $2.v.number; | 224 | $$.v.number = - $2.v.number; |
225 | } | 225 | } |
226 | } | 226 | } |
227 | | '+' expr %prec UMINUS | 227 | | '+' expr %prec UMINUS |
228 | { | 228 | { |
229 | if ($2.type == unspecified_value) | 229 | if ($2.type == unspecified_value) |
230 | init_value (&$$, unspecified_value, NULL); | 230 | init_value (&$$, unspecified_value, NULL); |
231 | else if ($2.type == string_value) | 231 | else if ($2.type == string_value) |
232 | { | 232 | { |
233 | yyerror ("unary plus not defined for strings"); | 233 | yyerror (_("unary plus not defined for strings")); |
234 | init_value (&$$, unspecified_value, NULL); |