aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
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
@@ -56,2 +56,3 @@ int graph_v_margin[2] = { 14, 35 };
+/* FIXME: I18N?? */
char *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
{
- yyerror ("type mismatch in addition");
+ yyerror (_("type mismatch in addition"));
init_value (&$$, unspecified_value, NULL);
@@ -147,3 +147,3 @@ expr : value
{
- yyerror ("type mismatch in subtraction");
+ yyerror (_("type mismatch in subtraction"));
init_value (&$$, unspecified_value, NULL);
@@ -152,3 +152,3 @@ expr : value
{
- yyerror ("subtraction not defined for strings");
+ yyerror (_("subtraction not defined for strings"));
init_value (&$$, unspecified_value, NULL);
@@ -169,3 +169,3 @@ expr : value
{
- yyerror ("type mismatch in multiplication");
+ yyerror (_("type mismatch in multiplication"));
init_value (&$$, unspecified_value, NULL);
@@ -174,3 +174,3 @@ expr : value
{
- yyerror ("multiplication not defined for strings");
+ yyerror (_("multiplication not defined for strings"));
init_value (&$$, unspecified_value, NULL);
@@ -191,3 +191,3 @@ expr : value
{
- yyerror ("type mismatch in division");
+ yyerror (_("type mismatch in division"));
init_value (&$$, unspecified_value, NULL);
@@ -196,3 +196,3 @@ expr : value
{
- yyerror ("division not defined for strings");
+ yyerror (_("division not defined for strings"));
init_value (&$$, unspecified_value, NULL);
@@ -201,3 +201,3 @@ expr : value
{
- yyerror ("division by zero");
+ yyerror (_("division by zero"));
init_value (&$$, unspecified_value, NULL);
@@ -217,3 +217,3 @@ expr : value
{
- yyerror ("unary minus not defined for strings");
+ yyerror (_("unary minus not defined for strings"));
init_value (&$$, unspecified_value, NULL);
@@ -232,3 +232,3 @@ expr : value
{
- yyerror ("unary plus not defined for strings");
+ yyerror (_("unary plus not defined for strings"));
init_value (&$$, unspecified_value, NULL);
@@ -275,3 +275,3 @@ create_html (pp_tab_t *tab, char *file, char *dest)
{
- logmsg (L_ERR, "cannot open output file `%s': %s",
+ logmsg (L_ERR, _("cannot open output file `%s': %s"),
file, strerror (errno));
@@ -288,3 +288,3 @@ create_html (pp_tab_t *tab, char *file, char *dest)
{
- logmsg (L_ERR, "cannot unlink file `%s': %s",
+ logmsg (L_ERR, _("cannot unlink file `%s': %s"),
dest, strerror (errno));
@@ -295,3 +295,3 @@ create_html (pp_tab_t *tab, char *file, char *dest)
{
- logmsg (L_ERR, "cannot rename `%s' to `%s': %s",
+ logmsg (L_ERR, _("cannot rename `%s' to `%s': %s"),
tmp_file_name, dest,
@@ -496,3 +496,3 @@ read_symtab (pp_tab_t **tab, const char *name)
{
- logmsg (L_ERR, "%s:%u: invalid input: %s",
+ logmsg (L_ERR, _("%s:%u: invalid input: %s"),
name, line, buf);
@@ -505,3 +505,3 @@ read_symtab (pp_tab_t **tab, const char *name)
{
- logmsg (L_ERR, "%s:%u: invalid input: %s",
+ logmsg (L_ERR, _("%s:%u: invalid input: %s"),
name, line, buf);
@@ -525,3 +525,3 @@ read_symtab (pp_tab_t **tab, const char *name)
{
- logmsg (L_ERR, "%s:%u: invalid numeric value: %s",
+ logmsg (L_ERR, _("%s:%u: invalid numeric value: %s"),
name, line, value);
@@ -535,3 +535,3 @@ read_symtab (pp_tab_t **tab, const char *name)
default:
- logmsg (L_NOTICE, "%s:%u: ignoring unknown command %#03o",
+ logmsg (L_NOTICE, _("%s:%u: ignoring unknown command %#03o"),
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]+
{
- yyerror ("unknown identifier");
+ yyerror (_("unknown identifier"));
init_value (&yylval.value, unspecified_value, NULL);
@@ -54,3 +54,3 @@ N [0-9]+
{
- yyerror ("unknown identifier");
+ yyerror (_("unknown identifier"));
init_value (&yylval.value, unspecified_value, NULL);
@@ -64,3 +64,3 @@ N [0-9]+
{
- yyerror ("unknown identifier");
+ yyerror (_("unknown identifier"));
init_value (&yylval.value, unspecified_value, NULL);
@@ -79,3 +79,3 @@ N [0-9]+
{
- yyerror ("unknown identifier");
+ yyerror (_("unknown identifier"));
init_value (&yylval.value, unspecified_value, NULL);
@@ -132,3 +132,3 @@ html_open (char *file)
{
- logmsg (L_ERR, "cannot open input file `%s': %s",
+ logmsg (L_ERR, _("cannot open input file `%s': %s"),
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 @@
-int log_facility = LOGFACILITY;
+int log_facility = LOG_FACILITY;
char *log_tag;
@@ -53,8 +53,8 @@ int syslog_level[] = {
char *level_str[] = {
- "debug",
- "info",
- "notice",
- "warning",
- "error",
- "CRITICAL",
+ N_("debug"),
+ N_("info"),
+ N_("notice"),
+ N_("warning"),
+ N_("error"),
+ N_("CRITICAL"),
};
@@ -67,3 +67,3 @@ vlogmsg (int level, const char *fmt, va_list ap)
{
- fprintf (stderr, "%s: %s: ", log_tag, level_str[level]);
+ fprintf (stderr, "%s: %s: ", log_tag, gettext (level_str[level]));
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;
const char *program_version = "tagr (" PACKAGE_STRING ")";
-static char doc[] = "tagr -- traffic analyzer and grapher";
-static char args_doc[] = "";
+static char doc[] = N_("tagr -- traffic analyzer and grapher");
+static char args_doc[] = "[FILES or DIRS...]";
@@ -114,3 +114,3 @@ static struct argp_option options[] = {
{"read", OPT_READ, NULL, 0,
- N_("read statistics from the given file or standard input") },
+ N_("read statistics from given FILEs or standard input") },
{"rebuild", 'b', NULL, 0,
@@ -189,8 +189,8 @@ show_defaults ()
{
- printf ("Configuration file: %s\n", TAGR_CONFIGFILE);
- printf ("Page template file: %s\n", TAGR_TEMPLATE);
- printf ("PID file: %s\n", TAGR_PIDFILE);
- printf ("DB file name: %s\n", TAGR_DBNAME);
- printf ("DB file permissions: %#o\n", TAGR_DBMODE);
- printf ("Syslog facility number: %d\n", LOGFACILITY);
+ printf (_("Configuration file: %s\n"), TAGR_CONFIGFILE);
+ printf (_("Page template file: %s\n"), TAGR_TEMPLATE);
+ printf (_("PID file: %s\n"), TAGR_PIDFILE);
+ printf (_("DB file name: %s\n"), TAGR_DBNAME);
+ printf (_("DB file permissions: %#o\n"), TAGR_DBMODE);
+ printf (_("Syslog facility number: %d\n"), LOG_FACILITY);
}
@@ -337,3 +337,3 @@ change_privs (uid_t uid, gid_t gid)
{
- logmsg (L_ERR, "setgroups(1, %lu) failed: %s",
+ logmsg (L_ERR, _("setgroups(1, %lu) failed: %s"),
(u_long) emptygidset[0], strerror (errno));
@@ -347,6 +347,7 @@ change_privs (uid_t uid, gid_t gid)
if ((rc = setegid (gid)) < 0)
- logmsg (L_ERR, "setegid(%lu) failed: %s", (u_long) gid, strerror (errno));
+ logmsg (L_ERR, _("setegid(%lu) failed: %s"),
+ (u_long) gid, strerror (errno));
#elif defined(HAVE_SETREGID)
if ((rc = setregid (gid, gid)) < 0)
- logmsg (L_ERR, "setregid(%lu,%lu) failed: %s",
+ logmsg (L_ERR, _("setregid(%lu,%lu) failed: %s"),
(u_long) gid, (u_long) gid, strerror (errno));
@@ -354,3 +355,3 @@ change_privs (uid_t uid, gid_t gid)
if ((rc = setresgid (gid, gid, gid)) < 0)
- logmsg (L_ERR, "setresgid(%lu,%lu,%lu) failed: %s",
+ logmsg (L_ERR, _("setresgid(%lu,%lu,%lu) failed: %s"),
(u_long) gid, (u_long) gid, (u_long) gid, strerror (errno));
@@ -361,3 +362,3 @@ change_privs (uid_t uid, gid_t gid)
if ((rc = setgid (gid)) < 0 && getegid () != gid)
- logmsg (L_ERR, "setgid(%lu) failed: %s",
+ logmsg (L_ERR, _("setgid(%lu) failed: %s"),
(u_long) gid, strerror (errno));
@@ -365,3 +366,3 @@ change_privs (uid_t uid, gid_t gid)
{
- logmsg (L_ERR, "cannot set effective gid to %lu: %s",
+ logmsg (L_ERR, _("cannot set effective gid to %lu: %s"),
(u_long) gid, strerror (errno));
@@ -387,3 +388,3 @@ change_privs (uid_t uid, gid_t gid)
logmsg (L_ERR,
- "setreuid(%lu,-1) failed: %s",
+ _("setreuid(%lu,-1) failed: %s"),
(u_long) uid, strerror (errno));
@@ -394,3 +395,3 @@ change_privs (uid_t uid, gid_t gid)
logmsg (L_ERR,
- "second setuid(%lu) failed: %s",
+ _("second setuid(%lu) failed: %s"),
(u_long) uid, strerror (errno));
@@ -402,3 +403,3 @@ change_privs (uid_t uid, gid_t gid)
{
- logmsg (L_ERR, "setuid(%lu) failed: %s",
+ logmsg (L_ERR, _("setuid(%lu) failed: %s"),
(u_long) uid, strerror (errno));
@@ -414,3 +415,3 @@ change_privs (uid_t uid, gid_t gid)
{
- logmsg (L_ERR, "seteuid(0) succeeded when it should not");
+ logmsg (L_ERR, _("seteuid(0) succeeded when it should not"));
rc = 1;
@@ -419,3 +420,3 @@ change_privs (uid_t uid, gid_t gid)
{
- logmsg (L_ERR, "cannot drop non-root setuid privileges");
+ logmsg (L_ERR, _("cannot drop non-root setuid privileges"));
rc = 1;
@@ -436,3 +437,3 @@ change_user ()
{
- logmsg (L_NOTICE, "not a superuser: ignoring the `user' statement");
+ logmsg (L_NOTICE, _("not a superuser: ignoring the `user' statement"));
return;
@@ -464,3 +465,4 @@ decode_buffer ()
{
- logmsg (L_NOTICE, "got invalid packet: n_addr = %d", reply->n_addr);
+ logmsg (L_NOTICE, _("got invalid packet: n_addr = %d"),
+ reply->n_addr);
return;
@@ -473,3 +475,3 @@ decode_buffer ()
gmtime (&reply->timestamp));
- logmsg (L_INFO, "Received packet: %d %lu - %s", reply->n_addr,
+ logmsg (L_INFO, _("Received packet: %d %lu - %s"), reply->n_addr,
(unsigned long) reply->timestamp, tbuf);
@@ -485,3 +487,3 @@ decode_buffer ()
else if (pid < 0)
- logmsg (L_ERR, "can't fork: %s", strerror (errno));
+ logmsg (L_ERR, _("cannot fork: %s"), strerror (errno));
else
@@ -499,3 +501,3 @@ decode_buffer ()
sp->out = ntohl (sp->out);
- verbose (1, "Monitor %s: %lu %lu", sp->name, sp->in, sp->out);
+ verbose (1, _("Monitor %s: %lu %lu"), sp->name, sp->in, sp->out);
report (sp, reply->timestamp);
@@ -527,6 +529,7 @@ read_input (const char *name)
if (!fp)
- die (EX_OSERR, "cannot open file `%s': %s", name, strerror (errno));
+ die (EX_OSERR, _("cannot open file `%s': %s"),
+ name, strerror (errno));
}
- verbose (2, "Reading `%s'", name);
+ verbose (2, _("Reading `%s'"), name);
@@ -549,3 +552,3 @@ read_input (const char *name)
if (i > MAX_NAME_LENGTH)
- die (EX_DATAERR, "%s:%lu: ID too long", name, line);
+ die (EX_DATAERR, _("%s:%lu: ID too long"), name, line);
st.name[i++] = *p++;
@@ -555,3 +558,3 @@ read_input (const char *name)
if (sscanf (p, " %lu %lu %lu\n", &t, &st.in, &st.out) != 3)
- die (EX_DATAERR, "%s:%lu: invalid input line", name, line);
+ die (EX_DATAERR, _("%s:%lu: invalid input line"), name, line);
report (&st, t);
@@ -560,3 +563,3 @@ read_input (const char *name)
close_db ();
- verbose (2, "Finished reading `%s'", name);
+ verbose (2, _("Finished reading `%s'"), name);
}
@@ -577,3 +580,3 @@ get_port (char *str)
{
- logmsg (L_ERR, "no such service: %s", str);
+ logmsg (L_ERR, _("no such service: %s"), str);
return 0;
@@ -596,3 +599,3 @@ sig_quit (int sig)
{
- logmsg (L_INFO, "exiting on signal %d", sig);
+ logmsg (L_INFO, _("exiting on signal %d"), sig);
unlink (pidfile);
@@ -604,3 +607,3 @@ sig_fatal (int sig)
{
- logmsg (L_ERR, "FATAL: exiting on signal %d", sig);
+ logmsg (L_ERR, _("FATAL: exiting on signal %d"), sig);
unlink (pidfile);
@@ -718,3 +721,3 @@ tagr_restart (char **argv)
if (cond) \
- die (EX_USAGE, "%s is meaningless with %s", opt, mode_opt); \
+ die (EX_USAGE, _("%s is meaningless with %s"), opt, mode_opt); \
while (0)
@@ -775,3 +778,3 @@ main (int argc, char **argv)
if (argc != 0 && !(list_option || import_option))
- die (EX_USAGE, "Too many arguments");
+ die (EX_USAGE, _("Too many arguments"));
@@ -897,3 +900,3 @@ main (int argc, char **argv)
if (daemon (0, 0))
- die (EX_OSERR, "cannot become daemon: %s", strerror (errno));
+ die (EX_OSERR, _("cannot become daemon: %s"), strerror (errno));
@@ -906,3 +909,3 @@ main (int argc, char **argv)
{
- logmsg (L_ERR, "can't write pid file %s: %s",
+ logmsg (L_ERR, _("cannot write pid file %s: %s"),
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[] = {
grecs_type_string, &rate_unit },
- { "number-suffixes", N_("suffixes"), NULL /* FIXME */,
+ { "number-suffixes", N_("suffixes"),
+ N_("Not implemented") /* FIXME */,
grecs_type_string, NULL, 0, cb_number_suffixes },
@@ -388,7 +389,9 @@ static struct grecs_keyword tagr_kw[] = {
grecs_type_bool, &transparent_option },
- { "percent", NULL, NULL /* FIXME: descr */,
+ { "percent", NULL,
+ N_("Draw in/out percent graph (not implemented)"), /* FIXME */
grecs_type_bool, &percent_option },
- { "zero-unknown", NULL, NULL /* FIXME: descr */,
+ { "zero-unknown", NULL,
+ N_("Zero-out missing samples (not implemented)") /* FIXME */,
grecs_type_bool, &zero_unknown_option },
- { "fill-incoming", NULL, NULL /* FIXME: descr */,
+ { "fill-incoming", NULL, N_("Fill incoming graph"),
grecs_type_bool, &fill_incoming_option },
@@ -397,20 +400,21 @@ static struct grecs_keyword tagr_kw[] = {
grecs_type_int, color_background, 0, cb_color },
- { "color-light", NULL, NULL /* FIXME: descr */,
+ { "color-light", NULL, N_("`Light' color (for the border)"),
grecs_type_int, color_light, 0, cb_color },
- { "color-dark", NULL, NULL /* FIXME: descr */,
+ { "color-dark", NULL, N_("`Dark' color (for the border)"),
grecs_type_int, color_dark, 0, cb_color },
- { "color-major", NULL, NULL /* FIXME: descr */,
+ { "color-major", NULL,
+ N_("`Major' color (boundaries, max. values, zero mark, etc.)"),
grecs_type_int, color_major, 0, cb_color },
- { "color-in", NULL, NULL /* FIXME: descr */,
+ { "color-in", NULL, N_("Color for the input graph"),
grecs_type_int, color_in, 0, cb_color },
- { "color-out", NULL, NULL /* FIXME: descr */,
+ { "color-out", NULL, N_("Color for the output graph"),
grecs_type_int, color_out, 0, cb_color },
- { "color-grid", NULL, NULL /* FIXME: descr */,
+ { "color-percent", NULL, N_("Color for the i/o percent graph"),
+ grecs_type_int, color_percent, 0, cb_color },
+ { "color-grid", NULL, N_("Grid and axes color"),
grecs_type_int, color_grid, 0, cb_color },
- { "color-in-max", NULL, NULL /* FIXME: descr */,
+ { "color-in-max", NULL, N_("Not implemented") /* FIXME */,
grecs_type_int, color_in_max, 0, cb_color },
- { "color-out-max", NULL, NULL /* FIXME: descr */,
+ { "color-out-max", NULL, N_("Not implemented") /* FIXME */,
grecs_type_int, color_out_max, 0, cb_color },
- { "color-percent", NULL, NULL /* FIXME: descr */,
- grecs_type_int, color_percent, 0, cb_color },
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)
{
- logmsg (L_ERR, "Cannot open database %s: %s",
+ logmsg (L_ERR, _("cannot open database %s: %s"),
dbname, gdbm_strerror (gdbm_errno));
@@ -93,6 +93,7 @@ _read_db (datum key, struct traffic_record **tr)
if (content.dptr == NULL)
- logmsg (L_NOTICE, "Record for %*.*s not found", key.dsize, key.dsize, key.dptr);
+ logmsg (L_NOTICE, _("record for %*.*s not found"),
+ key.dsize, key.dsize, key.dptr);
else if (content.dsize != sizeof **tr)
{
- logmsg (L_ERR, "Wrong record size for %*.*s: %lu",
+ logmsg (L_ERR, _("wrong record size for %*.*s: %lu"),
key.dsize, key.dsize, key.dptr, content.dsize);
@@ -106,3 +107,3 @@ _read_db (datum key, struct traffic_record **tr)
- logmsg (L_NOTICE, "Creating record for %*.*s",
+ logmsg (L_NOTICE, _("creating record for %*.*s"),
key.dsize, key.dsize, key.dptr);
@@ -138,3 +139,3 @@ write_db (struct monitor *mon, struct traffic_record *tr)
{
- logmsg (L_ERR, "Failed to write data for %s: %s",
+ logmsg (L_ERR, _("failed to write data for %s: %s"),
mon->id, gdbm_strerror (gdbm_errno));
@@ -149,3 +150,5 @@ print_queue (const char *title, queue_t *q)
count = queue_count (q);
- printf ("%s (%d entries):\n", title, count);
+ printf (ngettext ("%s (%d entry):\n", "%s (%d entries):\n",
+ count),
+ title, count);
for (i = count - 1; i >= 0; i--)
@@ -177,16 +180,17 @@ print_tr (datum key, struct traffic_record *tr)
strftime (buf, sizeof buf, "%c", tm);
- printf ("Last sample: %lu (%s) %lu %lu\n",
+ printf (_("Last sample: %lu (%s) %lu %lu\n"),
tr->last.time, buf, tr->last.in, tr->last.out);
- printf ("Last rates: %g %g\n", tr->last_rates.inrate, tr->last_rates.outrate);
- print_queue ("Daily rates", &tr->day_hist);
+ printf (_("Last rates: %g %g\n"),
+ tr->last_rates.inrate, tr->last_rates.outrate);
+ print_queue (_("Daily rates"), &tr->day_hist);
- print_avg ("Weekly average", &tr->week_avg);
- print_queue ("Weekly rates", &tr->week_hist);
+ print_avg (_("Weekly average"), &tr->week_avg);
+ print_queue (_("Weekly rates"), &tr->week_hist);
- print_avg ("Monthly average", &tr->month_avg);
- print_queue ("Monthly rates", &tr->month_hist);
+ print_avg (_("Monthly average"), &tr->month_avg);
+ print_queue (_("Monthly rates"), &tr->month_hist);
- print_avg ("Yearly average", &tr->year_avg);
- print_queue ("Yearly rates", &tr->year_hist);
+ print_avg (_("Yearly average"), &tr->year_avg);
+ print_queue (_("Yearly rates"), &tr->year_hist);
}
@@ -234,3 +238,3 @@ report (Stat *stat, time_t timestamp)
else
- logmsg (L_WARNING, "%s not found in config", stat->name);
+ logmsg (L_WARNING, _("%s not found in config"), stat->name);
}
@@ -275,3 +279,3 @@ rebuild (int force)
- verbose (1, "rebuild initiated");
+ verbose (1, _("rebuild initiated"));
open_db (TAGR_DB_WR);
@@ -286,3 +290,3 @@ rebuild (int force)
close_db ();
- verbose (1, "rebuild finished");
+ verbose (1, _("rebuild finished"));
}
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,
th.outrate = outrate;
- verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate);
+ verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate);
queue_put (q, &th);
@@ -60,3 +60,3 @@ interpolate (queue_t *q,
/ interval + last_rates->outrate;
- verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate);
+ verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate);
queue_put (q, &th);
@@ -94,3 +94,3 @@ overflow (struct traffic_history *th,
tmp.outrate = avg->outrate;
- verbose (3, "Insert %lu %g %g", now, tmp.inrate, tmp.outrate);
+ verbose (3, _("insert %lu %g %g"), now, tmp.inrate, tmp.outrate);
queue_put (q, &tmp);
@@ -110,6 +110,7 @@ ovf_monthly (struct traffic_history *th, struct traffic_record *tr, time_t now)
{
- verbose (2, "begin overflow_monthly %lu %g %g", now, th->inrate, th->outrate);
+ verbose (2, _("begin overflow_monthly %lu %g %g"),
+ now, th->inrate, th->outrate);
overflow (th, tr, now, NULL, &tr->year_avg, &tr->year_hist,
YEAR_COUNT, YEAR_SAMPLE);
- verbose (2, "end overflow_monthly");
+ verbose (2, _("end overflow_monthly"));
}
@@ -119,6 +120,7 @@ ovf_weekly (struct traffic_history *th, struct traffic_record *tr, time_t now)
{
- verbose (2, "begin overflow_weekly %lu %g %g", now, th->inrate, th->outrate);
+ verbose (2, _("begin overflow_weekly %lu %g %g"),
+ now, th->inrate, th->outrate);
overflow (th, tr, now, ovf_monthly, &tr->month_avg, &tr->month_hist,
MONTH_COUNT, MONTH_SAMPLE);
- verbose (2, "end overflow_daily");
+ verbose (2, _("end overflow_daily"));
}
@@ -128,6 +130,7 @@ ovf_daily (struct traffic_history *th, struct traffic_record *tr, time_t now)
{
- verbose (2, "begin overflow_daily %lu %g %g", now, th->inrate, th->outrate);
+ verbose (2, _("begin overflow_daily %lu %g %g"),
+ now, th->inrate, th->outrate);
overflow (th, tr, now, ovf_weekly, &tr->week_avg, &tr->week_hist,
WEEK_COUNT, WEEK_SAMPLE);
- verbose (2, "end overflow_daily");
+ verbose (2, _("end overflow_daily"));
}
@@ -146,3 +149,3 @@ update_stats (struct monitor *mon, struct traffic_sample *sample,
{
- logmsg (L_ERR, "Ignoring zero interval");
+ logmsg (L_ERR, _("ignoring zero interval"));
return;
@@ -219,3 +222,3 @@ _convert (queue_t *q, ovf_t ovf,
{
- logmsg (L_ERR, "Ignoring zero interval");
+ logmsg (L_ERR, _("ignoring zero interval"));
break;
@@ -254,3 +257,3 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp,
{
- verbose (2, "begin convert_yearly");
+ verbose (2, _("begin convert_yearly"));
_convert (&tr->year_hist, NULL, tr,
@@ -258,3 +261,3 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp,
compute_avg (&tr->year_avg, &tr->year_hist, &tr->last);
- verbose (2, "end convert_yearly");
+ verbose (2, _("end convert_yearly"));
}
@@ -265,3 +268,3 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
{
- verbose (2, "begin convert_monthly");
+ verbose (2, _("begin convert_monthly"));
if (count > MONTH_COUNT+1)
@@ -271,3 +274,3 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
compute_avg (&tr->month_avg, &tr->month_hist, &tr->last);
- verbose (2, "end convert_monthly");
+ verbose (2, _("end convert_monthly"));
}
@@ -277,3 +280,3 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou
{
- verbose (2, "begin convert_weekly");
+ verbose (2, _("begin convert_weekly"));
if (count > WEEK_COUNT+1)
@@ -283,3 +286,3 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou
compute_avg (&tr->week_avg, &tr->week_hist, &tr->last);
- verbose (2, "end convert_weekly");
+ verbose (2, _("end convert_weekly"));
}
@@ -289,3 +292,3 @@ convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t coun
{
- verbose (2, "begin convert_daily");
+ verbose (2, _("begin convert_daily"));
if (count > DAY_COUNT+1)
@@ -293,3 +296,3 @@ convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t coun
_convert (&tr->day_hist, ovf_daily, tr, hp, DAY_COUNT + 1, DAY_SAMPLE);
- verbose (2, "end convert_daily");
+ verbose (2, _("end convert_daily"));
}
@@ -331,6 +334,6 @@ import_log (const char *name)
{
- logmsg (L_ERR, "cannot open `%s': %s", name, strerror (errno));
+ logmsg (L_ERR, _("cannot open `%s': %s"), name, strerror (errno));
return 1;
}
- verbose (2, "Importing %s", name);
+ verbose (2, _("importing %s"), name);
@@ -339,3 +342,3 @@ import_log (const char *name)
{
- logmsg (L_ERR, "%s:1: Unexpected number of fields", name);
+ logmsg (L_ERR, _("%s:1: unexpected number of fields"), name);
fclose (fp);
@@ -366,3 +369,3 @@ import_log (const char *name)
{
- logmsg (L_WARNING, "%s:%lu: is corrupted", name, line);
+ logmsg (L_WARNING, _("%s:%lu: is corrupted"), name, line);
break;
@@ -401,3 +404,3 @@ import_log (const char *name)
{
- logmsg (L_ERR, "cannot find monitor `%s'", base);
+ logmsg (L_ERR, _("cannot find monitor `%s'"), base);
rc = 1;
@@ -418,6 +421,7 @@ import (const char *dirname)
- verbose (2, "Examining `%s'", dirname);
+ verbose (2, _("examining `%s'"), dirname);
if (stat (dirname, &st))
- die (EX_OSERR, "cannot stat file `%s': %s", dirname, strerror (errno));
+ die (EX_OSERR, _("cannot stat file `%s': %s"),
+ dirname, strerror (errno));
else if (S_ISREG (st.st_mode))
@@ -452,6 +456,7 @@ import (const char *dirname)
case GLOB_NOSPACE:
- die (EX_UNAVAILABLE, "cannot scan directory: %s", strerror (ENOMEM));
+ die (EX_UNAVAILABLE, _("cannot scan directory: %s"),
+ strerror (ENOMEM));
case GLOB_ABORTED:
- die (EX_UNAVAILABLE, "scanning aborted");
+ die (EX_UNAVAILABLE, _("scanning aborted"));
@@ -461,3 +466,3 @@ import (const char *dirname)
default:
- die (EX_UNAVAILABLE, "cannot scan directory `%s'", dirname);
+ die (EX_UNAVAILABLE, _("cannot scan directory `%s'"), dirname);
}
@@ -465,3 +470,3 @@ import (const char *dirname)
- verbose (1, "Number of imported log files: %d", count);
+ verbose (1, _("number of imported log files: %d"), count);
}
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 @@
-#define LOGFACILITY LOG_LOCAL5
#define TAGR_CONFIGFILE SYSCONFDIR "/tagr.conf"
@@ -29,4 +28,6 @@
-#define _(s) s
+#define _(s) gettext (s)
#define N_(s) s
+#define gettext(s) s
+#define ngettext(s,p,c) ((c) == 1 ? (s) : (p))

Return to:

Send suggestions and report system problems to the System administrator.