diff options
m--------- | grecs | 0 | ||||
-rw-r--r-- | po/POTFILES.in | 15 | ||||
-rw-r--r-- | src/acl.c | 22 | ||||
-rw-r--r-- | src/comp.c | 10 | ||||
-rw-r--r-- | src/ctl.c | 5 | ||||
-rw-r--r-- | src/diag.c | 42 | ||||
-rw-r--r-- | src/inetd-bi.c | 3 | ||||
-rw-r--r-- | src/inetd.c | 8 | ||||
-rw-r--r-- | src/limits.c | 7 | ||||
-rw-r--r-- | src/pies.c | 29 | ||||
-rw-r--r-- | src/pies.h | 4 | ||||
-rw-r--r-- | src/piesctl.c | 34 | ||||
-rw-r--r-- | src/progman.c | 21 | ||||
-rw-r--r-- | src/socket.c | 20 | ||||
-rw-r--r-- | src/sysvinit.c | 7 |
15 files changed, 111 insertions, 116 deletions
diff --git a/grecs b/grecs -Subproject 07838fb2e9ed5769074add028e052a3b667e67e +Subproject 8241dc04501f62b613f17f5c165f915a216ba30 diff --git a/po/POTFILES.in b/po/POTFILES.in index 6923cb6..2496b6e 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -39 +39,16 @@ lib/netrc.c lib/pp.c + +grecs/src/cidr.c +grecs/src/format.c +grecs/src/grecs-gram.y +grecs/src/grecs-lex.l +grecs/src/json-gram.y +grecs/src/meta1-gram.y +grecs/src/meta1-lex.l +grecs/src/opthelp.c +grecs/src/path-parser.c +grecs/src/preproc.c +grecs/src/sockaddr.c +grecs/src/symtab.c +grecs/src/tree.c +grecs/src/wordsplit.c @@ -179,3 +179,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value) grecs_error (&entry->locus, 0, - _("socket name too long: `%s'"), string); + _("socket name too long: %s"), string); return 1; @@ -202,3 +202,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value) grecs_error (&entry->locus, 0, - _("cannot resolve host name: `%s'"), string); + _("cannot resolve host name: %s"), string); if (p) @@ -239,3 +239,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value) grecs_error (&entry->locus, 0, - _("invalid netmask: `%s'"), p); + _("invalid netmask: %s"), p); return 1; @@ -246,3 +246,3 @@ _parse_sockaddr (struct acl_entry *entry, const grecs_value_t *value) { - grecs_error (&entry->locus, 0, _("invalid netmask: `%s'"), p); + grecs_error (&entry->locus, 0, _("invalid netmask: %s"), p); return 1; @@ -283,3 +283,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv) { - grecs_error (&entry->locus, 0, _("expected `from', but found list")); + grecs_error (&entry->locus, 0, _("expected \"from\", but found list")); return 1; @@ -288,3 +288,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv) { - grecs_error (&entry->locus, 0, _("expected `from', but found `%s'"), + grecs_error (&entry->locus, 0, _("expected \"from\", but found \"%s\""), argv[0]->v.string); @@ -298,3 +298,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv) grecs_error (&entry->locus, 0, - _("unexpected end of statement after `from'")); + _("unexpected end of statement after \"from\"")); return 1; @@ -323,3 +323,3 @@ _parse_from (struct acl_entry *entry, size_t argc, grecs_value_t **argv) { - grecs_warning (&entry->locus, 0, _("junk after `from' list")); + grecs_warning (&entry->locus, 0, _("junk after from-list")); return 1; @@ -356,4 +356,4 @@ _parse_sub_acl (struct acl_entry *entry, size_t argc, grecs_value_t **argv) { - grecs_error (&entry->locus, 0, _("ACL not defined: `%s'"), - argv[0]->v.string); + grecs_error (&entry->locus, 0, _("ACL not defined: %s"), + argv[0]->v.string); return 1; @@ -434,3 +434,3 @@ parse_acl_line (grecs_locus_t *locus, int allow, pies_acl_t acl, { - grecs_error (&entry->locus, 0, _("unknown word `%s'"), + grecs_error (&entry->locus, 0, _("unknown word: %s"), value->v.string); @@ -542,3 +542,3 @@ component_verify (struct component *comp, grecs_locus_t *locus) COMPERR (grecs_error, - "%s", _("`internal' used without `service'")); + "%s", _("\"internal\" used without \"service\"")); else @@ -554,3 +554,3 @@ component_verify (struct component *comp, grecs_locus_t *locus) COMPERR (grecs_error, - "%s", _("`internal' used with `command'")); + "%s", _("\"internal\" used with \"command\"")); } @@ -567,3 +567,3 @@ component_verify (struct component *comp, grecs_locus_t *locus) COMPERR (grecs_error, - "%s", _("both `tcpmux' and `tcpmuxplus' used")); + "%s", _("both \"tcpmux\" and \"tcpmuxplus\" used")); else if (!comp->service) @@ -571,3 +571,3 @@ component_verify (struct component *comp, grecs_locus_t *locus) COMPERR (grecs_error, - "%s", _("`internal' used without `service'")); + "%s", _("\"internal\" used without \"service\"")); } @@ -662,3 +662,3 @@ component_verify (struct component *comp, grecs_locus_t *locus) COMPERR (grecs_error, - "%s", _("stdout translation invalid in this mode")); + "%s", _("stdout redirection invalid in this mode")); comp->redir[RETR_OUT].type = redir_null; @@ -1247,3 +1247,3 @@ ctl_accept (int socket, void *data) { - logmsg (LOG_ERR, _("accept failed: %s"), strerror (errno)); + logfuncall ("accept", NULL, errno); return 1; @@ -1291,4 +1291,3 @@ ctl_open (void) { - logmsg (LOG_CRIT, _("can't listen on control socket %s: %s"), - control.url->string, strerror (errno)); + logfuncall ("listen", control.url->string, errno); return -1; @@ -229,34 +229,12 @@ logmsg_printf (int prio, const char *fmt, ...) void -grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg) +pies_diag_printer (grecs_locus_t const *locus, int err, int errcode, + const char *msg) { - char *locstr = NULL; - if (locus) { - size_t size = 0; + char *locstr = NULL; + size_t locsize = 0; + + grecs_asprint_locus (&locstr, &locsize, locus); - if (locus->beg.col == 0) - grecs_asprintf (&locstr, &size, "%s:%u", - locus->beg.file, - locus->beg.line); - else if (strcmp (locus->beg.file, locus->end.file)) - grecs_asprintf (&locstr, &size, "%s:%u.%u-%s:%u.%u", - locus->beg.file, - locus->beg.line, locus->beg.col, - locus->end.file, - locus->end.line, locus->end.col); - else if (locus->beg.line != locus->end.line) - grecs_asprintf (&locstr, &size, "%s:%u.%u-%u.%u", - locus->beg.file, - locus->beg.line, locus->beg.col, - locus->end.line, locus->end.col); - else - grecs_asprintf (&locstr, &size, "%s:%u.%u-%u", - locus->beg.file, - locus->beg.line, locus->beg.col, - locus->end.col); - } - - if (locstr) - { if (errcode) @@ -279 +257,9 @@ grecs_print_diag (grecs_locus_t *locus, int err, int errcode, const char *msg) +void +logfuncall (const char *fun, const char *arg, int err) +{ + if (arg) + grecs_error (NULL, err, _("%s: %s failed"), arg, fun); + else + grecs_error (NULL, err, _("%s failed"), fun); +} diff --git a/src/inetd-bi.c b/src/inetd-bi.c index 7ce4b39..2032123 100644 --- a/src/inetd-bi.c +++ b/src/inetd-bi.c @@ -230,3 +230,4 @@ qotd_read (char *text) { - logmsg (LOG_ERR, _("cannot open %s: %s"), qotdfile, strerror (errno)); + logmsg (LOG_ERR, _("cannot open file %s: %s"), qotdfile, + strerror (errno)); strncpy (text, QOTD_DEF, QOTD_MAX); diff --git a/src/inetd.c b/src/inetd.c index ee16078..40fb6fe 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -357,4 +357,6 @@ inetd_conf_dir (const char *name) { - logmsg (LOG_ERR, _("cannot stat %s/%s: %s"), - name, ent->d_name, strerror (errno)); + int ec = errno; + char *name = mkfilename (name, ent->d_name, NULL); + logfuncall ("stat", name, ec); + free (name); errs |= 1; @@ -385,3 +387,3 @@ inetd_config_parse (const char *file) { - logmsg (LOG_ERR, _("cannot stat %s: %s"), file, strerror (errno)); + logfuncall ("stat", file, errno); return 1; diff --git a/src/limits.c b/src/limits.c index 7387b9d..2893ff6 100644 --- a/src/limits.c +++ b/src/limits.c @@ -59,4 +59,4 @@ do_set_limit (int rlimit, rlim_t limit) { - logmsg (LOG_NOTICE, _("error setting limit: %s"), - strerror (errno)); + //FIXME: arg? + logfuncall ("setrlimit", NULL, errno); return 1; @@ -72,4 +72,3 @@ set_prio (int prio) { - logmsg (LOG_NOTICE, _("error setting priority: %s"), - strerror (errno)); + logfuncall ("setpriority", NULL, errno); return 1; @@ -684,3 +684,3 @@ cb_syslog_facility (enum grecs_callback_command cmd, else if (string_to_syslog_facility (str, varptr)) - grecs_error (locus, 0, _("unknown syslog facility `%s'"), str); + grecs_error (locus, 0, _("unknown syslog facility %s"), str); return 0; @@ -713,3 +713,3 @@ _cb_redir (enum grecs_callback_command cmd, { - grecs_error (locus, 0, _("unknown syslog priority `%s'"), + grecs_error (locus, 0, _("unknown syslog priority %s"), value->v.string); @@ -749,3 +749,3 @@ _cb_redir (enum grecs_callback_command cmd, grecs_error (locus, 0, - _("unknown syslog priority `%s'"), + _("unknown syslog priority %s"), value->v.arg.v[1]->v.string); @@ -1557,5 +1557,5 @@ config_help () static char docstring[] = - /* TRANSLATORS: do not translate words between ` and ' */ + /* TRANSLATORS: do not translate words in quotes */ N_("Configuration file structure for pies.\n" - "For more information, use `info pies configuration'."); + "For more information, use command \"info pies configuration\"."); grecs_print_docstring (docstring, 0, stdout); @@ -1706,4 +1706,3 @@ pidfile_read (int must_exist) if (must_exist && errno != ENOENT) - logmsg (LOG_ERR, - _("cannot open pid file `%s': %s"), + logmsg (LOG_ERR, _("cannot open file %s: %s"), pidfile, strerror (errno)); @@ -1721,3 +1720,3 @@ pidfile_read (int must_exist) logmsg (LOG_ERR, - _("unexpected character %#03o in pidfile `%s'"), + _("unexpected character %#03o in pidfile %s"), c, pidfile); @@ -1875,3 +1874,3 @@ check_pidfile (char *name) return; - logmsg (LOG_ERR, _("cannot open pidfile `%s': %s"), + logmsg (LOG_ERR, _("cannot open file %s: %s"), name, strerror (errno)); @@ -1889,3 +1888,3 @@ check_pidfile (char *name) _ - ("%s appears to run with pid %lu. If it does not, remove `%s' and retry."), + ("%s appears to run with pid %lu. If it does not, remove %s and retry."), program_name, pid, name); @@ -1897,4 +1896,3 @@ check_pidfile (char *name) { - logmsg (LOG_ERR, _("cannot unlink pidfile `%s': %s"), - name, strerror (errno)); + logfuncall ("unlink", name, errno); exit (EX_USAGE); @@ -1921,4 +1919,3 @@ remove_pidfile (char *name) if (unlink (name)) - logmsg (LOG_ERR, _("cannot unlink pidfile `%s': %s"), - name, strerror (errno)); + logfuncall ("unlink", name, errno); } @@ -1986,2 +1983,4 @@ main (int argc, char **argv) + grecs_print_diag_fun = pies_diag_printer; + pies_master_argc = argc; @@ -2195,3 +2194,3 @@ main (int argc, char **argv) { - logmsg (LOG_ERR, _("cannot become a daemon: %s"), strerror (errno)); + logfuncall ("daemon", NULL, errno); exit (EX_SOFTWARE); @@ -484,2 +484,6 @@ void logmsg_printf (int prio, const char *fmt, ...) PIES_PRINTFLIKE(2,3); void logmsg_vprintf (int prio, const char *fmt, va_list ap); +void logfuncall (const char *fun, const char *arg, int err); + +void pies_diag_printer (grecs_locus_t const *locus, int err, int errcode, + const char *msg); diff --git a/src/piesctl.c b/src/piesctl.c index 310dcc3..f4ea514 100644 --- a/src/piesctl.c +++ b/src/piesctl.c @@ -228,5 +228,6 @@ config_help (void) { + /* TRANSLATORS: do not translate words in quotes */ static char docstring[] = N_("Configuration file structure for piesctl.\n" - "For more information, use `info piesctl configuration'."); + "For more information, use command \"info piesctl configuration\"."); grecs_print_docstring (docstring, 0, stdout); @@ -448,6 +449,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, - _("%s: cannot stat socket: %s"), - url->path, - strerror (errno)); + grecs_error (NULL, errno, _("%s: %s failed"), url->path, "stat"); return NULL; @@ -459,5 +457,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, - _("%s: not a socket"), - url->path); + grecs_error (NULL, 0, _("%s: not a socket"), url->path); return NULL; @@ -501,4 +497,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, _("%s: unsupported protocol"), - url->string); + grecs_error (NULL, 0, _("%s: unsupported protocol"), url->string); return NULL; @@ -509,4 +504,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, _("%s: unable to create socket: %s"), - url->string, strerror(errno)); + grecs_error (NULL, errno, _("%s: %s failed"), url->string, "socket"); return NULL; @@ -515,3 +509,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) if ((flags = fcntl (fd, F_GETFD, 0)) == -1 - || fcntl (fd, F_SETFD, flags | FD_CLOEXEC) == -1) + || fcntl (fd, F_SETFD, flags | FD_CLOEXEC) == -1) grecs_error (NULL, 0, _("%s: cannot set close-on-exec: %s"), @@ -526,3 +520,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, errno, _("failed to bind")); + grecs_error (NULL, errno, _("%s: %s failed"), url->string, "bind"); exit (EX_UNAVAILABLE); @@ -533,4 +527,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, _("%s: cannot connect: %s"), - url->string, strerror (errno)); + grecs_error (NULL, errno, _("%s: %s failed"), url->string, "connect"); close (fd); @@ -542,3 +535,3 @@ shttp_connect (struct pies_url *url, struct grecs_sockaddr *source_addr) { - grecs_error (NULL, 0, "fdopen: %s", strerror (errno)); + grecs_error (NULL, errno, _("%s: %s failed"), url->string, "fdopen"); close (fd); @@ -2156,2 +2149,5 @@ static struct comtab comtab[] = { { NULL, NULL, + /* TRANSLATORS: You can leave the BNF below untranslated. If you + chose to translate it, please do not translate words in double + quotes. */ N_("CONDITION is defined as follows:\ @@ -2177,2 +2173,3 @@ static struct comtab comtab[] = { { NULL, NULL, + /* TRANSLATORS: Please don't translate the keywords. */ N_("Available KEYWORDS are: package, version, instance, binary, argv, PID"), NULL }, @@ -2187,3 +2184,4 @@ static struct comtab comtab[] = { N_("clear configuration file list"), NULL }, - { NULL, "file add SYNTAX FILE", + /* TRANSLATORS: Translate only words in upper case */ + { NULL, N_("file add SYNTAX FILE"), N_("add FILE of given SYNTAX to the list of configuration files"), NULL }, diff --git a/src/progman.c b/src/progman.c index f68fe91..547f806 100644 --- a/src/progman.c +++ b/src/progman.c @@ -1007,4 +1007,3 @@ prog_start_prologue (struct prog *prog) for (i = 0; i < comp->argc; i++) - logmsg_printf (LOG_DEBUG, " %s", - quotearg (comp->argv[i])); + logmsg_printf (LOG_DEBUG, " %s", quotearg (comp->argv[i])); logmsg_printf (LOG_DEBUG, "\n"); @@ -1093,5 +1092,3 @@ prog_start (struct prog *prog) { - logmsg (LOG_ERR, _("cannot unlink %s: %s"), - prog->v.p.comp->pass_fd_socket, - strerror (errno)); + logfuncall ("unlink", prog->v.p.comp->pass_fd_socket, errno); return; @@ -1326,3 +1323,3 @@ _prog_accept (struct prog *p) { - logmsg (LOG_ERR, _("accept failed: %s"), strerror (errno)); + logfuncall ("accept", NULL, errno); return 1; @@ -1850,3 +1847,3 @@ propagate_child_exit (pid_t pid) { - logmsg (LOG_ERR, _("waitpid failed: %s"), strerror (errno)); + logfuncall ("waitpid", NULL, errno); exit (EX_OSERR); @@ -2404,3 +2401,3 @@ progman_stop_component (struct prog **progptr) case status_running: - logmsg (LOG_INFO, _("stopping component `%s'"), prog_tag (prog)); + logmsg (LOG_INFO, _("stopping component %s"), prog_tag (prog)); prog_stop (prog, SIGTERM); @@ -2424,3 +2421,3 @@ progman_stop_component (struct prog **progptr) { - logmsg (LOG_INFO, _("waking up component `%s'"), prog_tag (prog)); + logmsg (LOG_INFO, _("waking up component %s"), prog_tag (prog)); prog->v.p.failcount = 0; @@ -2438,3 +2435,3 @@ progman_stop_component (struct prog **progptr) logmsg (LOG_INFO, - _("stopping component `%s': component not started"), + _("stopping component %s: component not started"), prog_tag (prog)); @@ -2447,3 +2444,3 @@ prog_deactivate_listener (struct prog *prog) { - logmsg (LOG_INFO, _("deactivating listener `%s'"), prog_tag (prog)); + logmsg (LOG_INFO, _("deactivating listener %s"), prog_tag (prog)); if (prog->v.p.socket != -1) @@ -2460,3 +2457,3 @@ prog_activate_listener (struct prog *prog) - logmsg (LOG_INFO, _("activating listener `%s'"), prog_tag (prog)); + logmsg (LOG_INFO, _("activating listener %s"), prog_tag (prog)); if (comp->mode == pies_comp_inetd && !ISCF_TCPMUX (comp->flags) diff --git a/src/socket.c b/src/socket.c index 3223a65..90833e5 100644 --- a/src/socket.c +++ b/src/socket.c @@ -138,4 +138,3 @@ create_socket (struct pies_url *url, int socket_type, { - logmsg (LOG_ERR, _("%s: cannot stat socket: %s"), - url->string, strerror (errno)); + logfuncall ("stat", url->string, errno); return -1; @@ -153,4 +152,3 @@ create_socket (struct pies_url *url, int socket_type, { - logmsg (LOG_ERR, _("%s: cannot unlink: %s"), - url->path, strerror (errno)); + logfuncall ("unlink", url->path, errno); return -1; @@ -206,4 +204,3 @@ create_socket (struct pies_url *url, int socket_type, { - logmsg (LOG_ERR, _("%s: cannot create socket: %s"), - url->string, strerror (errno)); + logfuncall ("socket", url->string, errno); return -1; @@ -216,3 +213,3 @@ create_socket (struct pies_url *url, int socket_type, { - logmsg (LOG_ERR, _("%s: set reuseaddr failed (%s)"), + logmsg (LOG_ERR, _("%s: set reuseaddr failed: %s"), url->string, strerror (errno)); @@ -230,2 +227,4 @@ create_socket (struct pies_url *url, int socket_type, rc = bind (fd, &addr.sa, socklen); + if (rc < 0) + logfuncall ("bind", NULL, errno); if (switch_back) @@ -234,4 +233,2 @@ create_socket (struct pies_url *url, int socket_type, { - logmsg (LOG_ERR, _("%s: cannot bind: %s"), - url->string, strerror (errno)); close (fd); @@ -356,4 +353,3 @@ pass_fd (const char *socket_name, int fd, unsigned maxtime) } - logmsg (LOG_ERR, _("%s: connect failed: %s"), - socket_name, strerror (errno)); + logfuncall ("connect", socket_name, errno); break; @@ -380,3 +376,3 @@ pass_fd (const char *socket_name, int fd, unsigned maxtime) continue; - logmsg (LOG_ERR, _("select failed: %s"), strerror (errno)); + logfuncall ("select", NULL, errno); break; diff --git a/src/sysvinit.c b/src/sysvinit.c index cc26fa9..6bc918c 100644 --- a/src/sysvinit.c +++ b/src/sysvinit.c @@ -881,3 +881,3 @@ telinit (const char *arg) { - logmsg (LOG_ERR, _("can't open %s: %s"), init_fifo, strerror (errno)); + logmsg (LOG_ERR, _("cannot open %s: %s"), init_fifo, strerror (errno)); exit (EX_UNAVAILABLE); @@ -1175,7 +1175,6 @@ sysvinit_power (void) if (unlink (power_stat_file)) - logmsg (LOG_ERR, _("can't unlink %s: %s"), power_stat_file, - strerror (errno)); + logfuncall ("unlink", power_stat_file, errno); } else - debug (1, (_("can't open %s: %s"), power_stat_file, strerror (errno))); + debug (1, (_("cannot open %s: %s"), power_stat_file, strerror (errno))); |