summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--configure.ac18
-rw-r--r--src/graph.c1
-rw-r--r--src/html.gram.y34
-rw-r--r--src/html.lex.l10
-rw-r--r--src/log.c16
-rw-r--r--src/main.c77
-rw-r--r--src/readconfig.c32
-rw-r--r--src/report.c40
-rw-r--r--src/stat.c65
-rw-r--r--src/tagr.h5
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
@@ -77,2 +77,20 @@ AC_CHECK_LIB([gdbm], [gdbm_open],
77 77
78## Default syslog facility
79LOG_FACILITY="LOG_DAEMON"
80
81AC_ARG_VAR([LOG_FACILITY],
82 [Default syslog facility])
83if 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
93AC_DEFINE_UNQUOTED([LOG_FACILITY],$LOG_FACILITY,
94 [Default syslog facility.])
95
78AC_CONFIG_FILES([Makefile 96AC_CONFIG_FILES([Makefile
diff --git a/src/graph.c b/src/graph.c
index bfd00cb..1464e8b 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -56,2 +56,3 @@ int graph_v_margin[2] = { 14, 35 };
56 56
57/* FIXME: I18N?? */
57char *rate_unit = "Bytes per Second"; 58char *rate_unit = "Bytes per Second";
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
@@ -115,3 +115,3 @@ expr : value
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);
@@ -147,3 +147,3 @@ expr : value
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);
@@ -152,3 +152,3 @@ expr : 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);
@@ -169,3 +169,3 @@ expr : value
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);
@@ -174,3 +174,3 @@ expr : 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);
@@ -191,3 +191,3 @@ expr : value
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);
@@ -196,3 +196,3 @@ expr : 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);
@@ -201,3 +201,3 @@ expr : value
201 { 201 {
202 yyerror ("division by zero"); 202 yyerror (_("division by zero"));
203 init_value (&$$, unspecified_value, NULL); 203 init_value (&$$, unspecified_value, NULL);
@@ -217,3 +217,3 @@ expr : 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);
@@ -232,3 +232,3 @@ expr : 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);
@@ -275,3 +275,3 @@ create_html (pp_tab_t *tab, char *file, char *dest)
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));
@@ -288,3 +288,3 @@ create_html (pp_tab_t *tab, char *file, char *dest)
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));
@@ -295,3 +295,3 @@ create_html (pp_tab_t *tab, char *file, char *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,
@@ -496,3 +496,3 @@ read_symtab (pp_tab_t **tab, const char *name)
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);
@@ -505,3 +505,3 @@ read_symtab (pp_tab_t **tab, const char *name)
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);
@@ -525,3 +525,3 @@ read_symtab (pp_tab_t **tab, const char *name)
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);
@@ -535,3 +535,3 @@ read_symtab (pp_tab_t **tab, const char *name)
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);
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
@@ -45,3 +45,3 @@ N [0-9]+
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);
@@ -54,3 +54,3 @@ N [0-9]+
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);
@@ -64,3 +64,3 @@ N [0-9]+
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);
@@ -79,3 +79,3 @@ N [0-9]+
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);
@@ -132,3 +132,3 @@ html_open (char *file)
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));
diff --git a/src/log.c b/src/log.c
index de847c9..e5ae4e1 100644
--- a/src/log.c
+++ b/src/log.c
@@ -31,3 +31,3 @@
31 31
32int log_facility = LOGFACILITY; 32int log_facility = LOG_FACILITY;
33char *log_tag; 33char *log_tag;
@@ -53,8 +53,8 @@ int syslog_level[] = {
53char *level_str[] = { 53char *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};
@@ -67,3 +67,3 @@ vlogmsg (int level, const char *fmt, va_list ap)
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);
diff --git a/src/main.c b/src/main.c
index 2a20ba9..9b98ec5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,4 +82,4 @@ static char *html_template_option = NULL;
82const char *program_version = "tagr (" PACKAGE_STRING ")"; 82const char *program_version = "tagr (" PACKAGE_STRING ")";
83static char doc[] = "tagr -- traffic analyzer and grapher"; 83static char doc[] = N_("tagr -- traffic analyzer and grapher");
84static char args_doc[] = ""; 84static char args_doc[] = "[FILES or DIRS...]";
85 85
@@ -114,3 +114,3 @@ static struct argp_option options[] = {
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,
@@ -189,8 +189,8 @@ 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}
@@ -337,3 +337,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -347,6 +347,7 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -354,3 +355,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -361,3 +362,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -365,3 +366,3 @@ change_privs (uid_t uid, gid_t 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));
@@ -387,3 +388,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -394,3 +395,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -402,3 +403,3 @@ change_privs (uid_t uid, gid_t gid)
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));
@@ -414,3 +415,3 @@ change_privs (uid_t uid, gid_t gid)
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;
@@ -419,3 +420,3 @@ change_privs (uid_t uid, gid_t gid)
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;
@@ -436,3 +437,3 @@ change_user ()
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;
@@ -464,3 +465,4 @@ decode_buffer ()
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;
@@ -473,3 +475,3 @@ decode_buffer ()
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);
@@ -485,3 +487,3 @@ decode_buffer ()
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
@@ -499,3 +501,3 @@ decode_buffer ()
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);
@@ -527,6 +529,7 @@ read_input (const char *name)
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
@@ -549,3 +552,3 @@ read_input (const char *name)
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++;
@@ -555,3 +558,3 @@ read_input (const char *name)
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);
@@ -560,3 +563,3 @@ read_input (const char *name)
560 close_db (); 563 close_db ();
561 verbose (2, "Finished reading `%s'", name); 564 verbose (2, _("Finished reading `%s'"), name);
562} 565}
@@ -577,3 +580,3 @@ get_port (char *str)
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;
@@ -596,3 +599,3 @@ 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);
@@ -604,3 +607,3 @@ 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);
@@ -718,3 +721,3 @@ tagr_restart (char **argv)
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)
@@ -775,3 +778,3 @@ main (int argc, char **argv)
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
@@ -897,3 +900,3 @@ main (int argc, char **argv)
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
@@ -906,3 +909,3 @@ main (int argc, char **argv)
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));
diff --git a/src/readconfig.c b/src/readconfig.c
index e60d335..e4e4e83 100644
--- a/src/readconfig.c
+++ b/src/readconfig.c
@@ -383,3 +383,4 @@ static struct grecs_keyword tagr_kw[] = {
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 },
@@ -388,7 +389,9 @@ static struct grecs_keyword tagr_kw[] = {
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 },
@@ -397,20 +400,21 @@ static struct grecs_keyword tagr_kw[] = {
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
diff --git a/src/report.c b/src/report.c
index ed8a34d..ed3a81b 100644
--- a/src/report.c
+++ b/src/report.c
@@ -55,3 +55,3 @@ open_db (int flag)
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));
@@ -93,6 +93,7 @@ _read_db (datum key, struct traffic_record **tr)
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);
@@ -106,3 +107,3 @@ _read_db (datum key, struct traffic_record **tr)
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);
@@ -138,3 +139,3 @@ write_db (struct monitor *mon, struct traffic_record *tr)
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));
@@ -149,3 +150,5 @@ print_queue (const char *title, queue_t *q)
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--)
@@ -177,16 +180,17 @@ print_tr (datum key, struct traffic_record *tr)
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}
@@ -234,3 +238,3 @@ report (Stat *stat, time_t timestamp)
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}
@@ -275,3 +279,3 @@ rebuild (int force)
275 279
276 verbose (1, "rebuild initiated"); 280 verbose (1, _("rebuild initiated"));
277 open_db (TAGR_DB_WR); 281 open_db (TAGR_DB_WR);
@@ -286,3 +290,3 @@ rebuild (int force)
286 close_db (); 290 close_db ();
287 verbose (1, "rebuild finished"); 291 verbose (1, _("rebuild finished"));
288} 292}
diff --git a/src/stat.c b/src/stat.c
index ed4ab8e..85b76d9 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -47,3 +47,3 @@ interpolate (queue_t *q,
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);
@@ -60,3 +60,3 @@ interpolate (queue_t *q,
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);
@@ -94,3 +94,3 @@ overflow (struct traffic_history *th,
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);
@@ -110,6 +110,7 @@ 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}
@@ -119,6 +120,7 @@ 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}
@@ -128,6 +130,7 @@ 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}
@@ -146,3 +149,3 @@ update_stats (struct monitor *mon, struct traffic_sample *sample,
146 { 149 {
147 logmsg (L_ERR, "Ignoring zero interval"); 150 logmsg (L_ERR, _("ignoring zero interval"));
148 return; 151 return;
@@ -219,3 +222,3 @@ _convert (queue_t *q, ovf_t ovf,
219 { 222 {
220 logmsg (L_ERR, "Ignoring zero interval"); 223 logmsg (L_ERR, _("ignoring zero interval"));
221 break; 224 break;
@@ -254,3 +257,3 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp,
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,
@@ -258,3 +261,3 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp,
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}
@@ -265,3 +268,3 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
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)
@@ -271,3 +274,3 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
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}
@@ -277,3 +280,3 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou
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)
@@ -283,3 +286,3 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou
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}
@@ -289,3 +292,3 @@ convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t coun
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)
@@ -293,3 +296,3 @@ convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t coun
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}
@@ -331,6 +334,6 @@ import_log (const char *name)
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
@@ -339,3 +342,3 @@ import_log (const char *name)
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);
@@ -366,3 +369,3 @@ import_log (const char *name)
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;
@@ -401,3 +404,3 @@ import_log (const char *name)
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;
@@ -418,6 +421,7 @@ import (const char *dirname)
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))
@@ -452,6 +456,7 @@ import (const char *dirname)
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
@@ -461,3 +466,3 @@ import (const char *dirname)
461 default: 466 default:
462 die (EX_UNAVAILABLE, "cannot scan directory `%s'", dirname); 467 die (EX_UNAVAILABLE, _("cannot scan directory `%s'"), dirname);
463 } 468 }
@@ -465,3 +470,3 @@ import (const char *dirname)
465 470
466 verbose (1, "Number of imported log files: %d", count); 471 verbose (1, _("number of imported log files: %d"), count);
467} 472}
diff --git a/src/tagr.h b/src/tagr.h
index 96035f2..fafd56b 100644
--- a/src/tagr.h
+++ b/src/tagr.h
@@ -22,3 +22,2 @@
22 22
23#define LOGFACILITY LOG_LOCAL5
24#define TAGR_CONFIGFILE SYSCONFDIR "/tagr.conf" 23#define TAGR_CONFIGFILE SYSCONFDIR "/tagr.conf"
@@ -29,4 +28,6 @@
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

Return to:

Send suggestions and report system problems to the System administrator.