Commit 3a91a69b 3a91a69baef99247b066e2c5ce4fce6bf739f1ac by Sergey Poznyakoff

Remove left over references to argp; other bugfixes

1 parent b48ac923
...@@ -248,12 +248,6 @@ mailutils-specific configuration options: ...@@ -248,12 +248,6 @@ mailutils-specific configuration options:
248 248
249 Use the GNU gettext library included in the Mailutils distribution. 249 Use the GNU gettext library included in the Mailutils distribution.
250 250
251 --with-included-argp
252
253 Use the argp library supplied with the package, instead of the
254 one from your libc. You will need this option if the libc library
255 on your system was compiled without NLS support.
256
257 The following options enable DBM support in Mailutils. DBM support is 251 The following options enable DBM support in Mailutils. DBM support is
258 necessary if you wish to use APOP authentication in POP3 daemon or to 252 necessary if you wish to use APOP authentication in POP3 daemon or to
259 use DBM-based mail box quotas with maildag. 253 use DBM-based mail box quotas with maildag.
......
...@@ -63,12 +63,7 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\ ...@@ -63,12 +63,7 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
63 --flag=mu_cfg_format_error:3:c-format\\\ 63 --flag=mu_cfg_format_error:3:c-format\\\
64 --flag=ali_parse_error:1:c-format\\\ 64 --flag=ali_parse_error:1:c-format\\\
65 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\ 65 --flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\
66 --flag=argp_error:2:c-format\\\ 66 --flag=mu_parseopt_error:2:c-format\\\
67 --flag=__argp_error:2:c-format\\\
68 --flag=argp_failure:4:c-format\\\
69 --flag=__argp_failure:4:c-format\\\
70 --flag=argp_fmtstream_printf:2:c-format\\\
71 --flag=__argp_fmtstream_printf:2:c-format\\\
72 ' 67 '
73 68
74 # Gettext supplies these files, but we don't need them since 69 # Gettext supplies these files, but we don't need them since
......
...@@ -49,7 +49,6 @@ AC_SUBST(MU_LIB_POP) ...@@ -49,7 +49,6 @@ AC_SUBST(MU_LIB_POP)
49 AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la') 49 AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la')
50 AC_SUBST(MU_LIB_SCM) 50 AC_SUBST(MU_LIB_SCM)
51 AC_SUBST(MU_LIB_CPP) 51 AC_SUBST(MU_LIB_CPP)
52 AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la')
53 AC_SUBST(MU_LIB_PY) 52 AC_SUBST(MU_LIB_PY)
54 53
55 dnl Other variables 54 dnl Other variables
...@@ -70,7 +69,7 @@ AC_SUBST(MU_APP_LIBRARIES,'${top_builddir}/lib/libmuaux.la') ...@@ -70,7 +69,7 @@ AC_SUBST(MU_APP_LIBRARIES,'${top_builddir}/lib/libmuaux.la')
70 69
71 AC_SUBST(MU_LIB_COMMON_INCLUDES,'-I${top_builddir} -I${top_srcdir}/include -I${top_builddir}/include') 70 AC_SUBST(MU_LIB_COMMON_INCLUDES,'-I${top_builddir} -I${top_srcdir}/include -I${top_builddir}/include')
72 71
73 AC_SUBST(MU_APP_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_srcdir}/lib/gnu -I${top_builddir}/lib/gnu -I${top_builddir} -I${top_builddir}/include -I${top_srcdir}/libmu_argp -I${top_srcdir}/libmu_cfg') 72 AC_SUBST(MU_APP_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_srcdir}/lib/gnu -I${top_builddir}/lib/gnu -I${top_builddir} -I${top_builddir}/include')
74 73
75 dnl Check for programs 74 dnl Check for programs
76 AC_PROG_CC 75 AC_PROG_CC
...@@ -125,13 +124,6 @@ AH_BOTTOM([ ...@@ -125,13 +124,6 @@ AH_BOTTOM([
125 AC_SUBST(MU_LINK_POSTFLAGS,[`for opt in $LTLIBICONV; do case $opt in -[[lL]]*) echo $opt;; esac; done|tr '\n' ' '`]) 124 AC_SUBST(MU_LINK_POSTFLAGS,[`for opt in $LTLIBICONV; do case $opt in -[[lL]]*) echo $opt;; esac; done|tr '\n' ' '`])
126 125
127 126
128 dnl Escape defuns that force automake to add their arguments
129 dnl to LIBOBJS.
130 dnl All dependencies has been handled by gnulib-sync.
131
132 AC_DEFINE([GNULIB_ARGP_EXTERN_BASENAME],1,
133 [Define to use our own version of __argp_base_name])
134
135 # Check for large file support 127 # Check for large file support
136 AC_SYS_LARGEFILE 128 AC_SYS_LARGEFILE
137 129
......
...@@ -177,7 +177,7 @@ static struct mu_cli_setup cli = { ...@@ -177,7 +177,7 @@ static struct mu_cli_setup cli = {
177 N_("[URL ...]"), 177 N_("[URL ...]"),
178 }; 178 };
179 179
180 static char *frm_argp_capa[] = { 180 static char *capa[] = {
181 "debug", 181 "debug",
182 "mailbox", 182 "mailbox",
183 "locking", 183 "locking",
...@@ -328,7 +328,7 @@ main (int argc, char **argv) ...@@ -328,7 +328,7 @@ main (int argc, char **argv)
328 mu_register_all_mbox_formats (); 328 mu_register_all_mbox_formats ();
329 329
330 mu_auth_register_module (&mu_auth_tls_module); 330 mu_auth_register_module (&mu_auth_tls_module);
331 mu_cli (argc, argv, &cli, frm_argp_capa, NULL, &argc, &argv); 331 mu_cli (argc, argv, &cli, capa, NULL, &argc, &argv);
332 332
333 if (align && (s = util_getcols ())) 333 if (align && (s = util_getcols ()))
334 init_output (s); 334 init_output (s);
......
1 Makefile 1 Makefile
2 Makefile.in 2 Makefile.in
3 getopt.h 3 getopt.h
4 argp.h
5 regex.h 4 regex.h
6 posix 5 posix
7 posix/regex.h 6 posix/regex.h
......
...@@ -234,16 +234,20 @@ int ...@@ -234,16 +234,20 @@ int
234 mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type, 234 mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type,
235 const void *key) 235 const void *key)
236 { 236 {
237 enum mu_auth_mode mode;
238
237 if (!mu_getpw_modules) 239 if (!mu_getpw_modules)
238 mu_auth_begin_setup (); 240 mu_auth_begin_setup ();
239 switch (type) 241 switch (type)
240 { 242 {
241 case mu_auth_key_name: 243 case mu_auth_key_name:
244 mode = mu_auth_getpwnam;
242 mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1, 245 mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1,
243 ("Getting auth info for user %s", (char*) key)); 246 ("Getting auth info for user %s", (char*) key));
244 break; 247 break;
245 248
246 case mu_auth_key_uid: 249 case mu_auth_key_uid:
250 mode = mu_auth_getpwuid;
247 mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1, 251 mu_debug (MU_DEBCAT_AUTH, MU_DEBUG_TRACE1,
248 ("Getting auth info for UID %lu", 252 ("Getting auth info for UID %lu",
249 (unsigned long) *(uid_t*) key)); 253 (unsigned long) *(uid_t*) key));
...@@ -254,7 +258,7 @@ mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type, ...@@ -254,7 +258,7 @@ mu_get_auth (struct mu_auth_data **auth, enum mu_auth_key_type type,
254 ("Unknown mu_auth_key_type: %d", type)); 258 ("Unknown mu_auth_key_type: %d", type));
255 return EINVAL; 259 return EINVAL;
256 } 260 }
257 return mu_auth_runlist (mu_getpw_modules, type, key, NULL, auth); 261 return mu_auth_runlist (mu_getpw_modules, mode, key, NULL, auth);
258 } 262 }
259 263
260 struct mu_auth_data * 264 struct mu_auth_data *
...@@ -289,7 +293,7 @@ mu_authenticate (struct mu_auth_data *auth_data, const char *pass) ...@@ -289,7 +293,7 @@ mu_authenticate (struct mu_auth_data *auth_data, const char *pass)
289 mu_auth_begin_setup (); 293 mu_auth_begin_setup ();
290 return mu_auth_runlist (mu_auth_modules, 294 return mu_auth_runlist (mu_auth_modules,
291 mu_auth_authenticate, 295 mu_auth_authenticate,
292 auth_data, pass, NULL); 296 auth_data, (void *) pass, NULL);
293 } 297 }
294 298
295 299
...@@ -434,7 +438,7 @@ mu_authentication_clear_list () ...@@ -434,7 +438,7 @@ mu_authentication_clear_list ()
434 2) --authentication and --authorization modify only temporary lists, 438 2) --authentication and --authorization modify only temporary lists,
435 which get flushed to the main ones when mu_auth_finish_setup() is 439 which get flushed to the main ones when mu_auth_finish_setup() is
436 run. Thus, the default "generic:system" remain in force until 440 run. Thus, the default "generic:system" remain in force until
437 argp_parse() exits. */ 441 mu_cli_ext exits. */
438 442
439 void 443 void
440 mu_auth_begin_setup (void) 444 mu_auth_begin_setup (void)
......
...@@ -38,7 +38,7 @@ mu_set_program_name (const char *arg) ...@@ -38,7 +38,7 @@ mu_set_program_name (const char *arg)
38 if (p) 38 if (p)
39 ++p; 39 ++p;
40 else 40 else
41 p = (char*) arg; 41 p = (char*) mu_full_program_name;
42 if (strlen (p) > 3 && memcmp (p, "lt-", 3) == 0) 42 if (strlen (p) > 3 && memcmp (p, "lt-", 3) == 0)
43 p += 3; 43 p += 3;
44 free (mu_program_name); 44 free (mu_program_name);
......
...@@ -117,32 +117,39 @@ bootstrap_destroy (struct _mu_stream *str) ...@@ -117,32 +117,39 @@ bootstrap_destroy (struct _mu_stream *str)
117 117
118 /* Standard I/O streams: */ 118 /* Standard I/O streams: */
119 static struct _mu_file_stream stdstream[2] = { 119 static struct _mu_file_stream stdstream[2] = {
120 { { ref_count: 1, 120 { .stream = {
121 buftype: mu_buffer_none, 121 .ref_count = 1,
122 flags: MU_STREAM_READ, 122 .buftype = mu_buffer_none,
123 destroy: bootstrap_destroy, 123 .flags = MU_STREAM_READ,
124 event_cb: std_bootstrap, 124 .destroy = bootstrap_destroy,
125 event_mask: _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP) 125 .event_cb = std_bootstrap,
126 }, fd: MU_STDIN_FD, filename: "<stdin>", 126 .event_mask = _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP)
127 flags: _MU_FILE_STREAM_FD_BORROWED|_MU_FILE_STREAM_STATIC_FILENAME }, 127 },
128 { { ref_count: 1, 128 .fd = MU_STDIN_FD,
129 buftype: mu_buffer_none, 129 .filename = "<stdin>",
130 flags: MU_STREAM_WRITE, 130 .flags = _MU_FILE_STREAM_FD_BORROWED|_MU_FILE_STREAM_STATIC_FILENAME },
131 destroy: bootstrap_destroy, 131 { .stream = {
132 event_cb: std_bootstrap, 132 .ref_count = 1,
133 event_mask: _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP) 133 .buftype = mu_buffer_none,
134 }, fd: MU_STDOUT_FD, filename: "<stdout>", 134 .flags = MU_STREAM_WRITE,
135 flags: _MU_FILE_STREAM_FD_BORROWED|_MU_FILE_STREAM_STATIC_FILENAME } 135 .destroy = bootstrap_destroy,
136 .event_cb = std_bootstrap,
137 .event_mask = _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP)
138 },
139 .fd = MU_STDOUT_FD,
140 .filename = "<stdout>",
141 .flags = _MU_FILE_STREAM_FD_BORROWED|_MU_FILE_STREAM_STATIC_FILENAME }
136 }; 142 };
137 143
138 /* Standard error stream: */ 144 /* Standard error stream: */
139 static struct _mu_log_stream default_strerr = { 145 static struct _mu_log_stream default_strerr = {
140 { ref_count: 1, 146 .base = {
141 buftype: mu_buffer_none, 147 .ref_count = 1,
142 flags: MU_STREAM_WRITE, 148 .buftype = mu_buffer_none,
143 destroy: bootstrap_destroy, 149 .flags = MU_STREAM_WRITE,
144 event_cb: std_log_bootstrap, 150 .destroy = bootstrap_destroy,
145 event_mask: _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP) 151 .event_cb = std_log_bootstrap,
152 .event_mask = _MU_STR_EVMASK (_MU_STR_EVENT_BOOTSTRAP)
146 } 153 }
147 }; 154 };
148 155
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 #include <pick.h> 21 #include <pick.h>
22 22
23 static node_t *pick_node_create (node_type type, void *a, void *b); 23 static node_t *pick_node_create (node_type type, void *a, void *b);
24 static void set_cflags (char *str); 24 static void set_cflags (char const *str);
25 25
26 static regex_t * 26 static regex_t *
27 regex_dup (regex_t *re) 27 regex_dup (regex_t *re)
...@@ -248,7 +248,7 @@ pick_add_token (mu_list_t *list, int tok, char const *val) ...@@ -248,7 +248,7 @@ pick_add_token (mu_list_t *list, int tok, char const *val)
248 } 248 }
249 tp = mu_alloc (sizeof (*tp)); 249 tp = mu_alloc (sizeof (*tp));
250 tp->tok = tok; 250 tp->tok = tok;
251 tp->val = val; 251 tp->val = (char*) val;
252 mu_list_append (*list, tp); 252 mu_list_append (*list, tp);
253 } 253 }
254 254
...@@ -410,7 +410,7 @@ pick_eval (mu_message_t msg) ...@@ -410,7 +410,7 @@ pick_eval (mu_message_t msg)
410 } 410 }
411 411
412 void 412 void
413 set_cflags (char *str) 413 set_cflags (char const *str)
414 { 414 {
415 reg_flags = 0; 415 reg_flags = 0;
416 for (; *str; str++) 416 for (; *str; str++)
......
...@@ -60,7 +60,6 @@ AC_DEFUN([AM_GNU_MAILUTILS], ...@@ -60,7 +60,6 @@ AC_DEFUN([AM_GNU_MAILUTILS],
60 do 60 do
61 case $x in 61 case $x in
62 mailer) test $MAILUTILS_VERSION_NUMBER -ge 1200 && req="$req $x";; 62 mailer) test $MAILUTILS_VERSION_NUMBER -ge 1200 && req="$req $x";;
63 cfg|argp) test $MAILUTILS_VERSION_NUMBER -ge 1290 && req="$req $x";;
64 *) req="$req $x" 63 *) req="$req $x"
65 esac 64 esac
66 done 65 done
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
20 #include <stdlib.h> 20 #include <stdlib.h>
21 #include <string.h> 21 #include <string.h>
22 #include <mailutils/mailutils.h> 22 #include <mailutils/mailutils.h>
23 #include "argp.h"
24 #include "mu.h" 23 #include "mu.h"
25 24
26 char filter_docstring[] = N_("apply a chain of filters to the input"); 25 char filter_docstring[] = N_("apply a chain of filters to the input");
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
29 #include <mailutils/imaputil.h> 29 #include <mailutils/imaputil.h>
30 #include <mailutils/msgset.h> 30 #include <mailutils/msgset.h>
31 #include "mu.h" 31 #include "mu.h"
32 #include "argp.h"
33 32
34 char imap_docstring[] = N_("IMAP4 client shell"); 33 char imap_docstring[] = N_("IMAP4 client shell");
35 34
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
25 #include <mailutils/cctype.h> 25 #include <mailutils/cctype.h>
26 #include <mailutils/mailutils.h> 26 #include <mailutils/mailutils.h>
27 #include <mailutils/smtp.h> 27 #include <mailutils/smtp.h>
28 #include <argp.h>
29 #include "mu.h" 28 #include "mu.h"
30 29
31 char smtp_docstring[] = N_("run a SMTP session"); 30 char smtp_docstring[] = N_("run a SMTP session");
......
...@@ -32,50 +32,22 @@ ...@@ -32,50 +32,22 @@
32 # include <config.h> 32 # include <config.h>
33 #endif 33 #endif
34 #include <mailutils/mailutils.h> 34 #include <mailutils/mailutils.h>
35 #include "argp.h"
36 #include "mu.h" 35 #include "mu.h"
37 36
38 #warning "Replace DESCRIPTION with a short description of this module."
39 static char FOO_doc[] = N_("mu FOO - DESCRIPTION");
40
41 #warning "Usually DESCRIPTION is the same text as the one used in FOO_doc." 37 #warning "Usually DESCRIPTION is the same text as the one used in FOO_doc."
42 char FOO_docstring[] = N_("DESCRIPTION"); 38 char FOO_docstring[] = N_("DESCRIPTION");
43 39
44 #warning "Edit ARGDOC or remove this variable if module does not take arguments" 40 #warning "Edit ARGDOC or remove this variable if module does not take arguments"
45 static char FOO_args_doc[] = N_("ARGDOC"); 41 static char FOO_args_doc[] = N_("ARGDOC");
46 42
47 static struct argp_option FOO_options[] = { 43 static struct mu_option FOO_options[] = {
48 { NULL } 44 { NULL }
49 }; 45 };
50 46
51 static error_t
52 FOO_parse_opt (int key, char *arg, struct argp_state *state)
53 {
54 switch (key)
55 {
56 default:
57 return ARGP_ERR_UNKNOWN;
58 }
59 return 0;
60 }
61
62 static struct argp FOO_argp = {
63 FOO_options,
64 FOO_parse_opt,
65 FOO_args_doc,
66 FOO_doc,
67 NULL,
68 NULL,
69 NULL
70 };
71
72 int 47 int
73 mutool_FOO (int argc, char **argv) 48 mutool_FOO (int argc, char **argv)
74 { 49 {
75 int index; 50 mu_action_getopt (&argc, &argv, FOO_options, FOO_docstring, FOO_args_doc);
76
77 if (argp_parse (&FOO_argp, argc, argv, ARGP_IN_ORDER, &index, NULL))
78 return 1;
79 #warning "Add the necessary functionality here" 51 #warning "Add the necessary functionality here"
80 return 0; 52 return 0;
81 } 53 }
......
...@@ -91,7 +91,7 @@ struct mu_cli_setup cli = { ...@@ -91,7 +91,7 @@ struct mu_cli_setup cli = {
91 NULL 91 NULL
92 }; 92 };
93 93
94 static char *readmsg_argp_capa[] = { 94 static char *readmsg_capa[] = {
95 "debug", 95 "debug",
96 "mailbox", 96 "mailbox",
97 "locking", 97 "locking",
...@@ -244,7 +244,7 @@ main (int argc, char **argv) ...@@ -244,7 +244,7 @@ main (int argc, char **argv)
244 244
245 mu_auth_register_module (&mu_auth_tls_module); 245 mu_auth_register_module (&mu_auth_tls_module);
246 246
247 mu_cli (argc, argv, &cli, readmsg_argp_capa, NULL, &argc, &argv); 247 mu_cli (argc, argv, &cli, readmsg_capa, NULL, &argc, &argv);
248 248
249 if (argc == 0) 249 if (argc == 0)
250 { 250 {
......
...@@ -233,7 +233,7 @@ static struct mu_cfg_param sieve_cfg_param[] = { ...@@ -233,7 +233,7 @@ static struct mu_cfg_param sieve_cfg_param[] = {
233 }; 233 };
234 234
235 235
236 static char *sieve_argp_capa[] = { 236 static char *sieve_capa[] = {
237 "debug", 237 "debug",
238 "mailbox", 238 "mailbox",
239 "locking", 239 "locking",
...@@ -400,7 +400,7 @@ main (int argc, char *argv[]) ...@@ -400,7 +400,7 @@ main (int argc, char *argv[])
400 400
401 mu_register_all_formats (); 401 mu_register_all_formats ();
402 402
403 mu_cli (argc, argv, &cli, sieve_argp_capa, NULL, &argc, &argv); 403 mu_cli (argc, argv, &cli, sieve_capa, NULL, &argc, &argv);
404 404
405 if (argc == 0) 405 if (argc == 0)
406 { 406 {
......