author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-26 21:50:31 (GMT) |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-04-26 21:50:31 (GMT) |
commit | fe8f5226e8bc39bdc75e40e1c1ea464e9fc60ad3 (patch) (unidiff) | |
tree | 611a7c8505a0eb77a2b84de5dab80b6ca02a14e6 | |
parent | d50fc04ded36255465184a16c70eb4c50acdb199 (diff) | |
download | tagr-fe8f5226e8bc39bdc75e40e1c1ea464e9fc60ad3.tar.gz tagr-fe8f5226e8bc39bdc75e40e1c1ea464e9fc60ad3.tar.bz2 |
Provide i18n markers
-rw-r--r-- | configure.ac | 18 | ||||
-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 |
10 files changed, 167 insertions, 131 deletions
diff --git a/configure.ac b/configure.ac index a622998..70e0c79 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -76,4 +76,22 @@ AC_CHECK_LIB([gdbm], [gdbm_open], | |||
76 | [AC_MSG_ERROR([libgdbm not found])]) | 76 | [AC_MSG_ERROR([libgdbm not found])]) |
77 | 77 | ||
78 | ## Default syslog facility | ||
79 | LOG_FACILITY="LOG_DAEMON" | ||
80 | |||
81 | AC_ARG_VAR([LOG_FACILITY], | ||
82 | [Default syslog facility]) | ||
83 | if test -n "$LOG_FACILITY"; then | ||
84 | logfacility=`echo $LOG_FACILITY | tr a-z A-Z` | ||
85 | case $logfacility in | ||
86 | USER|DAEMON|AUTH|AUTHPRIV|MAIL|CRON|LOCAL[[0-7]]) | ||
87 | LOG_FACILITY=LOG_$logfacility;; | ||
88 | LOG_USER|LOG_DAEMON|LOG_AUTH|LOG_AUTHPRIV|LOG_MAIL|LOG_CRON|LOG_LOCAL[[0-7]]) | ||
89 | LOG_FACILITY=$logfacility;; | ||
90 | *) AC_MSG_ERROR([Invalid value of LOG_FACILITY]);; | ||
91 | esac | ||
92 | fi | ||
93 | AC_DEFINE_UNQUOTED([LOG_FACILITY],$LOG_FACILITY, | ||
94 | [Default syslog facility.]) | ||
95 | |||
78 | AC_CONFIG_FILES([Makefile | 96 | AC_CONFIG_FILES([Makefile |
79 | gnu/Makefile | 97 | gnu/Makefile |
diff --git a/src/graph.c b/src/graph.c index bfd00cb..1464e8b 100644 --- a/src/graph.c +++ b/src/graph.c | |||
@@ -55,4 +55,5 @@ 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 | ||
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 | |||
@@ -114,5 +114,5 @@ expr : value | |||
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 | } |
@@ -146,10 +146,10 @@ expr : value | |||
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 | } |
@@ -168,10 +168,10 @@ expr : value | |||
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 | } |
@@ -190,15 +190,15 @@ expr : value | |||
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 | } |
@@ -216,5 +216,5 @@ expr : value | |||
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 | } |
@@ -231,5 +231,5 @@ expr : value | |||
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); | 234 | init_value (&$$, unspecified_value, NULL); |
235 | } | 235 | } |
@@ -274,5 +274,5 @@ create_html (pp_tab_t *tab, char *file, char *dest) | |||
274 | if (!tmp_file) | 274 | if (!tmp_file) |
275 | { | 275 | { |
276 | logmsg (L_ERR, "cannot open output file `%s': %s", | 276 | logmsg (L_ERR, _("cannot open output file `%s': %s"), |
277 | file, strerror (errno)); | 277 | file, strerror (errno)); |
278 | html_close (); | 278 | html_close (); |
@@ -287,5 +287,5 @@ create_html (pp_tab_t *tab, char *file, char *dest) | |||
287 | if (unlink (dest) && errno != ENOENT) | 287 | if (unlink (dest) && errno != ENOENT) |
288 | { | 288 | { |
289 | logmsg (L_ERR, "cannot unlink file `%s': %s", | 289 | logmsg (L_ERR, _("cannot unlink file `%s': %s"), |
290 | dest, strerror (errno)); | 290 | dest, strerror (errno)); |
291 | rc = 1; | 291 | rc = 1; |
@@ -294,5 +294,5 @@ create_html (pp_tab_t *tab, char *file, char *dest) | |||
294 | if (rename (tmp_file_name, dest)) | 294 | if (rename (tmp_file_name, dest)) |
295 | { | 295 | { |
296 | logmsg (L_ERR, "cannot rename `%s' to `%s': %s", | 296 | logmsg (L_ERR, _("cannot rename `%s' to `%s': %s"), |
297 | tmp_file_name, dest, | 297 | tmp_file_name, dest, |
298 | strerror (errno)); | 298 | strerror (errno)); |
@@ -495,5 +495,5 @@ read_symtab (pp_tab_t **tab, const char *name) | |||
495 | if (*p != ' ' || !(isascii (*++p) && isalpha (*p))) | 495 | if (*p != ' ' || !(isascii (*++p) && isalpha (*p))) |
496 | { | 496 | { |
497 | logmsg (L_ERR, "%s:%u: invalid input: %s", | 497 | logmsg (L_ERR, _("%s:%u: invalid input: %s"), |
498 | name, line, buf); | 498 | name, line, buf); |
499 | status = 1; | 499 | status = 1; |
@@ -504,5 +504,5 @@ read_symtab (pp_tab_t **tab, const char *name) | |||
504 | if (!p) | 504 | if (!p) |
505 | { | 505 | { |
506 | logmsg (L_ERR, "%s:%u: invalid input: %s", | 506 | logmsg (L_ERR, _("%s:%u: invalid input: %s"), |
507 | name, line, buf); | 507 | name, line, buf); |
508 | status = 1; | 508 | status = 1; |
@@ -524,5 +524,5 @@ read_symtab (pp_tab_t **tab, const char *name) | |||
524 | if (*p) | 524 | if (*p) |
525 | { | 525 | { |
526 | logmsg (L_ERR, "%s:%u: invalid numeric value: %s", | 526 | logmsg (L_ERR, _("%s:%u: invalid numeric value: %s"), |
527 | name, line, value); | 527 | name, line, value); |
528 | status = 1; | 528 | status = 1; |
@@ -534,5 +534,5 @@ read_symtab (pp_tab_t **tab, const char *name) | |||
534 | 534 | ||
535 | default: | 535 | default: |
536 | logmsg (L_NOTICE, "%s:%u: ignoring unknown command %#03o", | 536 | logmsg (L_NOTICE, _("%s:%u: ignoring unknown command %#03o"), |
537 | name, line, cmd); | 537 | name, line, cmd); |
538 | } | 538 | } |
diff --git a/src/html.lex.l b/src/html.lex.l index 931bfc1..0e0d423 100644 --- a/src/html.lex.l +++ b/src/html.lex.l | |||
@@ -44,5 +44,5 @@ N [0-9]+ | |||
44 | if (find_value (yytext+1, &yylval.value)) | 44 | if (find_value (yytext+1, &yylval.value)) |
45 | { | 45 | { |
46 | yyerror ("unknown identifier"); | 46 | yyerror (_("unknown identifier")); |
47 | init_value (&yylval.value, unspecified_value, NULL); | 47 | init_value (&yylval.value, unspecified_value, NULL); |
48 | } | 48 | } |
@@ -53,5 +53,5 @@ N [0-9]+ | |||
53 | if (find_value (yytext+2, &yylval.value)) | 53 | if (find_value (yytext+2, &yylval.value)) |
54 | { | 54 | { |
55 | yyerror ("unknown identifier"); | 55 | yyerror (_("unknown identifier")); |
56 | init_value (&yylval.value, unspecified_value, NULL); | 56 | init_value (&yylval.value, unspecified_value, NULL); |
57 | } | 57 | } |
@@ -63,5 +63,5 @@ N [0-9]+ | |||
63 | if (find_value (yytext+2, &yylval.value)) | 63 | if (find_value (yytext+2, &yylval.value)) |
64 | { | 64 | { |
65 | yyerror ("unknown identifier"); | 65 | yyerror (_("unknown identifier")); |
66 | init_value (&yylval.value, unspecified_value, NULL); | 66 | init_value (&yylval.value, unspecified_value, NULL); |
67 | } | 67 | } |
@@ -78,5 +78,5 @@ N [0-9]+ | |||
78 | if (find_value (yytext+2, &val)) | 78 | if (find_value (yytext+2, &val)) |
79 | { | 79 | { |
80 | yyerror ("unknown identifier"); | 80 | yyerror (_("unknown identifier")); |
81 | init_value (&yylval.value, unspecified_value, NULL); | 81 | init_value (&yylval.value, unspecified_value, NULL); |
82 | } | 82 | } |
@@ -131,5 +131,5 @@ html_open (char *file) | |||
131 | if (!yyin) | 131 | if (!yyin) |
132 | { | 132 | { |
133 | logmsg (L_ERR, "cannot open input file `%s': %s", | 133 | logmsg (L_ERR, _("cannot open input file `%s': %s"), |
134 | file, strerror (errno)); | 134 | file, strerror (errno)); |
135 | return 1; | 135 | return 1; |
@@ -30,5 +30,5 @@ | |||
30 | #include <tagr.h> | 30 | #include <tagr.h> |
31 | 31 | ||
32 | int log_facility = LOGFACILITY; | 32 | int log_facility = LOG_FACILITY; |
33 | char *log_tag; | 33 | char *log_tag; |
34 | int log_print_severity; /* FIXME: not used */ | 34 | int log_print_severity; /* FIXME: not used */ |
@@ -52,10 +52,10 @@ int syslog_level[] = { | |||
52 | 52 | ||
53 | char *level_str[] = { | 53 | char *level_str[] = { |
54 | "debug", | 54 | N_("debug"), |
55 | "info", | 55 | N_("info"), |
56 | "notice", | 56 | N_("notice"), |
57 | "warning", | 57 | N_("warning"), |
58 | "error", | 58 | N_("error"), |
59 | "CRITICAL", | 59 | N_("CRITICAL"), |
60 | }; | 60 | }; |
61 | 61 | ||
@@ -66,5 +66,5 @@ vlogmsg (int level, const char *fmt, va_list ap) | |||
66 | if (grecs_log_to_stderr) | 66 | if (grecs_log_to_stderr) |
67 | { | 67 | { |
68 | fprintf (stderr, "%s: %s: ", log_tag, level_str[level]); | 68 | fprintf (stderr, "%s: %s: ", log_tag, gettext (level_str[level])); |
69 | vfprintf (stderr, fmt, ap); | 69 | vfprintf (stderr, fmt, ap); |
70 | fprintf (stderr, "\n"); | 70 | fprintf (stderr, "\n"); |
@@ -81,6 +81,6 @@ static char *html_template_option = NULL; | |||
81 | 81 | ||
82 | const char *program_version = "tagr (" PACKAGE_STRING ")"; | 82 | const char *program_version = "tagr (" PACKAGE_STRING ")"; |
83 | static char doc[] = "tagr -- traffic analyzer and grapher"; | 83 | static char doc[] = N_("tagr -- traffic analyzer and grapher"); |
84 | static char args_doc[] = ""; | 84 | static char args_doc[] = "[FILES or DIRS...]"; |
85 | 85 | ||
86 | enum { | 86 | enum { |
@@ -113,5 +113,5 @@ static struct argp_option options[] = { | |||
113 | GRID+1 }, | 113 | GRID+1 }, |
114 | {"read", OPT_READ, NULL, 0, | 114 | {"read", OPT_READ, NULL, 0, |
115 | N_("read statistics from the given file or standard input") }, | 115 | N_("read statistics from given FILEs or standard input") }, |
116 | {"rebuild", 'b', NULL, 0, | 116 | {"rebuild", 'b', NULL, 0, |
117 | N_("rebuild graphs using existing statistics"), GRID+1}, | 117 | N_("rebuild graphs using existing statistics"), GRID+1}, |
@@ -188,10 +188,10 @@ static void | |||
188 | show_defaults () | 188 | show_defaults () |
189 | { | 189 | { |
190 | printf ("Configuration file: %s\n", TAGR_CONFIGFILE); | 190 | printf (_("Configuration file: %s\n"), TAGR_CONFIGFILE); |
191 | printf ("Page template file: %s\n", TAGR_TEMPLATE); | 191 | printf (_("Page template file: %s\n"), TAGR_TEMPLATE); |
192 | printf ("PID file: %s\n", TAGR_PIDFILE); | 192 | printf (_("PID file: %s\n"), TAGR_PIDFILE); |
193 | printf ("DB file name: %s\n", TAGR_DBNAME); | 193 | printf (_("DB file name: %s\n"), TAGR_DBNAME); |
194 | printf ("DB file permissions: %#o\n", TAGR_DBMODE); | 194 | printf (_("DB file permissions: %#o\n"), TAGR_DBMODE); |
195 | printf ("Syslog facility number: %d\n", LOGFACILITY); | 195 | printf (_("Syslog facility number: %d\n"), LOG_FACILITY); |
196 | } | 196 | } |
197 | 197 | ||
@@ -336,5 +336,5 @@ change_privs (uid_t uid, gid_t gid) | |||
336 | if (geteuid () == 0 && setgroups (1, emptygidset)) | 336 | if (geteuid () == 0 && setgroups (1, emptygidset)) |
337 | { | 337 | { |
338 | logmsg (L_ERR, "setgroups(1, %lu) failed: %s", | 338 | logmsg (L_ERR, _("setgroups(1, %lu) failed: %s"), |
339 | (u_long) emptygidset[0], strerror (errno)); | 339 | (u_long) emptygidset[0], strerror (errno)); |
340 | rc = 1; | 340 | rc = 1; |
@@ -346,12 +346,13 @@ change_privs (uid_t uid, gid_t gid) | |||
346 | #if defined(HAVE_SETEGID) | 346 | #if defined(HAVE_SETEGID) |
347 | if ((rc = setegid (gid)) < 0) | 347 | if ((rc = setegid (gid)) < 0) |
348 | logmsg (L_ERR, "setegid(%lu) failed: %s", (u_long) gid, strerror (errno)); | 348 | logmsg (L_ERR, _("setegid(%lu) failed: %s"), |
349 | (u_long) gid, strerror (errno)); | ||
349 | #elif defined(HAVE_SETREGID) | 350 | #elif defined(HAVE_SETREGID) |
350 | if ((rc = setregid (gid, gid)) < 0) | 351 | if ((rc = setregid (gid, gid)) < 0) |
351 | logmsg (L_ERR, "setregid(%lu,%lu) failed: %s", | 352 | logmsg (L_ERR, _("setregid(%lu,%lu) failed: %s"), |
352 | (u_long) gid, (u_long) gid, strerror (errno)); | 353 | (u_long) gid, (u_long) gid, strerror (errno)); |
353 | #elif defined(HAVE_SETRESGID) | 354 | #elif defined(HAVE_SETRESGID) |
354 | if ((rc = setresgid (gid, gid, gid)) < 0) | 355 | if ((rc = setresgid (gid, gid, gid)) < 0) |
355 | logmsg (L_ERR, "setresgid(%lu,%lu,%lu) failed: %s", | 356 | logmsg (L_ERR, _("setresgid(%lu,%lu,%lu) failed: %s"), |
356 | (u_long) gid, (u_long) gid, (u_long) gid, strerror (errno)); | 357 | (u_long) gid, (u_long) gid, (u_long) gid, strerror (errno)); |
357 | #endif | 358 | #endif |
@@ -360,9 +361,9 @@ change_privs (uid_t uid, gid_t gid) | |||
360 | { | 361 | { |
361 | if ((rc = setgid (gid)) < 0 && getegid () != gid) | 362 | if ((rc = setgid (gid)) < 0 && getegid () != gid) |
362 | logmsg (L_ERR, "setgid(%lu) failed: %s", | 363 | logmsg (L_ERR, _("setgid(%lu) failed: %s"), |
363 | (u_long) gid, strerror (errno)); | 364 | (u_long) gid, strerror (errno)); |
364 | if (rc == 0 && getegid () != gid) | 365 | if (rc == 0 && getegid () != gid) |
365 | { | 366 | { |
366 | logmsg (L_ERR, "cannot set effective gid to %lu: %s", | 367 | logmsg (L_ERR, _("cannot set effective gid to %lu: %s"), |
367 | (u_long) gid, strerror (errno)); | 368 | (u_long) gid, strerror (errno)); |
368 | rc = 1; | 369 | rc = 1; |
@@ -386,5 +387,5 @@ change_privs (uid_t uid, gid_t gid) | |||
386 | { | 387 | { |
387 | logmsg (L_ERR, | 388 | logmsg (L_ERR, |
388 | "setreuid(%lu,-1) failed: %s", | 389 | _("setreuid(%lu,-1) failed: %s"), |
389 | (u_long) uid, strerror (errno)); | 390 | (u_long) uid, strerror (errno)); |
390 | rc = 1; | 391 | rc = 1; |
@@ -393,5 +394,5 @@ change_privs (uid_t uid, gid_t gid) | |||
393 | { | 394 | { |
394 | logmsg (L_ERR, | 395 | logmsg (L_ERR, |
395 | "second setuid(%lu) failed: %s", | 396 | _("second setuid(%lu) failed: %s"), |
396 | (u_long) uid, strerror (errno)); | 397 | (u_long) uid, strerror (errno)); |
397 | rc = 1; | 398 | rc = 1; |
@@ -401,5 +402,5 @@ change_privs (uid_t uid, gid_t gid) | |||
401 | #endif | 402 | #endif |
402 | { | 403 | { |
403 | logmsg (L_ERR, "setuid(%lu) failed: %s", | 404 | logmsg (L_ERR, _("setuid(%lu) failed: %s"), |
404 | (u_long) uid, strerror (errno)); | 405 | (u_long) uid, strerror (errno)); |
405 | rc = 1; | 406 | rc = 1; |
@@ -413,10 +414,10 @@ change_privs (uid_t uid, gid_t gid) | |||
413 | if (uid != 0 && setuid (0) == 0) | 414 | if (uid != 0 && setuid (0) == 0) |
414 | { | 415 | { |
415 | logmsg (L_ERR, "seteuid(0) succeeded when it should not"); | 416 | logmsg (L_ERR, _("seteuid(0) succeeded when it should not")); |
416 | rc = 1; | 417 | rc = 1; |
417 | } | 418 | } |
418 | else if (uid != euid && setuid (euid) == 0) | 419 | else if (uid != euid && setuid (euid) == 0) |
419 | { | 420 | { |
420 | logmsg (L_ERR, "cannot drop non-root setuid privileges"); | 421 | logmsg (L_ERR, _("cannot drop non-root setuid privileges")); |
421 | rc = 1; | 422 | rc = 1; |
422 | } | 423 | } |
@@ -435,5 +436,5 @@ change_user () | |||
435 | if (getuid () == 0) | 436 | if (getuid () == 0) |
436 | { | 437 | { |
437 | logmsg (L_NOTICE, "not a superuser: ignoring the `user' statement"); | 438 | logmsg (L_NOTICE, _("not a superuser: ignoring the `user' statement")); |
438 | return; | 439 | return; |
439 | } | 440 | } |
@@ -463,5 +464,6 @@ decode_buffer () | |||
463 | if (reply->n_addr > MAXADDR) | 464 | if (reply->n_addr > MAXADDR) |
464 | { | 465 | { |
465 | logmsg (L_NOTICE, "got invalid packet: n_addr = %d", reply->n_addr); | 466 | logmsg (L_NOTICE, _("got invalid packet: n_addr = %d"), |
467 | reply->n_addr); | ||
466 | return; | 468 | return; |
467 | } | 469 | } |
@@ -472,5 +474,5 @@ decode_buffer () | |||
472 | strftime (tbuf, sizeof tbuf, "%Y-%m-%d %H:%M:%S", | 474 | strftime (tbuf, sizeof tbuf, "%Y-%m-%d %H:%M:%S", |
473 | gmtime (&reply->timestamp)); | 475 | gmtime (&reply->timestamp)); |
474 | logmsg (L_INFO, "Received packet: %d %lu - %s", reply->n_addr, | 476 | logmsg (L_INFO, _("Received packet: %d %lu - %s"), reply->n_addr, |
475 | (unsigned long) reply->timestamp, tbuf); | 477 | (unsigned long) reply->timestamp, tbuf); |
476 | } | 478 | } |
@@ -484,5 +486,5 @@ decode_buffer () | |||
484 | return; | 486 | return; |
485 | else if (pid < 0) | 487 | else if (pid < 0) |
486 | logmsg (L_ERR, "can't fork: %s", strerror (errno)); | 488 | logmsg (L_ERR, _("cannot fork: %s"), strerror (errno)); |
487 | else | 489 | else |
488 | { | 490 | { |
@@ -498,5 +500,5 @@ decode_buffer () | |||
498 | sp->in = ntohl (sp->in); | 500 | sp->in = ntohl (sp->in); |
499 | sp->out = ntohl (sp->out); | 501 | sp->out = ntohl (sp->out); |
500 | verbose (1, "Monitor %s: %lu %lu", sp->name, sp->in, sp->out); | 502 | verbose (1, _("Monitor %s: %lu %lu"), sp->name, sp->in, sp->out); |
501 | report (sp, reply->timestamp); | 503 | report (sp, reply->timestamp); |
502 | } | 504 | } |
@@ -526,8 +528,9 @@ read_input (const char *name) | |||
526 | fp = fopen (name, "r"); | 528 | fp = fopen (name, "r"); |
527 | if (!fp) | 529 | if (!fp) |
528 | die (EX_OSERR, "cannot open file `%s': %s", name, strerror (errno)); | 530 | die (EX_OSERR, _("cannot open file `%s': %s"), |
531 | name, strerror (errno)); | ||
529 | } | 532 | } |
530 | 533 | ||
531 | verbose (2, "Reading `%s'", name); | 534 | verbose (2, _("Reading `%s'"), name); |
532 | 535 | ||
533 | open_db (TAGR_DB_WR); | 536 | open_db (TAGR_DB_WR); |
@@ -548,5 +551,5 @@ read_input (const char *name) | |||
548 | { | 551 | { |
549 | if (i > MAX_NAME_LENGTH) | 552 | if (i > MAX_NAME_LENGTH) |
550 | die (EX_DATAERR, "%s:%lu: ID too long", name, line); | 553 | die (EX_DATAERR, _("%s:%lu: ID too long"), name, line); |
551 | st.name[i++] = *p++; | 554 | st.name[i++] = *p++; |
552 | } | 555 | } |
@@ -554,10 +557,10 @@ read_input (const char *name) | |||
554 | 557 | ||
555 | if (sscanf (p, " %lu %lu %lu\n", &t, &st.in, &st.out) != 3) | 558 | if (sscanf (p, " %lu %lu %lu\n", &t, &st.in, &st.out) != 3) |
556 | die (EX_DATAERR, "%s:%lu: invalid input line", name, line); | 559 | die (EX_DATAERR, _("%s:%lu: invalid input line"), name, line); |
557 | report (&st, t); | 560 | report (&st, t); |
558 | } | 561 | } |
559 | fclose (fp); | 562 | fclose (fp); |
560 | close_db (); | 563 | close_db (); |
561 | verbose (2, "Finished reading `%s'", name); | 564 | verbose (2, _("Finished reading `%s'"), name); |
562 | } | 565 | } |
563 | 566 | ||
@@ -576,5 +579,5 @@ get_port (char *str) | |||
576 | else | 579 | else |
577 | { | 580 | { |
578 | logmsg (L_ERR, "no such service: %s", str); | 581 | logmsg (L_ERR, _("no such service: %s"), str); |
579 | return 0; | 582 | return 0; |
580 | } | 583 | } |
@@ -595,5 +598,5 @@ RETSIGTYPE | |||
595 | sig_quit (int sig) | 598 | sig_quit (int sig) |
596 | { | 599 | { |
597 | logmsg (L_INFO, "exiting on signal %d", sig); | 600 | logmsg (L_INFO, _("exiting on signal %d"), sig); |
598 | unlink (pidfile); | 601 | unlink (pidfile); |
599 | exit (0); | 602 | exit (0); |
@@ -603,5 +606,5 @@ RETSIGTYPE | |||
603 | sig_fatal (int sig) | 606 | sig_fatal (int sig) |
604 | { | 607 | { |
605 | logmsg (L_ERR, "FATAL: exiting on signal %d", sig); | 608 | logmsg (L_ERR, _("FATAL: exiting on signal %d"), sig); |
606 | unlink (pidfile); | 609 | unlink (pidfile); |
607 | exit (EX_UNAVAILABLE); | 610 | exit (EX_UNAVAILABLE); |
@@ -717,5 +720,5 @@ tagr_restart (char **argv) | |||
717 | do \ | 720 | do \ |
718 | if (cond) \ | 721 | if (cond) \ |
719 | die (EX_USAGE, "%s is meaningless with %s", opt, mode_opt);\ | 722 | die (EX_USAGE, _("%s is meaningless with %s"), opt, mode_opt);\ |
720 | while (0) | 723 | while (0) |
721 | 724 | ||
@@ -774,5 +777,5 @@ main (int argc, char **argv) | |||
774 | 777 | ||
775 | if (argc != 0 && !(list_option || import_option)) | 778 | if (argc != 0 && !(list_option || import_option)) |
776 | die (EX_USAGE, "Too many arguments"); | 779 | die (EX_USAGE, _("Too many arguments")); |
777 | 780 | ||
778 | if (readconfig ()) | 781 | if (readconfig ()) |
@@ -896,5 +899,5 @@ main (int argc, char **argv) | |||
896 | 899 | ||
897 | if (daemon (0, 0)) | 900 | if (daemon (0, 0)) |
898 | die (EX_OSERR, "cannot become daemon: %s", strerror (errno)); | 901 | die (EX_OSERR, _("cannot become daemon: %s"), strerror (errno)); |
899 | 902 | ||
900 | if ((fp = fopen (pidfile, "w")) != NULL) | 903 | if ((fp = fopen (pidfile, "w")) != NULL) |
@@ -905,5 +908,5 @@ main (int argc, char **argv) | |||
905 | else | 908 | else |
906 | { | 909 | { |
907 | logmsg (L_ERR, "can't write pid file %s: %s", | 910 | logmsg (L_ERR, _("cannot write pid file %s: %s"), |
908 | pidfile, strerror (errno)); | 911 | pidfile, strerror (errno)); |
909 | } | 912 | } |
diff --git a/src/readconfig.c b/src/readconfig.c index e60d335..e4e4e83 100644 --- a/src/readconfig.c +++ b/src/readconfig.c | |||
@@ -382,36 +382,40 @@ static struct grecs_keyword tagr_kw[] = { | |||
382 | { "rate-units", NULL, N_("Name of rate units"), | 382 | { "rate-units", NULL, N_("Name of rate units"), |
383 | grecs_type_string, &rate_unit }, | 383 | grecs_type_string, &rate_unit }, |
384 | { "number-suffixes", N_("suffixes"), NULL /* FIXME */, | 384 | { "number-suffixes", N_("suffixes"), |
385 | N_("Not implemented") /* FIXME */, | ||
385 | grecs_type_string, NULL, 0, cb_number_suffixes }, | 386 | grecs_type_string, NULL, 0, cb_number_suffixes }, |
386 | 387 | ||
387 | { "transparent", NULL, N_("Transparent graphs"), | 388 | { "transparent", NULL, N_("Transparent graphs"), |
388 | grecs_type_bool, &transparent_option }, | 389 | grecs_type_bool, &transparent_option }, |
389 | { "percent", NULL, NULL /* FIXME: descr */, | 390 | { "percent", NULL, |
391 | N_("Draw in/out percent graph (not implemented)"), /* FIXME */ | ||
390 | grecs_type_bool, &percent_option }, | 392 | grecs_type_bool, &percent_option }, |
391 | { "zero-unknown", NULL, NULL /* FIXME: descr */, | 393 | { "zero-unknown", NULL, |
394 | N_("Zero-out missing samples (not implemented)") /* FIXME */, | ||
392 | grecs_type_bool, &zero_unknown_option }, | 395 | grecs_type_bool, &zero_unknown_option }, |
393 | { "fill-incoming", NULL, NULL /* FIXME: descr */, | 396 | { "fill-incoming", NULL, N_("Fill incoming graph"), |
394 | grecs_type_bool, &fill_incoming_option }, | 397 | grecs_type_bool, &fill_incoming_option }, |
395 | 398 | ||
396 | { "color-background", NULL, N_("Set background color"), | 399 | { "color-background", NULL, N_("Set background color"), |
397 | grecs_type_int, color_background, 0, cb_color }, | 400 | grecs_type_int, color_background, 0, cb_color }, |
398 | { "color-light", NULL, NULL /* FIXME: descr */, | 401 | { "color-light", NULL, N_("`Light' color (for the border)"), |
399 | grecs_type_int, color_light, 0, cb_color }, | 402 | grecs_type_int, color_light, 0, cb_color }, |
400 | { "color-dark", NULL, NULL /* FIXME: descr */, | 403 | { "color-dark", NULL, N_("`Dark' color (for the border)"), |
401 | grecs_type_int, color_dark, 0, cb_color }, | 404 | grecs_type_int, color_dark, 0, cb_color }, |
402 | { "color-major", NULL, NULL /* FIXME: descr */, | 405 | { "color-major", NULL, |
406 | N_("`Major' color (boundaries, max. values, zero mark, etc.)"), | ||
403 | grecs_type_int, color_major, 0, cb_color }, | 407 | grecs_type_int, color_major, 0, cb_color }, |
404 | { "color-in", NULL, NULL /* FIXME: descr */, | 408 | { "color-in", NULL, N_("Color for the input graph"), |
405 | grecs_type_int, color_in, 0, cb_color }, | 409 | grecs_type_int, color_in, 0, cb_color }, |
406 | { "color-out", NULL, NULL /* FIXME: descr */, | 410 | { "color-out", NULL, N_("Color for the output graph"), |
407 | grecs_type_int, color_out, 0, cb_color }, | 411 | grecs_type_int, color_out, 0, cb_color }, |
408 | { "color-grid", NULL, NULL /* FIXME: descr */, | 412 | { "color-percent", NULL, N_("Color for the i/o percent graph"), |
413 | grecs_type_int, color_percent, 0, cb_color }, | ||
414 | { "color-grid", NULL, N_("Grid and axes color"), | ||
409 | grecs_type_int, color_grid, 0, cb_color }, | 415 | grecs_type_int, color_grid, 0, cb_color }, |
410 | { "color-in-max", NULL, NULL /* FIXME: descr */, | 416 | { "color-in-max", NULL, N_("Not implemented") /* FIXME */, |
411 | grecs_type_int, color_in_max, 0, cb_color }, | 417 | grecs_type_int, color_in_max, 0, cb_color }, |
412 | { "color-out-max", NULL, NULL /* FIXME: descr */, | 418 | { "color-out-max", NULL, N_("Not implemented") /* FIXME */, |
413 | grecs_type_int, color_out_max, 0, cb_color }, | 419 | grecs_type_int, color_out_max, 0, cb_color }, |
414 | { "color-percent", NULL, NULL /* FIXME: descr */, | ||
415 | grecs_type_int, color_percent, 0, cb_color }, | ||
416 | 420 | ||
417 | /* FIXME */ | 421 | /* FIXME */ |
diff --git a/src/report.c b/src/report.c index ed8a34d..ed3a81b 100644 --- a/src/report.c +++ b/src/report.c | |||
@@ -54,5 +54,5 @@ open_db (int flag) | |||
54 | if (dbf == NULL) | 54 | if (dbf == NULL) |
55 | { | 55 | { |
56 | logmsg (L_ERR, "Cannot open database %s: %s", | 56 | logmsg (L_ERR, _("cannot open database %s: %s"), |
57 | dbname, gdbm_strerror (gdbm_errno)); | 57 | dbname, gdbm_strerror (gdbm_errno)); |
58 | exit (1); | 58 | exit (1); |
@@ -92,8 +92,9 @@ _read_db (datum key, struct traffic_record **tr) | |||
92 | content = gdbm_fetch (dbf, key); | 92 | content = gdbm_fetch (dbf, key); |
93 | if (content.dptr == NULL) | 93 | if (content.dptr == NULL) |
94 | logmsg (L_NOTICE, "Record for %*.*s not found", key.dsize, key.dsize, key.dptr); | 94 | logmsg (L_NOTICE, _("record for %*.*s not found"), |
95 | key.dsize, key.dsize, key.dptr); | ||
95 | else if (content.dsize != sizeof **tr) | 96 | else if (content.dsize != sizeof **tr) |
96 | { | 97 | { |
97 | logmsg (L_ERR, "Wrong record size for %*.*s: %lu", | 98 | logmsg (L_ERR, _("wrong record size for %*.*s: %lu"), |
98 | key.dsize, key.dsize, key.dptr, content.dsize); | 99 | key.dsize, key.dsize, key.dptr, content.dsize); |
99 | } | 100 | } |
@@ -105,5 +106,5 @@ _read_db (datum key, struct traffic_record **tr) | |||
105 | } | 106 | } |
106 | 107 | ||
107 | logmsg (L_NOTICE, "Creating record for %*.*s", | 108 | logmsg (L_NOTICE, _("creating record for %*.*s"), |
108 | key.dsize, key.dsize, key.dptr); | 109 | key.dsize, key.dsize, key.dptr); |
109 | *tr = xmalloc (sizeof **tr); | 110 | *tr = xmalloc (sizeof **tr); |
@@ -137,5 +138,5 @@ write_db (struct monitor *mon, struct traffic_record *tr) | |||
137 | if (gdbm_store (dbf, key, content, GDBM_REPLACE)) | 138 | if (gdbm_store (dbf, key, content, GDBM_REPLACE)) |
138 | { | 139 | { |
139 | logmsg (L_ERR, "Failed to write data for %s: %s", | 140 | logmsg (L_ERR, _("failed to write data for %s: %s"), |
140 | mon->id, gdbm_strerror (gdbm_errno)); | 141 | mon->id, gdbm_strerror (gdbm_errno)); |
141 | } | 142 | } |
@@ -148,5 +149,7 @@ print_queue (const char *title, queue_t *q) | |||
148 | 149 | ||
149 | count = queue_count (q); | 150 | count = queue_count (q); |
150 | printf ("%s (%d entries):\n", title, count); | 151 | printf (ngettext ("%s (%d entry):\n", "%s (%d entries):\n", |
152 | count), | ||
153 | title, count); | ||
151 | for (i = count - 1; i >= 0; i--) | 154 | for (i = count - 1; i >= 0; i--) |
152 | { | 155 | { |
@@ -176,18 +179,19 @@ print_tr (datum key, struct traffic_record *tr) | |||
176 | printf ("ID: %*.*s\n", key.dsize, key.dsize, key.dptr); | 179 | printf ("ID: %*.*s\n", key.dsize, key.dsize, key.dptr); |
177 | strftime (buf, sizeof buf, "%c", tm); | 180 | strftime (buf, sizeof buf, "%c", tm); |
178 | printf ("Last sample: %lu (%s) %lu %lu\n", | 181 | printf (_("Last sample: %lu (%s) %lu %lu\n"), |
179 | tr->last.time, buf, tr->last.in, tr->last.out); | 182 | tr->last.time, buf, tr->last.in, tr->last.out); |
180 | 183 | ||
181 | printf ("Last rates: %g %g\n", tr->last_rates.inrate, tr->last_rates.outrate); | 184 | printf (_("Last rates: %g %g\n"), |
182 | print_queue ("Daily rates", &tr->day_hist); | 185 | tr->last_rates.inrate, tr->last_rates.outrate); |
186 | print_queue (_("Daily rates"), &tr->day_hist); | ||
183 | 187 | ||
184 | print_avg ("Weekly average", &tr->week_avg); | 188 | print_avg (_("Weekly average"), &tr->week_avg); |
185 | print_queue ("Weekly rates", &tr->week_hist); | 189 | print_queue (_("Weekly rates"), &tr->week_hist); |
186 | 190 | ||
187 | print_avg ("Monthly average", &tr->month_avg); | 191 | print_avg (_("Monthly average"), &tr->month_avg); |
188 | print_queue ("Monthly rates", &tr->month_hist); | 192 | print_queue (_("Monthly rates"), &tr->month_hist); |
189 | 193 | ||
190 | print_avg ("Yearly average", &tr->year_avg); | 194 | print_avg (_("Yearly average"), &tr->year_avg); |
191 | print_queue ("Yearly rates", &tr->year_hist); | 195 | print_queue (_("Yearly rates"), &tr->year_hist); |
192 | } | 196 | } |
193 | 197 | ||
@@ -233,5 +237,5 @@ report (Stat *stat, time_t timestamp) | |||
233 | } | 237 | } |
234 | else | 238 | else |
235 | logmsg (L_WARNING, "%s not found in config", stat->name); | 239 | logmsg (L_WARNING, _("%s not found in config"), stat->name); |
236 | } | 240 | } |
237 | 241 | ||
@@ -274,5 +278,5 @@ rebuild (int force) | |||
274 | time_t now = time (NULL); | 278 | time_t now = time (NULL); |
275 | 279 | ||
276 | verbose (1, "rebuild initiated"); | 280 | verbose (1, _("rebuild initiated")); |
277 | open_db (TAGR_DB_WR); | 281 | open_db (TAGR_DB_WR); |
278 | key = gdbm_firstkey (dbf); | 282 | key = gdbm_firstkey (dbf); |
@@ -285,4 +289,4 @@ rebuild (int force) | |||
285 | } | 289 | } |
286 | close_db (); | 290 | close_db (); |
287 | verbose (1, "rebuild finished"); | 291 | verbose (1, _("rebuild finished")); |
288 | } | 292 | } |
@@ -46,5 +46,5 @@ interpolate (queue_t *q, | |||
46 | th.inrate = inrate; | 46 | th.inrate = inrate; |
47 | th.outrate = outrate; | 47 | th.outrate = outrate; |
48 | verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate); | 48 | verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate); |
49 | queue_put (q, &th); | 49 | queue_put (q, &th); |
50 | if (ovf) | 50 | if (ovf) |
@@ -59,5 +59,5 @@ interpolate (queue_t *q, | |||
59 | th.outrate = (outrate - last_rates->outrate) * (next - last_time) | 59 | th.outrate = (outrate - last_rates->outrate) * (next - last_time) |
60 | / interval + last_rates->outrate; | 60 | / interval + last_rates->outrate; |
61 | verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate); | 61 | verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate); |
62 | queue_put (q, &th); | 62 | queue_put (q, &th); |
63 | if (ovf) | 63 | if (ovf) |
@@ -93,5 +93,5 @@ overflow (struct traffic_history *th, | |||
93 | tmp.inrate = avg->inrate; | 93 | tmp.inrate = avg->inrate; |
94 | tmp.outrate = avg->outrate; | 94 | tmp.outrate = avg->outrate; |
95 | verbose (3, "Insert %lu %g %g", now, tmp.inrate, tmp.outrate); | 95 | verbose (3, _("insert %lu %g %g"), now, tmp.inrate, tmp.outrate); |
96 | queue_put (q, &tmp); | 96 | queue_put (q, &tmp); |
97 | } | 97 | } |
@@ -109,8 +109,9 @@ int | |||
109 | ovf_monthly (struct traffic_history *th, struct traffic_record *tr, time_t now) | 109 | ovf_monthly (struct traffic_history *th, struct traffic_record *tr, time_t now) |
110 | { | 110 | { |
111 | verbose (2, "begin overflow_monthly %lu %g %g", now, th->inrate, th->outrate); | 111 | verbose (2, _("begin overflow_monthly %lu %g %g"), |
112 | now, th->inrate, th->outrate); | ||
112 | overflow (th, tr, now, NULL, &tr->year_avg, &tr->year_hist, | 113 | overflow (th, tr, now, NULL, &tr->year_avg, &tr->year_hist, |
113 | YEAR_COUNT, YEAR_SAMPLE); | 114 | YEAR_COUNT, YEAR_SAMPLE); |
114 | verbose (2, "end overflow_monthly"); | 115 | verbose (2, _("end overflow_monthly")); |
115 | } | 116 | } |
116 | 117 | ||
@@ -118,8 +119,9 @@ int | |||
118 | ovf_weekly (struct traffic_history *th, struct traffic_record *tr, time_t now) | 119 | ovf_weekly (struct traffic_history *th, struct traffic_record *tr, time_t now) |
119 | { | 120 | { |
120 | verbose (2, "begin overflow_weekly %lu %g %g", now, th->inrate, th->outrate); | 121 | verbose (2, _("begin overflow_weekly %lu %g %g"), |
122 | now, th->inrate, th->outrate); | ||
121 | overflow (th, tr, now, ovf_monthly, &tr->month_avg, &tr->month_hist, | 123 | overflow (th, tr, now, ovf_monthly, &tr->month_avg, &tr->month_hist, |
122 | MONTH_COUNT, MONTH_SAMPLE); | 124 | MONTH_COUNT, MONTH_SAMPLE); |
123 | verbose (2, "end overflow_daily"); | 125 | verbose (2, _("end overflow_daily")); |
124 | } | 126 | } |
125 | 127 | ||
@@ -127,8 +129,9 @@ int | |||
127 | ovf_daily (struct traffic_history *th, struct traffic_record *tr, time_t now) | 129 | ovf_daily (struct traffic_history *th, struct traffic_record *tr, time_t now) |
128 | { | 130 | { |
129 | verbose (2, "begin overflow_daily %lu %g %g", now, th->inrate, th->outrate); | 131 | verbose (2, _("begin overflow_daily %lu %g %g"), |
132 | now, th->inrate, th->outrate); | ||
130 | overflow (th, tr, now, ovf_weekly, &tr->week_avg, &tr->week_hist, | 133 | overflow (th, tr, now, ovf_weekly, &tr->week_avg, &tr->week_hist, |
131 | WEEK_COUNT, WEEK_SAMPLE); | 134 | WEEK_COUNT, WEEK_SAMPLE); |
132 | verbose (2, "end overflow_daily"); | 135 | verbose (2, _("end overflow_daily")); |
133 | } | 136 | } |
134 | 137 | ||
@@ -145,5 +148,5 @@ update_stats (struct monitor *mon, struct traffic_sample *sample, | |||
145 | if (interval == 0) | 148 | if (interval == 0) |
146 | { | 149 | { |
147 | logmsg (L_ERR, "Ignoring zero interval"); | 150 | logmsg (L_ERR, _("ignoring zero interval")); |
148 | return; | 151 | return; |
149 | } | 152 | } |
@@ -218,5 +221,5 @@ _convert (queue_t *q, ovf_t ovf, | |||
218 | if (interval == 0) | 221 | if (interval == 0) |
219 | { | 222 | { |
220 | logmsg (L_ERR, "Ignoring zero interval"); | 223 | logmsg (L_ERR, _("ignoring zero interval")); |
221 | break; | 224 | break; |
222 | } | 225 | } |
@@ -253,9 +256,9 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp, | |||
253 | size_t count) | 256 | size_t count) |
254 | { | 257 | { |
255 | verbose (2, "begin convert_yearly"); | 258 | verbose (2, _("begin convert_yearly")); |
256 | _convert (&tr->year_hist, NULL, tr, | 259 | _convert (&tr->year_hist, NULL, tr, |
257 | hp, count, YEAR_SAMPLE); | 260 | hp, count, YEAR_SAMPLE); |
258 | compute_avg (&tr->year_avg, &tr->year_hist, &tr->last); | 261 | compute_avg (&tr->year_avg, &tr->year_hist, &tr->last); |
259 | verbose (2, "end convert_yearly"); | 262 | verbose (2, _("end convert_yearly")); |
260 | } | 263 | } |
261 | 264 | ||
@@ -264,5 +267,5 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp, | |||
264 | size_t count) | 267 | size_t count) |
265 | { | 268 | { |
266 | verbose (2, "begin convert_monthly"); | 269 | verbose (2, _("begin convert_monthly")); |
267 | if (count > MONTH_COUNT+1) | 270 | if (count > MONTH_COUNT+1) |
268 | convert_yearly (tr, hp + MONTH_COUNT + 1, count - (MONTH_COUNT + 1)); | 271 | convert_yearly (tr, hp + MONTH_COUNT + 1, count - (MONTH_COUNT + 1)); |
@@ -270,5 +273,5 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp, | |||
270 | hp, MONTH_COUNT + 1, MONTH_SAMPLE); | 273 | hp, MONTH_COUNT + 1, MONTH_SAMPLE); |
271 | compute_avg (&tr->month_avg, &tr->month_hist, &tr->last); | 274 | compute_avg (&tr->month_avg, &tr->month_hist, &tr->last); |
272 | verbose (2, "end convert_monthly"); | 275 | verbose (2, _("end convert_monthly")); |
273 | } | 276 | } |
274 | 277 | ||
@@ -276,5 +279,5 @@ static void | |||
276 | convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t count) | 279 | convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t count) |
277 | { | 280 | { |
278 | verbose (2, "begin convert_weekly"); | 281 | verbose (2, _("begin convert_weekly")); |
279 | if (count > WEEK_COUNT+1) | 282 | if (count > WEEK_COUNT+1) |
280 | convert_monthly (tr, hp + WEEK_COUNT + 1, count - (WEEK_COUNT + 1)); | 283 | convert_monthly (tr, hp + WEEK_COUNT + 1, count - (WEEK_COUNT + 1)); |
@@ -282,5 +285,5 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou | |||
282 | tr, hp, WEEK_COUNT + 1, WEEK_SAMPLE); | 285 | tr, hp, WEEK_COUNT + 1, WEEK_SAMPLE); |
283 | compute_avg (&tr->week_avg, &tr->week_hist, &tr->last); | 286 | compute_avg (&tr->week_avg, &tr->week_hist, &tr->last); |
284 | verbose (2, "end convert_weekly"); | 287 | verbose (2, _("end convert_weekly")); |
285 | } | 288 | } |
286 | 289 | ||
@@ -288,9 +291,9 @@ static void | |||
288 | convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t count) | 291 | convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t count) |
289 | { | 292 | { |
290 | verbose (2, "begin convert_daily"); | 293 | verbose (2, _("begin convert_daily")); |
291 | if (count > DAY_COUNT+1) | 294 | if (count > DAY_COUNT+1) |
292 | convert_weekly (tr, hp + DAY_COUNT + 1, count - (DAY_COUNT + 1)); | 295 | convert_weekly (tr, hp + DAY_COUNT + 1, count - (DAY_COUNT + 1)); |
293 | _convert (&tr->day_hist, ovf_daily, tr, hp, DAY_COUNT + 1, DAY_SAMPLE); | 296 | _convert (&tr->day_hist, ovf_daily, tr, hp, DAY_COUNT + 1, DAY_SAMPLE); |
294 | verbose (2, "end convert_daily"); | 297 | verbose (2, _("end convert_daily")); |
295 | } | 298 | } |
296 | 299 | ||
@@ -330,13 +333,13 @@ import_log (const char *name) | |||
330 | if (!fp) | 333 | if (!fp) |
331 | { | 334 | { |
332 | logmsg (L_ERR, "cannot open `%s': %s", name, strerror (errno)); | 335 | logmsg (L_ERR, _("cannot open `%s': %s"), name, strerror (errno)); |
333 | return 1; | 336 | return 1; |
334 | } | 337 | } |
335 | verbose (2, "Importing %s", name); | 338 | verbose (2, _("importing %s"), name); |
336 | 339 | ||
337 | 340 | ||
338 | if (fscanf (fp, "%ld %lu %lu\n", &last.time, &last.in, &last.out) != 3) | 341 | if (fscanf (fp, "%ld %lu %lu\n", &last.time, &last.in, &last.out) != 3) |
339 | { | 342 | { |
340 | logmsg (L_ERR, "%s:1: Unexpected number of fields", name); | 343 | logmsg (L_ERR, _("%s:1: unexpected number of fields"), name); |
341 | fclose (fp); | 344 | fclose (fp); |
342 | return 1; | 345 | return 1; |
@@ -365,5 +368,5 @@ import_log (const char *name) | |||
365 | if (hist.time > cur) | 368 | if (hist.time > cur) |
366 | { | 369 | { |
367 | logmsg (L_WARNING, "%s:%lu: is corrupted", name, line); | 370 | logmsg (L_WARNING, _("%s:%lu: is corrupted"), name, line); |
368 | break; | 371 | break; |
369 | } | 372 | } |
@@ -400,5 +403,5 @@ import_log (const char *name) | |||
400 | if (!mon) | 403 | if (!mon) |
401 | { | 404 | { |
402 | logmsg (L_ERR, "cannot find monitor `%s'", base); | 405 | logmsg (L_ERR, _("cannot find monitor `%s'"), base); |
403 | rc = 1; | 406 | rc = 1; |
404 | } | 407 | } |
@@ -417,8 +420,9 @@ import (const char *dirname) | |||
417 | struct stat st; | 420 | struct stat st; |
418 | 421 | ||
419 | verbose (2, "Examining `%s'", dirname); | 422 | verbose (2, _("examining `%s'"), dirname); |
420 | 423 | ||
421 | if (stat (dirname, &st)) | 424 | if (stat (dirname, &st)) |
422 | die (EX_OSERR, "cannot stat file `%s': %s", dirname, strerror (errno)); | 425 | die (EX_OSERR, _("cannot stat file `%s': %s"), |
426 | dirname, strerror (errno)); | ||
423 | else if (S_ISREG (st.st_mode)) | 427 | else if (S_ISREG (st.st_mode)) |
424 | { | 428 | { |
@@ -451,8 +455,9 @@ import (const char *dirname) | |||
451 | 455 | ||
452 | case GLOB_NOSPACE: | 456 | case GLOB_NOSPACE: |
453 | die (EX_UNAVAILABLE, "cannot scan directory: %s", strerror (ENOMEM)); | 457 | die (EX_UNAVAILABLE, _("cannot scan directory: %s"), |
458 | strerror (ENOMEM)); | ||
454 | 459 | ||
455 | case GLOB_ABORTED: | 460 | case GLOB_ABORTED: |
456 | die (EX_UNAVAILABLE, "scanning aborted"); | 461 | die (EX_UNAVAILABLE, _("scanning aborted")); |
457 | 462 | ||
458 | case GLOB_NOMATCH: | 463 | case GLOB_NOMATCH: |
@@ -460,9 +465,9 @@ import (const char *dirname) | |||
460 | 465 | ||
461 | default: | 466 | default: |
462 | die (EX_UNAVAILABLE, "cannot scan directory `%s'", dirname); | 467 | die (EX_UNAVAILABLE, _("cannot scan directory `%s'"), dirname); |
463 | } | 468 | } |
464 | } | 469 | } |
465 | 470 | ||
466 | verbose (1, "Number of imported log files: %d", count); | 471 | verbose (1, _("number of imported log files: %d"), count); |
467 | } | 472 | } |
468 | 473 | ||
@@ -21,5 +21,4 @@ | |||
21 | #include <grecs.h> | 21 | #include <grecs.h> |
22 | 22 | ||
23 | #define LOGFACILITY LOG_LOCAL5 | ||
24 | #define TAGR_CONFIGFILE SYSCONFDIR "/tagr.conf" | 23 | #define TAGR_CONFIGFILE SYSCONFDIR "/tagr.conf" |
25 | #define TAGR_TEMPLATE SYSCONFDIR "/tagr.tmpl" | 24 | #define TAGR_TEMPLATE SYSCONFDIR "/tagr.tmpl" |
@@ -28,6 +27,8 @@ | |||
28 | #define TAGR_DBMODE 0600 | 27 | #define TAGR_DBMODE 0600 |
29 | 28 | ||
30 | #define _(s) s | 29 | #define _(s) gettext (s) |
31 | #define N_(s) s | 30 | #define N_(s) s |
31 | #define gettext(s) s | ||
32 | #define ngettext(s,p,c) ((c) == 1 ? (s) : (p)) | ||
32 | 33 | ||
33 | struct monitor | 34 | struct monitor |