diff options
Diffstat (limited to 'comsat')
-rw-r--r-- | comsat/action.c | 30 | ||||
-rw-r--r-- | comsat/cfg.c | 16 | ||||
-rw-r--r-- | comsat/comsat.c | 57 | ||||
-rw-r--r-- | comsat/comsat.h | 11 |
4 files changed, 59 insertions, 55 deletions
diff --git a/comsat/action.c b/comsat/action.c index 6abbda31b..2c51b209b 100644 --- a/comsat/action.c +++ b/comsat/action.c @@ -1,18 +1,18 @@ -/* GNU mailutils - a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + GNU Mailutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with GNU Mailutils; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "comsat.h" @@ -277,27 +277,27 @@ action_exec (FILE *tty, int line, int argc, char **argv) if (argc == 0) { - syslog (LOG_ERR, "%s:.biffrc:%d: No arguments for exec", username, line); + syslog (LOG_ERR, _("%s:.biffrc:%d: No arguments for exec"), username, line); return; } if (argv[0][0] != '/') { - syslog (LOG_ERR, "%s:.biffrc:%d: Not an absolute pathname", + syslog (LOG_ERR, _("%s:.biffrc:%d: Not an absolute pathname"), username, line); return; } if (stat (argv[0], &stb)) { - syslog (LOG_ERR, "%s:.biffrc:%d: can't stat %s: %s", + syslog (LOG_ERR, _("%s:.biffrc:%d: can't stat %s: %s"), username, line, argv[0], strerror (errno)); return; } if (stb.st_mode & (S_ISUID|S_ISGID)) { - syslog (LOG_ERR, "%s:.biffrc:%d: won't execute set[ug]id programs", + syslog (LOG_ERR, _("%s:.biffrc:%d: won't execute set[ug]id programs"), username, line); return; } @@ -311,7 +311,7 @@ action_exec (FILE *tty, int line, int argc, char **argv) dup2 (fileno (tty), 2); fclose (tty); execv (argv[0], argv); - syslog (LOG_ERR, "can't execute %s: %s", argv[0], strerror (errno)); + syslog (LOG_ERR, _("can't execute %s: %s"), argv[0], strerror (errno)); exit (0); } } @@ -329,14 +329,14 @@ open_rc (const char *filename, FILE *tty) { if (stb.st_uid != pw->pw_uid) { - syslog (LOG_NOTICE, "%s's %s is not owned by %s", + syslog (LOG_NOTICE, _("%s's %s is not owned by %s"), username, filename, username); return NULL; } if ((stb.st_mode & 0777) != 0600) { - fprintf (tty, "Warning: your .biffrc has wrong permissions\r\n"); - syslog (LOG_NOTICE, "%s's %s has wrong permissions", + fprintf (tty, _("Warning: your .biffrc has wrong permissions\r\n")); + syslog (LOG_NOTICE, _("%s's %s has wrong permissions"), username, filename); return NULL; } @@ -393,8 +393,8 @@ run_user_action (FILE *tty, const char *cr, message_t msg) } else { - fprintf (tty, ".biffrc:%d: unknown keyword\r\n", line); - syslog (LOG_ERR, "%s:.biffrc:%d: unknown keyword %s", + fprintf (tty, _(".biffrc:%d: unknown keyword\r\n"), line); + syslog (LOG_ERR, _("%s:.biffrc:%d: unknown keyword %s"), username, line, argv[0]); break; } diff --git a/comsat/cfg.c b/comsat/cfg.c index ea97d9e90..b78e23d19 100644 --- a/comsat/cfg.c +++ b/comsat/cfg.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2001 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Inetutils. @@ -111,7 +111,7 @@ netdef_parse (char *str) netdef = malloc (sizeof *netdef); if (!netdef) { - syslog (LOG_ERR, "out of memory"); + syslog (LOG_ERR, _("out of memory")); exit (1); } @@ -136,7 +136,7 @@ read_config (const char *config_file) fp = fopen (config_file, "r"); if (!fp) { - syslog (LOG_ERR, "can't open config file %s: %m", config_file); + syslog (LOG_ERR, _("can't open config file %s: %m"), config_file); return; } @@ -163,7 +163,7 @@ read_config (const char *config_file) argcv_get (ptr, "", NULL, &argc, &argv); if (argc < 2) { - syslog (LOG_ERR, "%s:%d: too few fields", config_file, line); + syslog (LOG_ERR, _("%s:%d: too few fields"), config_file, line); argcv_free (argc, argv); continue; } @@ -175,7 +175,7 @@ read_config (const char *config_file) else if (strcmp (argv[1], "no") == 0) allow_biffrc = 0; else - syslog (LOG_ERR, "%s:%d: yes or no expected", config_file, line); + syslog (LOG_ERR, _("%s:%d: yes or no expected"), config_file, line); } else if (strcmp (argv[0], "max-requests") == 0) maxrequests = strtoul (argv[1], NULL, 0); @@ -195,7 +195,7 @@ read_config (const char *config_file) action = ACT_DENY; else { - syslog (LOG_ERR, "%s:%d: unknown keyword", config_file, line); + syslog (LOG_ERR, _("%s:%d: unknown keyword"), config_file, line); argcv_free (argc, argv); continue; } @@ -206,7 +206,7 @@ read_config (const char *config_file) netdef_t *cur = netdef_parse (argv[i]); if (!cur) { - syslog (LOG_ERR, "%s:%d: can't parse netdef: %s", + syslog (LOG_ERR, _("%s:%d: can't parse netdef: %s"), config_file, line, argv[i]); continue; } @@ -222,7 +222,7 @@ read_config (const char *config_file) acl = malloc (sizeof *acl); if (!acl) { - syslog (LOG_CRIT, "out of memory"); + syslog (LOG_CRIT, _("out of memory")); exit (1); } acl->next = NULL; diff --git a/comsat/comsat.c b/comsat/comsat.c index 9932ee761..b68728778 100644 --- a/comsat/comsat.c +++ b/comsat/comsat.c @@ -1,18 +1,18 @@ -/* GNU mailutils - a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + GNU Mailutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with GNU Mailutils; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "comsat.h" @@ -55,7 +55,7 @@ static char doc[] = "GNU comsatd"; static struct argp_option options[] = { - {"config", 'c', "FILE", 0, "Read configuration from FILE", 0}, + {"config", 'c', "FILE", 0, N_("Read configuration from FILE"), 0}, { NULL, 0, NULL, 0, NULL, 0 } }; @@ -136,12 +136,15 @@ main(int argc, char **argv) { int c; + /* Native Language Support */ + mu_init_nls (); + mu_argp_parse (&argp, &argc, &argv, 0, comsat_argp_capa, NULL, &daemon_param); if (daemon_param.timeout > 0 && daemon_param.mode == MODE_DAEMON) { - fprintf (stderr, "--timeout and --daemon are incompatible\n"); + fprintf (stderr, _("--timeout and --daemon are incompatible\n")); exit (EXIT_FAILURE); } @@ -175,10 +178,10 @@ main(int argc, char **argv) static RETSIGTYPE sig_hup (int sig) { - syslog (LOG_NOTICE, "restarting"); + syslog (LOG_NOTICE, _("restarting")); if (xargv[0][0] != '/') - syslog (LOG_ERR, "can't restart: not started with absolute pathname"); + syslog (LOG_ERR, _("can't restart: not started with absolute pathname")); else execvp (xargv[0], xargv); @@ -212,7 +215,7 @@ comsat_daemon_init (void) first three one, in, out, err. Do not do the chdir("/"). */ if (daemon (1, 0) < 0) { - perror ("failed to become a daemon:"); + perror (_("failed to become a daemon:")); exit (EXIT_FAILURE); } } @@ -256,7 +259,7 @@ comsat_daemon (int port) exit (1); } - syslog (LOG_NOTICE, "GNU comsat started"); + syslog (LOG_NOTICE, _("GNU comsat started")); last_request_time = last_overflow_time = time (NULL); while (1) @@ -283,7 +286,7 @@ comsat_daemon (int port) unsigned delay; delay = overflow_delay_time << (overflow_count + 1); - syslog (LOG_NOTICE, "too many requests: pausing for %u seconds", + syslog (LOG_NOTICE, _("too many requests: pausing for %u seconds"), delay); sleep (delay); reqcount = 0; @@ -336,12 +339,12 @@ comsat_main (int fd) if (acl_match (&sin_from)) { - syslog (LOG_ALERT, "DENIED attempt to connect from %s", + syslog (LOG_ALERT, _("DENIED attempt to connect from %s"), inet_ntoa (sin_from.sin_addr)); return 1; } - syslog (LOG_INFO, "%d bytes from %s", rdlen, inet_ntoa (sin_from.sin_addr)); + syslog (LOG_INFO, _("%d bytes from %s"), rdlen, inet_ntoa (sin_from.sin_addr)); buffer[rdlen] = 0; @@ -349,7 +352,7 @@ comsat_main (int fd) p = strchr (buffer, '@'); if (!p) { - syslog (LOG_ERR, "malformed input: %s", buffer); + syslog (LOG_ERR, _("malformed input: %s"), buffer); return 1; } *p++ = 0; @@ -364,7 +367,7 @@ comsat_main (int fd) break; default: if (!isspace (*endp)) - syslog (LOG_ERR, "malformed input: %s@%s (near %s)", buffer, p, endp); + syslog (LOG_ERR, _("malformed input: %s@%s (near %s)"), buffer, p, endp); } if (find_user (buffer, tty) != SUCCESS) @@ -429,7 +432,7 @@ notify_user (const char *user, const char *device, const char *path, off_t offse change_user (user); if ((fp = fopen (device, "w")) == NULL) { - syslog (LOG_ERR, "can't open device %s: %m", device); + syslog (LOG_ERR, _("can't open device %s: %m"), device); exit (0); } @@ -445,21 +448,21 @@ notify_user (const char *user, const char *device, const char *path, off_t offse if ((status = mailbox_create (&mbox, path)) != 0 || (status = mailbox_open (mbox, MU_STREAM_READ)) != 0) { - syslog (LOG_ERR, "can't open mailbox %s: %s", + syslog (LOG_ERR, _("can't open mailbox %s: %s"), path, mu_errstring (status)); return; } if ((status = mailbox_get_stream (mbox, &stream))) { - syslog (LOG_ERR, "can't get stream for mailbox %s: %s", + syslog (LOG_ERR, _("can't get stream for mailbox %s: %s"), path, mu_errstring (status)); return; } if ((status = stream_size (stream, (off_t *) &size))) { - syslog (LOG_ERR, "can't get stream size (mailbox %s): %s", + syslog (LOG_ERR, _("can't get stream size (mailbox %s): %s"), path, mu_errstring (status)); return; } @@ -476,14 +479,14 @@ notify_user (const char *user, const char *device, const char *path, off_t offse if ((status = mailbox_create (&tmp, "/dev/null")) != 0 || (status = mailbox_open (tmp, MU_STREAM_READ)) != 0) { - syslog (LOG_ERR, "can't create temporary mailbox: %s", + syslog (LOG_ERR, _("can't create temporary mailbox: %s"), mu_errstring (status)); return; } if ((status = memory_stream_create (&stream, 0, 0))) { - syslog (LOG_ERR, "can't create temporary stream: %s", + syslog (LOG_ERR, _("can't create temporary stream: %s"), mu_errstring (status)); return; } @@ -530,7 +533,7 @@ find_user (const char *name, char *tty) if (strncmp (ftty, PATH_TTY_PFX, strlen (PATH_TTY_PFX))) { /* An attempt to break security... */ - syslog (LOG_ALERT, "bad line name in utmp record: %s", ftty); + syslog (LOG_ALERT, _("bad line name in utmp record: %s"), ftty); return NOT_HERE; } @@ -538,7 +541,7 @@ find_user (const char *name, char *tty) { if (!S_ISCHR (statb.st_mode)) { - syslog (LOG_ALERT, "not a character device: %s", ftty); + syslog (LOG_ALERT, _("not a character device: %s"), ftty); return NOT_HERE; } @@ -571,7 +574,7 @@ change_user (const char *user) pw = getpwnam (user); if (!pw) { - syslog (LOG_CRIT, "no such user: %s", user); + syslog (LOG_CRIT, _("no such user: %s"), user); exit (1); } @@ -591,7 +594,7 @@ mailbox_path (const char *user) if (!auth) { - syslog (LOG_ALERT, "user nonexistent: %s", user); + syslog (LOG_ALERT, _("user nonexistent: %s"), user); return NULL; } @@ -606,7 +609,7 @@ volatile int _st=0; void stop() { - syslog (LOG_ALERT, "waiting for debug"); + syslog (LOG_ALERT, _("waiting for debug")); while (!_st) _st=_st; } diff --git a/comsat/comsat.h b/comsat/comsat.h index 3531102b5..b60583ddb 100644 --- a/comsat/comsat.h +++ b/comsat/comsat.h @@ -1,18 +1,18 @@ -/* GNU mailutils - a suite of utilities for electronic mail - Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + GNU Mailutils is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + GNU Mailutils is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with GNU Mailutils; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H @@ -58,6 +58,7 @@ #include <mailutils/stream.h> #include <mailutils/mu_auth.h> #include <mailutils/argcv.h> +#include <mailutils/nls.h> #ifndef INADDR_NONE # define INADDR_NONE -1 |