Commit c42bddb0 c42bddb0b814375bf68db9ee17fb77b888befaaa by Sergey Poznyakoff

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.
1 parent 3c21c658
...@@ -16,19 +16,26 @@ dnl ...@@ -16,19 +16,26 @@ dnl
16 AC_DEFUN([MU_DEBUG_MODE], 16 AC_DEFUN([MU_DEBUG_MODE],
17 [AC_ARG_ENABLE(debug, 17 [AC_ARG_ENABLE(debug,
18 AC_HELP_STRING([--enable-debug], [enable debugging mode]), 18 AC_HELP_STRING([--enable-debug], [enable debugging mode]),
19 [if test x"$enableval" = xyes; then 19 [mu_debug_mode=$enableval],
20 if test x"$GCC" = xyes; then 20 [mu_debug_mode=maybe])
21 AC_MSG_CHECKING([whether gcc accepts -ggdb]) 21
22 save_CFLAGS=$CFLAGS 22 save_CC=$CC
23 CFLAGS="-ggdb -Wall" 23 CC="$CC -Wall"
24 AC_TRY_COMPILE([],void f(){}, 24 AC_TRY_COMPILE([],[void main(){}],
25 AC_MSG_RESULT(yes), 25 [CFLAGS="$CFLAGS -Wall"])
26 [if test x"$ac_cv_prog_cc_g" = xyes; then 26
27 CFLAGS="-g -Wall" 27 CC="$CC -Wdeclaration-after-statement"
28 else 28 AC_TRY_COMPILE([],[void main(){}],
29 CFLAGS= 29 [CFLAGS="$CFLAGS -Wdeclaration-after-statement"])
30 fi 30
31 AC_MSG_RESULT(no)]) 31 if test "$mu_debug_mode" != no; then
32 CFLAGS="`echo $save_CFLAGS | sed 's/-O[[0-9]]//g'` $CFLAGS" 32 CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//g'`
33 AC_MSG_CHECKING([whether cc accepts -ggdb])
34 CC="$CC -ggdb"
35 AC_TRY_COMPILE([],[void main(){}],
36 [AC_MSG_RESULT(yes)
37 CFLAGS="$CFLAGS -ggdb"],
38 [AC_MSG_RESULT(no)
39 CFLAGS="$CFLAGS -g"])
33 fi 40 fi
34 fi])]) 41 CC=$save_CC])
......
...@@ -22,7 +22,7 @@ INCLUDES = @MU_APP_COMMON_INCLUDES@ ...@@ -22,7 +22,7 @@ INCLUDES = @MU_APP_COMMON_INCLUDES@
22 22
23 sbin_PROGRAMS = comsatd 23 sbin_PROGRAMS = comsatd
24 24
25 comsatd_SOURCES = action.c comsat.c comsat.h oldcfg.c 25 comsatd_SOURCES = action.c comsat.c comsat.h
26 AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" 26 AM_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
27 27
28 comsatd_LDADD = \ 28 comsatd_LDADD = \
......
...@@ -63,9 +63,6 @@ static char args_doc[] = N_("\n--test MBOX-URL MSG-QID"); ...@@ -63,9 +63,6 @@ static char args_doc[] = N_("\n--test MBOX-URL MSG-QID");
63 63
64 static struct argp_option options[] = 64 static struct argp_option options[] =
65 { 65 {
66 { "config", 'c', N_("FILE"), OPTION_HIDDEN, "", 0 },
67 { "convert-config", 'C', N_("FILE"), 0,
68 N_("convert the configuration FILE to new format"), 0 },
69 { "test", 't', NULL, 0, N_("run in test mode"), 0 }, 66 { "test", 't', NULL, 0, N_("run in test mode"), 0 },
70 { "foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), 0}, 67 { "foreground", OPT_FOREGROUND, 0, 0, N_("remain in foreground"), 0},
71 { "inetd", 'i', 0, 0, N_("run in inetd mode"), 0 }, 68 { "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) ...@@ -151,33 +148,6 @@ comsatd_parse_opt (int key, char *arg, struct argp_state *state)
151 148
152 switch (key) 149 switch (key)
153 { 150 {
154 case 'c':
155 {
156 char *cfg;
157 int fd;
158 FILE *fp;
159
160 mu_diag_output (MU_DIAG_WARNING,
161 _("The old configuration file format and the --config command\n"
162 "line option are deprecated and will be removed in the future\n"
163 "release. Please use --convert-config option to convert your\n"
164 "settings to the new format."));
165 /* FIXME: Refer to the docs */
166
167 fd = mu_tempfile (NULL, &cfg);
168 fp = fdopen (fd, "w");
169 convert_config (arg, fp);
170 fclose (fp);
171 mu_get_config (cfg, mu_program_name, comsat_cfg_param, 0, NULL);
172 unlink (cfg);
173 free (cfg);
174 }
175 break;
176
177 case 'C':
178 convert_config (arg, stdout);
179 exit (0);
180
181 case 'd': 151 case 'd':
182 mu_argp_node_list_new (lst, "mode", "daemon"); 152 mu_argp_node_list_new (lst, "mode", "daemon");
183 if (arg) 153 if (arg)
......
...@@ -79,5 +79,4 @@ extern char hostname[]; ...@@ -79,5 +79,4 @@ extern char hostname[];
79 extern struct daemon_param daemon_param; 79 extern struct daemon_param daemon_param;
80 80
81 void run_user_action (FILE *tty, const char *cr, mu_message_t msg); 81 void run_user_action (FILE *tty, const char *cr, mu_message_t msg);
82 void convert_config (const char *config_file, FILE *outfile);
83 82
......
1 /* This file is part of GNU Mailutils.
2 Copyright (C) 1998, 2001, 2002, 2005, 2007, 2009, 2010 Free Software
3 Foundation, Inc.
4
5 GNU Mailutils is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 GNU Mailutils is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNU Mailutils; see the file COPYING. If not, write
17 to the Free Software Foundation, Inc., 51 Franklin Street,
18 Fifth Floor, Boston, MA 02110-1301 USA. */
19
20 #include "comsat.h"
21
22 static int
23 print_and_free_acl (void *item, void *data)
24 {
25 FILE *outfile = data;
26 char **argv = item;
27
28 fprintf (outfile, " %s from %s;\n", argv[1], argv[2]);
29 mu_argv_free (argv);
30 return 0;
31 }
32
33 void
34 convert_config (const char *config_file, FILE *outfile)
35 {
36 FILE *fp;
37 int line;
38 char buf[128];
39 char *ptr;
40 mu_list_t aclist = NULL;
41
42 if (!config_file)
43 return;
44
45 fp = fopen (config_file, "r");
46 if (!fp)
47 {
48 mu_error (_("cannot open config file %s: %s"), config_file,
49 mu_strerror (errno));
50 return;
51 }
52
53 fprintf (outfile,
54 "# Configuration file for GNU comsatd, converted from %s\n",
55 config_file);
56 fprintf (outfile,
57 "# Copy it to the comsatd configuration file\n");
58 fprintf (outfile,
59 "# or to %s/mailutils.rc, in section `program %s'\n\n",
60 SYSCONFDIR, mu_program_name);
61
62 line = 0;
63 while ((ptr = fgets (buf, sizeof buf, fp)))
64 {
65 int len;
66 int argc;
67 char **argv;
68
69 line++;
70 len = strlen (ptr);
71 if (len > 0 && ptr[len-1] == '\n')
72 ptr[--len] = 0;
73
74 while (*ptr && mu_isblank (*ptr))
75 ptr++;
76 if (!*ptr || *ptr == '#')
77 {
78 fprintf (outfile, "%s\n", ptr);
79 continue;
80 }
81
82 mu_argcv_get (ptr, "", NULL, &argc, &argv);
83 if (argc < 2)
84 {
85 mu_error (_("%s:%d: too few fields"), config_file, line);
86 mu_argcv_free (argc, argv);
87 continue;
88 }
89
90 if (strcmp (argv[0], "acl") == 0)
91 {
92 if (!aclist)
93 mu_list_create (&aclist);
94 mu_list_append (aclist, argv);
95 }
96 else
97 {
98 mu_argcv_free (argc, argv);
99 fprintf (outfile, "%s;\n", ptr);
100 }
101 }
102 fclose (fp);
103
104 if (aclist)
105 {
106 fprintf (outfile, "acl {\n");
107 mu_list_do (aclist, print_and_free_acl, outfile);
108 fprintf (outfile, "};\n");
109 mu_list_destroy (&aclist);
110 }
111 }
112