diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-09-25 12:05:53 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-09-25 12:08:37 +0300 |
commit | c42bddb0b814375bf68db9ee17fb77b888befaaa (patch) | |
tree | 59ebcee54825c589bf394ff62f8811d34f42370f /comsat | |
parent | 3c21c6583253be9edfd9e4c1e1fc6c07726be499 (diff) | |
download | mailutils-c42bddb0b814375bf68db9ee17fb77b888befaaa.tar.gz mailutils-c42bddb0b814375bf68db9ee17fb77b888befaaa.tar.bz2 |
Minor changes.
* am/debug.m4 (MU_DEBUG_MODE): Rewrite. Use -Wdeclaration-after-statement
if supported.
* comsat/oldcfg.c: Remove.
* comsat/Makefile.am (comsatd_SOURCES): Remove oldcfg.c.
* comsat/comsat.c: Remove the obsolete --config and --convert-config options.
* comsat/comsat.h (convert_config): Remove.
Diffstat (limited to 'comsat')
-rw-r--r-- | comsat/Makefile.am | 2 | ||||
-rw-r--r-- | comsat/comsat.c | 30 | ||||
-rw-r--r-- | comsat/comsat.h | 1 | ||||
-rw-r--r-- | comsat/oldcfg.c | 112 |
4 files changed, 1 insertions, 144 deletions
diff --git a/comsat/Makefile.am b/comsat/Makefile.am index bd008317f..e218e65c3 100644 --- a/comsat/Makefile.am +++ b/comsat/Makefile.am @@ -22,7 +22,7 @@ INCLUDES = @MU_APP_COMMON_INCLUDES@ sbin_PROGRAMS = comsatd -comsatd_SOURCES = action.c comsat.c comsat.h oldcfg.c +comsatd_SOURCES = action.c comsat.c comsat.h AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" comsatd_LDADD = \ diff --git a/comsat/comsat.c b/comsat/comsat.c index ca11efef5..4ec589b55 100644 --- a/comsat/comsat.c +++ b/comsat/comsat.c @@ -63,9 +63,6 @@ static char args_doc[] = N_("\n--test MBOX-URL MSG-QID"); static struct argp_option options[] = { - { "config", 'c', N_("FILE"), OPTION_HIDDEN, "", 0 }, - { "convert-config", 'C', N_("FILE"), 0, - N_("convert the configuration FILE to new format"), 0 }, { "test", 't', NULL, 0, N_("run in test mode"), 0 }, { "foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), 0}, { "inetd", 'i', 0, 0, N_("run in inetd mode"), 0 }, @@ -151,33 +148,6 @@ comsatd_parse_opt (int key, char *arg, struct argp_state *state) switch (key) { - case 'c': - { - char *cfg; - int fd; - FILE *fp; - - mu_diag_output (MU_DIAG_WARNING, -_("The old configuration file format and the --config command\n" - "line option are deprecated and will be removed in the future\n" - "release. Please use --convert-config option to convert your\n" - "settings to the new format.")); - /* FIXME: Refer to the docs */ - - fd = mu_tempfile (NULL, &cfg); - fp = fdopen (fd, "w"); - convert_config (arg, fp); - fclose (fp); - mu_get_config (cfg, mu_program_name, comsat_cfg_param, 0, NULL); - unlink (cfg); - free (cfg); - } - break; - - case 'C': - convert_config (arg, stdout); - exit (0); - case 'd': mu_argp_node_list_new (lst, "mode", "daemon"); if (arg) diff --git a/comsat/comsat.h b/comsat/comsat.h index d2a932c36..b9e9a0bb8 100644 --- a/comsat/comsat.h +++ b/comsat/comsat.h @@ -79,5 +79,4 @@ extern char hostname[]; extern struct daemon_param daemon_param; void run_user_action (FILE *tty, const char *cr, mu_message_t msg); -void convert_config (const char *config_file, FILE *outfile); diff --git a/comsat/oldcfg.c b/comsat/oldcfg.c deleted file mode 100644 index c46cf3aea..000000000 --- a/comsat/oldcfg.c +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of GNU Mailutils. - Copyright (C) 1998, 2001, 2002, 2005, 2007, 2009, 2010 Free Software - Foundation, Inc. - - 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 3, or (at your option) - any later version. - - 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 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 GNU Mailutils; see the file COPYING. If not, write - to the Free Software Foundation, Inc., 51 Franklin Street, - Fifth Floor, Boston, MA 02110-1301 USA. */ - -#include "comsat.h" - -static int -print_and_free_acl (void *item, void *data) -{ - FILE *outfile = data; - char **argv = item; - - fprintf (outfile, " %s from %s;\n", argv[1], argv[2]); - mu_argv_free (argv); - return 0; -} - -void -convert_config (const char *config_file, FILE *outfile) -{ - FILE *fp; - int line; - char buf[128]; - char *ptr; - mu_list_t aclist = NULL; - - if (!config_file) - return; - - fp = fopen (config_file, "r"); - if (!fp) - { - mu_error (_("cannot open config file %s: %s"), config_file, - mu_strerror (errno)); - return; - } - - fprintf (outfile, - "# Configuration file for GNU comsatd, converted from %s\n", - config_file); - fprintf (outfile, - "# Copy it to the comsatd configuration file\n"); - fprintf (outfile, - "# or to %s/mailutils.rc, in section `program %s'\n\n", - SYSCONFDIR, mu_program_name); - - line = 0; - while ((ptr = fgets (buf, sizeof buf, fp))) - { - int len; - int argc; - char **argv; - - line++; - len = strlen (ptr); - if (len > 0 && ptr[len-1] == '\n') - ptr[--len] = 0; - - while (*ptr && mu_isblank (*ptr)) - ptr++; - if (!*ptr || *ptr == '#') - { - fprintf (outfile, "%s\n", ptr); - continue; - } - - mu_argcv_get (ptr, "", NULL, &argc, &argv); - if (argc < 2) - { - mu_error (_("%s:%d: too few fields"), config_file, line); - mu_argcv_free (argc, argv); - continue; - } - - if (strcmp (argv[0], "acl") == 0) - { - if (!aclist) - mu_list_create (&aclist); - mu_list_append (aclist, argv); - } - else - { - mu_argcv_free (argc, argv); - fprintf (outfile, "%s;\n", ptr); - } - } - fclose (fp); - - if (aclist) - { - fprintf (outfile, "acl {\n"); - mu_list_do (aclist, print_and_free_acl, outfile); - fprintf (outfile, "};\n"); - mu_list_destroy (&aclist); - } -} - |