Commit 652afe9a 652afe9a09cc20a21695f0dbdbfc5121a6daf555 by Sergey Poznyakoff

* configure.ac (VI_CURRENT): Raise to 3;

(MU_APP_LIBRARIES): Rename libargp.a to libmuargp.a
* NEWS: Update.

* comsat/comsat.c, dotlock/dotlock.c, examples/muauth.c,
examples/muemail.c, frm/frm.h, guimb/main.c, imap4d/imap4d.c,
libargp/auth.c, libargp/cmdline.c, libargp/common.c,
libargp/gsasl.c, libargp/mu_argp.c, libargp/pam.c,
libargp/radius.c, libargp/sieve.c, libargp/sql.c, libargp/tls.c,
libargp/virtdomain.c, maidag/maidag.h, mail/mail.c,
mail.local/main.c, mail.remote/mail.remote.c, messages/messages.c,
mimeview/mimetypes.y, mimeview/mimeview.c, movemail/movemail.c,
pop3d/extra.c, pop3d/pop3d.c, pop3d/popauth.c, readmsg/readmsg.c,
sieve/sieve.c: Include mailutils/libargp.h.

* config/mailutils-config.c: New arguments to --link: cfg and argp.

* include/mailutils/Makefile.am (pkginclude_HEADERS): Remove
compat.h, add libargp.h, libcfg.h and version.h
* include/mailutils/compat.h: Remove
* include/mailutils/libargp.h: New file (from libargp/cmdline.h)
* include/mailutils/libcfg.h: New file (from (libcfg/)
* include/mailutils/version.h: New file

* include/mailutils/folder.h (struct mu_0_6_folder_list): Remove
(mu_0_6_folder_list, mu_0_6_folder_lsub)
(mu_0_6_folder_list_destroy): Remove.

* include/mailutils/mailutils.h: Include version.h
Remove 0.6 compatibility layer.
* mailbox/folder.c (list_to_0_6_folder_list, mu_0_6_folder_list)
(mu_0_6_folder_lsub, mu_0_6_folder_list_destroy): Remove.

* lib/Makefile.am (libmuaux_la_SOURCES): Remove argpinit.c,
muinit.h and muinit.c

* libargp/Makefile.am (noinst_LIBRARIES, noinst_HEADERS): Remove
(lib_LIBRARIES): Add libmuargp.a
* libargp/compat.c: New file.
* libargp/muinit.c: New file.
* libargp/cmdline.h: Remove.

* libcfg/Makefile.am (noinst_HEADERS): Remove.
* libcfg/auth.c, libcfg/common.c, libcfg/gsasl.c, libcfg/init.c,
libcfg/pam.c, libcfg/radius.c, libcfg/sieve.c, libcfg/sql.c,
libcfg/tls.c, libcfg/virtdomain.c: Include mailutils/libcfg.h

* mailbox/Makefile.am (libmailutils_la_SOURCES): Add version.c
* mailbox/cfg_lexer.c (_mu_parse_config): Do nothing if
root_container is NULL.

* mh/ali.c, mh/anno.c, mh/burst.c, mh/comp.c, mh/fmtcheck.c,
mh/folder.c, mh/forw.c, mh/inc.c, mh/install-mh.c, mh/mark.c,
mh/mhl.c, mh/mhn.c, mh/mhparam.c, mh/mhpath.c, mh/pick.c,
mh/refile.c, mh/repl.c, mh/rmf.c, mh/rmm.c, mh/scan.c, mh/send.c,
mh/sortm.c, mh/whatnow.c, mh/whom.c: Use mh_argp_init instead of
mu_argp_init.
* mh/mh_argp.c, mh/mh_getopt.h (mh_argp_init): New function
1 parent 701c0182
Showing 88 changed files with 741 additions and 366 deletions
1 2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 * configure.ac (VI_CURRENT): Raise to 3;
4 (MU_APP_LIBRARIES): Rename libargp.a to libmuargp.a
5 * NEWS: Update.
6
7 * comsat/comsat.c, dotlock/dotlock.c, examples/muauth.c,
8 examples/muemail.c, frm/frm.h, guimb/main.c, imap4d/imap4d.c,
9 libargp/auth.c, libargp/cmdline.c, libargp/common.c,
10 libargp/gsasl.c, libargp/mu_argp.c, libargp/pam.c,
11 libargp/radius.c, libargp/sieve.c, libargp/sql.c, libargp/tls.c,
12 libargp/virtdomain.c, maidag/maidag.h, mail/mail.c,
13 mail.local/main.c, mail.remote/mail.remote.c, messages/messages.c,
14 mimeview/mimetypes.y, mimeview/mimeview.c, movemail/movemail.c,
15 pop3d/extra.c, pop3d/pop3d.c, pop3d/popauth.c, readmsg/readmsg.c,
16 sieve/sieve.c: Include mailutils/libargp.h.
17
18 * config/mailutils-config.c: New arguments to --link: cfg and argp.
19
20 * include/mailutils/Makefile.am (pkginclude_HEADERS): Remove
21 compat.h, add libargp.h, libcfg.h and version.h
22 * include/mailutils/compat.h: Remove
23 * include/mailutils/libargp.h: New file (from libargp/cmdline.h)
24 * include/mailutils/libcfg.h: New file (from (libcfg/)
25 * include/mailutils/version.h: New file
26
27 * include/mailutils/folder.h (struct mu_0_6_folder_list): Remove
28 (mu_0_6_folder_list, mu_0_6_folder_lsub)
29 (mu_0_6_folder_list_destroy): Remove.
30
31 * include/mailutils/mailutils.h: Include version.h
32 Remove 0.6 compatibility layer.
33 * mailbox/folder.c (list_to_0_6_folder_list, mu_0_6_folder_list)
34 (mu_0_6_folder_lsub, mu_0_6_folder_list_destroy): Remove.
35
36 * lib/Makefile.am (libmuaux_la_SOURCES): Remove argpinit.c,
37 muinit.h and muinit.c
38
39 * libargp/Makefile.am (noinst_LIBRARIES, noinst_HEADERS): Remove
40 (lib_LIBRARIES): Add libmuargp.a
41 * libargp/compat.c: New file.
42 * libargp/muinit.c: New file.
43 * libargp/cmdline.h: Remove.
44
45 * libcfg/Makefile.am (noinst_HEADERS): Remove.
46 * libcfg/auth.c, libcfg/common.c, libcfg/gsasl.c, libcfg/init.c,
47 libcfg/pam.c, libcfg/radius.c, libcfg/sieve.c, libcfg/sql.c,
48 libcfg/tls.c, libcfg/virtdomain.c: Include mailutils/libcfg.h
49
50 * mailbox/Makefile.am (libmailutils_la_SOURCES): Add version.c
51 * mailbox/cfg_lexer.c (_mu_parse_config): Do nothing if
52 root_container is NULL.
53
54 * mh/ali.c, mh/anno.c, mh/burst.c, mh/comp.c, mh/fmtcheck.c,
55 mh/folder.c, mh/forw.c, mh/inc.c, mh/install-mh.c, mh/mark.c,
56 mh/mhl.c, mh/mhn.c, mh/mhparam.c, mh/mhpath.c, mh/pick.c,
57 mh/refile.c, mh/repl.c, mh/rmf.c, mh/rmm.c, mh/scan.c, mh/send.c,
58 mh/sortm.c, mh/whatnow.c, mh/whom.c: Use mh_argp_init instead of
59 mu_argp_init.
60 * mh/mh_argp.c, mh/mh_getopt.h (mh_argp_init): New function
61
1 2007-11-18 Sergey Poznyakoff <gray@gnu.org.ua> 62 2007-11-18 Sergey Poznyakoff <gray@gnu.org.ua>
2 63
3 * bootstrap (cp_mark_as_generated): Create target directory if 64 * bootstrap (cp_mark_as_generated): Create target directory if
......
1 GNU mailutils NEWS -- history of user-visible changes. 2007-11-10 1 GNU mailutils NEWS -- history of user-visible changes. 2007-11-19
2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 2 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
3 See the end of file for copying conditions. 3 See the end of file for copying conditions.
4 4
...@@ -94,6 +94,8 @@ Previous versions incorrectly understood such an URL as `a/b' ...@@ -94,6 +94,8 @@ Previous versions incorrectly understood such an URL as `a/b'
94 94
95 * Fixed APOP handling. 95 * Fixed APOP handling.
96 96
97 * Remove v0.6 compatibility layer.
98
97 99
98 Version 1.2: 100 Version 1.2:
99 101
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include "comsat.h" 20 #include "comsat.h"
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 #ifndef PATH_DEV 23 #ifndef PATH_DEV
24 # define PATH_DEV "/dev" 24 # define PATH_DEV "/dev"
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 #include <string.h> 22 #include <string.h>
23 #include <mailutils/mailutils.h> 23 #include <mailutils/mailutils.h>
24 #include <mu_asprintf.h> 24 #include <mu_asprintf.h>
25 #include "muinit.h" 25 #include "mailutils/libargp.h"
26 26
27 const char *program_version = "mailutils-config (" PACKAGE_STRING ")"; 27 const char *program_version = "mailutils-config (" PACKAGE_STRING ")";
28 static char doc[] = N_("GNU mailutils-config -- Display compiler and loader options needed for building a program with mailutils"); 28 static char doc[] = N_("GNU mailutils-config -- Display compiler and loader options needed for building a program with mailutils");
...@@ -185,7 +185,7 @@ main (int argc, char **argv) ...@@ -185,7 +185,7 @@ main (int argc, char **argv)
185 int j; 185 int j;
186 char *ptr; 186 char *ptr;
187 187
188 add_entry (-1, LINK_FLAGS); 188 add_entry (-100, LINK_FLAGS);
189 add_entry (100, LINK_POSTFLAGS); 189 add_entry (100, LINK_POSTFLAGS);
190 add_entry (1, "-lmailutils"); 190 add_entry (1, "-lmailutils");
191 #ifdef ENABLE_NLS 191 #ifdef ENABLE_NLS
...@@ -205,6 +205,10 @@ main (int argc, char **argv) ...@@ -205,6 +205,10 @@ main (int argc, char **argv)
205 add_entry (-1, "-lmu_scm " GUILE_LIBS); 205 add_entry (-1, "-lmu_scm " GUILE_LIBS);
206 } 206 }
207 #endif 207 #endif
208 else if (strcmp (argv[0], "cfg") == 0)
209 add_entry (-1, "-lmucfg");
210 else if (strcmp (argv[0], "argp") == 0)
211 add_entry (-2, "-lmuargp");
208 else if (strcmp (argv[0], "all") == 0) 212 else if (strcmp (argv[0], "all") == 0)
209 { 213 {
210 struct lib_descr *p; 214 struct lib_descr *p;
......
...@@ -26,7 +26,7 @@ AC_CONFIG_HEADERS([config.h]) ...@@ -26,7 +26,7 @@ AC_CONFIG_HEADERS([config.h])
26 AC_PREREQ(2.60) 26 AC_PREREQ(2.60)
27 27
28 dnl Library versioning 28 dnl Library versioning
29 AC_SUBST(VI_CURRENT, 2) 29 AC_SUBST(VI_CURRENT, 3)
30 AC_SUBST(VI_REVISION, 2) 30 AC_SUBST(VI_REVISION, 2)
31 AC_SUBST(VI_AGE, 1) 31 AC_SUBST(VI_AGE, 1)
32 32
...@@ -50,7 +50,7 @@ dnl Other variables ...@@ -50,7 +50,7 @@ dnl Other variables
50 AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)') 50 AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)')
51 51
52 AC_SUBST(MU_COMMON_LIBRARIES,'$(LTLIBINTL) $(LTLIBICONV)') 52 AC_SUBST(MU_COMMON_LIBRARIES,'$(LTLIBINTL) $(LTLIBICONV)')
53 AC_SUBST(MU_APP_LIBRARIES,'../lib/libmuaux.la ../libargp/libargp.a -L${top_builddir}/libcfg -lmucfg') 53 AC_SUBST(MU_APP_LIBRARIES,'../lib/libmuaux.la ../libargp/libmuargp.a ../libcfg/libmucfg.la')
54 54
55 AC_SUBST(MU_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_builddir}/lib -I${top_builddir} -I${top_builddir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/libargp -I${top_srcdir}/libcfg') 55 AC_SUBST(MU_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_builddir}/lib -I${top_builddir} -I${top_builddir}/include -I${top_srcdir}/mailbox -I${top_srcdir}/libargp -I${top_srcdir}/libcfg')
56 56
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
31 #include <mailutils/locker.h> 31 #include <mailutils/locker.h>
32 #include <mailutils/nls.h> 32 #include <mailutils/nls.h>
33 33
34 #include "muinit.h" 34 #include "mailutils/libargp.h"
35 35
36 const char *program_version = "GNU dotlock (" PACKAGE_STRING ")"; 36 const char *program_version = "GNU dotlock (" PACKAGE_STRING ")";
37 static char doc[] = 37 static char doc[] =
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
25 #include <ctype.h> 25 #include <ctype.h>
26 #include <string.h> 26 #include <string.h>
27 #include <mailutils/mailutils.h> 27 #include <mailutils/mailutils.h>
28 #include "muinit.h" 28 #include "mailutils/libargp.h"
29 29
30 const char *program_version = "muauth (" PACKAGE_STRING ")"; 30 const char *program_version = "muauth (" PACKAGE_STRING ")";
31 static char doc[] = 31 static char doc[] =
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 #include <stdlib.h> 19 #include <stdlib.h>
20 #include <stdio.h> 20 #include <stdio.h>
21 #include <mailutils/mutil.h> 21 #include <mailutils/mutil.h>
22 #include "muinit.h" 22 #include "mailutils/libargp.h"
23 23
24 const char *capa[] = { 24 const char *capa[] = {
25 "address", 25 "address",
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
64 #include <mailutils/mutil.h> 64 #include <mailutils/mutil.h>
65 #include <mailutils/mime.h> 65 #include <mailutils/mime.h>
66 66
67 #include "muinit.h" 67 #include "mailutils/libargp.h"
68 68
69 typedef int (*frm_select_t) (size_t index, mu_message_t msg); 69 typedef int (*frm_select_t) (size_t index, mu_message_t msg);
70 70
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include "guimb.h" 20 #include "guimb.h"
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 char *program_file; 23 char *program_file;
24 char *program_expr; 24 char *program_expr;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 #ifdef WITH_GSASL 21 #ifdef WITH_GSASL
22 # include <mailutils/gsasl.h> 22 # include <mailutils/gsasl.h>
23 #endif 23 #endif
24 #include "muinit.h" 24 #include "mailutils/libargp.h"
25 25
26 mu_mailbox_t mbox; 26 mu_mailbox_t mbox;
27 char *homedir; 27 char *homedir;
......
...@@ -36,7 +36,6 @@ pkginclude_HEADERS = \ ...@@ -36,7 +36,6 @@ pkginclude_HEADERS = \
36 auth.h\ 36 auth.h\
37 body.h\ 37 body.h\
38 cfg.h\ 38 cfg.h\
39 compat.h\
40 daemon.h\ 39 daemon.h\
41 debug.h\ 40 debug.h\
42 envelope.h\ 41 envelope.h\
...@@ -49,6 +48,8 @@ pkginclude_HEADERS = \ ...@@ -49,6 +48,8 @@ pkginclude_HEADERS = \
49 guile.h\ 48 guile.h\
50 header.h\ 49 header.h\
51 iterator.h\ 50 iterator.h\
51 libargp.h\
52 libcfg.h\
52 libsieve.h\ 53 libsieve.h\
53 list.h\ 54 list.h\
54 locker.h\ 55 locker.h\
...@@ -77,7 +78,8 @@ pkginclude_HEADERS = \ ...@@ -77,7 +78,8 @@ pkginclude_HEADERS = \
77 syslog.h\ 78 syslog.h\
78 sql.h\ 79 sql.h\
79 tls.h\ 80 tls.h\
80 url.h 81 url.h\
82 version.h
81 83
82 nobase_pkginclude_HEADERS = \ 84 nobase_pkginclude_HEADERS = \
83 sys/nntp.h\ 85 sys/nntp.h\
......
...@@ -77,22 +77,6 @@ extern int mu_folder_decrement (mu_folder_t); ...@@ -77,22 +77,6 @@ extern int mu_folder_decrement (mu_folder_t);
77 77
78 extern void mu_list_response_free (void *data); 78 extern void mu_list_response_free (void *data);
79 79
80 /* Deprecated calls */
81 struct mu_0_6_folder_list
82 {
83 struct mu_list_response **element;
84 size_t num;
85 };
86
87 extern int mu_0_6_folder_list (mu_folder_t, const char *, const char *,
88 struct mu_0_6_folder_list *)
89 __attribute__((deprecated));
90 extern int mu_0_6_folder_lsub (mu_folder_t, const char *, const char *,
91 struct mu_0_6_folder_list *)
92 __attribute__((deprecated));
93 extern int mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *)
94 __attribute__((deprecated));
95
96 #ifdef __cplusplus 80 #ifdef __cplusplus
97 } 81 }
98 #endif 82 #endif
......
...@@ -17,20 +17,20 @@ ...@@ -17,20 +17,20 @@
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301 USA */ 18 Boston, MA 02110-1301 USA */
19 19
20 #ifndef _MAILUTILS_CMDLINE_H 20 #ifndef _MAILUTILS_LIBARGP_H
21 #define _MAILUTILS_CMDLINE_H 21 #define _MAILUTILS_LIBARGP_H
22 22
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26 #include "mailutils/types.h" 23 #include "mailutils/types.h"
27 #include "mailutils/gocs.h" 24 #include "mailutils/gocs.h"
28 #include "mailutils/nls.h" 25 #include "mailutils/nls.h"
29 #include "mailutils/error.h" 26 #include "mailutils/error.h"
30 #include "mailutils/errno.h" 27 #include "mailutils/errno.h"
28 #include "mailutils/version.h"
31 #include "argp.h" 29 #include "argp.h"
32 #include <errno.h> /* May declare program_invocation_name */ 30 #include "errno.h"
33 #include <strings.h> 31 #include "strings.h"
32
33 #include "mailutils/libcfg.h"
34 34
35 #ifdef __cplusplus 35 #ifdef __cplusplus
36 extern "C" { 36 extern "C" {
...@@ -103,8 +103,6 @@ extern struct mu_cmdline_capa mu_sql_cmdline; ...@@ -103,8 +103,6 @@ extern struct mu_cmdline_capa mu_sql_cmdline;
103 extern struct mu_cmdline_capa mu_virtdomain_cmdline; 103 extern struct mu_cmdline_capa mu_virtdomain_cmdline;
104 extern struct mu_cmdline_capa mu_auth_cmdline; 104 extern struct mu_cmdline_capa mu_auth_cmdline;
105 105
106 extern char *mu_license_text;
107
108 extern void mu_libargp_init (void); 106 extern void mu_libargp_init (void);
109 107
110 extern struct argp *mu_argp_build (const struct argp *argp); 108 extern struct argp *mu_argp_build (const struct argp *argp);
...@@ -112,8 +110,17 @@ extern void mu_argp_done (struct argp *argp); ...@@ -112,8 +110,17 @@ extern void mu_argp_done (struct argp *argp);
112 110
113 extern int mu_register_argp_capa (const char *name, struct argp_child *child); 111 extern int mu_register_argp_capa (const char *name, struct argp_child *child);
114 112
115 extern void mu_print_options (void); 113 void mu_argp_init (const char *vers, const char *bugaddr);
116 extern const char *mu_check_option (char *name); 114 int mu_app_init (struct argp *myargp, const char **capa,
115 struct mu_cfg_param *cfg_param,
116 int argc, char **argv, int flags, int *pindex, void *data);
117
118 error_t mu_argp_parse (const struct argp *myargp,
119 int *pargc, char **pargv[],
120 unsigned flags,
121 const char *capa[],
122 int *arg_index,
123 void *input) __attribute__ ((deprecated));
117 124
118 #ifdef __cplusplus 125 #ifdef __cplusplus
119 } 126 }
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */ 17 Boston, MA 02110-1301 USA */
18 18
19 #ifdef HAVE_CONFIG_H 19 #ifndef _MAILUTILS_LIBCFG_H
20 # include <config.h> 20 #define _MAILUTILS_LIBCFG_H
21 #endif 21
22 #include <mailutils/cfg.h> 22 #include <mailutils/cfg.h>
23 #include <mailutils/gocs.h> 23 #include <mailutils/gocs.h>
24 #include <mailutils/nls.h> 24 #include <mailutils/nls.h>
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
33 # define MU_USER_CONFIG_FILE "~/.mailutils" 33 # define MU_USER_CONFIG_FILE "~/.mailutils"
34 #endif 34 #endif
35 35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
36 struct mu_cfg_capa 40 struct mu_cfg_capa
37 { 41 {
38 char *name; 42 char *name;
...@@ -89,3 +93,8 @@ extern struct mu_cfg_capa mu_sql_cfg_capa; ...@@ -89,3 +93,8 @@ extern struct mu_cfg_capa mu_sql_cfg_capa;
89 extern struct mu_cfg_capa mu_tls_cfg_capa; 93 extern struct mu_cfg_capa mu_tls_cfg_capa;
90 extern struct mu_cfg_capa mu_virtdomain_cfg_capa; 94 extern struct mu_cfg_capa mu_virtdomain_cfg_capa;
91 95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif
......
...@@ -53,9 +53,10 @@ ...@@ -53,9 +53,10 @@
53 #include <mailutils/types.h> 53 #include <mailutils/types.h>
54 #include <mailutils/url.h> 54 #include <mailutils/url.h>
55 #include <mailutils/gocs.h> 55 #include <mailutils/gocs.h>
56 #include <mailutils/version.h>
56 57
57 #ifdef MU_COMPAT 58 #ifdef MU_COMPAT
58 # include <mailutils/compat.h> 59 # error "Version 0.6 is no longer supported. Please, update your program."
59 #endif 60 #endif
60 61
61 /* EOF */ 62 /* EOF */
......
...@@ -16,16 +16,22 @@ ...@@ -16,16 +16,22 @@
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */ 17 Boston, MA 02110-1301 USA */
18 18
19 #ifdef HAVE_CONFIG_H 19 #ifndef _MAILUTILS_VERSION_H
20 # include <config.h> 20 #define _MAILUTILS_VERSION_H
21
22 #include <stdio.h>
23
24 #ifdef __cplusplus
25 extern "C" {
21 #endif 26 #endif
22 27
23 #include "muinit.h" 28 extern char *mu_license_text;
29 extern void mu_print_options (void);
30 extern void mu_fprint_options (FILE *fp);
31 extern const char *mu_check_option (char *name);
24 32
25 void 33 #ifdef __cplusplus
26 mu_argp_init (const char *vers, const char *bugaddr)
27 {
28 argp_program_version = vers ? vers : PACKAGE_STRING;
29 argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
30 } 34 }
35 #endif
31 36
37 #endif
......
...@@ -23,11 +23,8 @@ include gnulib.mk ...@@ -23,11 +23,8 @@ include gnulib.mk
23 INCLUDES = @MU_COMMON_INCLUDES@ 23 INCLUDES = @MU_COMMON_INCLUDES@
24 24
25 libmuaux_la_SOURCES += \ 25 libmuaux_la_SOURCES += \
26 argpinit.c\
27 daemon.c\ 26 daemon.c\
28 mailcap.c\ 27 mailcap.c\
29 muinit.h\
30 muinit.c\
31 mu_dbm.c 28 mu_dbm.c
32 29
33 noinst_HEADERS +=\ 30 noinst_HEADERS +=\
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #include "cmdline.h"
20 #include "libcfg.h"
21
22 void mu_argp_init (const char *vers, const char *bugaddr);
23 int mu_app_init (struct argp *myargp, const char **capa,
24 struct mu_cfg_param *cfg_param,
25 int argc, char **argv, int flags, int *pindex, void *data);
26
27
...@@ -20,16 +20,17 @@ INCLUDES = @MU_COMMON_INCLUDES@ ...@@ -20,16 +20,17 @@ INCLUDES = @MU_COMMON_INCLUDES@
20 AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \ 20 AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \
21 -DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\" 21 -DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\"
22 22
23 noinst_LIBRARIES = libargp.a 23 lib_LIBRARIES = libmuargp.a
24 noinst_HEADERS = cmdline.h
25 24
26 libargp_a_SOURCES =\ 25 libmuargp_a_SOURCES =\
27 auth.c\ 26 auth.c\
28 cmdline.c\ 27 cmdline.c\
29 common.c\ 28 common.c\
29 compat.c\
30 gsasl.c\ 30 gsasl.c\
31 mu_argp.h\ 31 mu_argp.h\
32 mu_argp.c\ 32 mu_argp.c\
33 muinit.c\
33 pam.c\ 34 pam.c\
34 radius.c\ 35 radius.c\
35 sieve.c\ 36 sieve.c\
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22 #include "mailutils/libargp.h"
23 #include "cmdline.h"
24 23
25 24
26 /* ************************************************************************* */ 25 /* ************************************************************************* */
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22 #include "mailutils/libargp.h"
23 #include "cmdline.h"
24 23
25 static struct mu_cmdline_capa *all_cmdline_capa[] = { 24 static struct mu_cmdline_capa *all_cmdline_capa[] = {
26 &mu_common_cmdline, 25 &mu_common_cmdline,
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22 #include "mailutils/libargp.h"
23 #include "cmdline.h"
24 #include <string.h> 23 #include <string.h>
25 #include <mailutils/syslog.h> 24 #include <mailutils/syslog.h>
26 #include <mailutils/daemon.h> 25 #include <mailutils/daemon.h>
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 #include <string.h>
25 #include "mailutils/libargp.h"
26 #include "mailutils/argcv.h"
27 #include "mailutils/mutil.h"
28 #ifdef WITH_TLS
29 # include "mailutils/tls.h"
30 #endif
31 #ifdef WITH_GSASL
32 # include "mailutils/gsasl.h"
33 #endif
34 #include "mailutils/libsieve.h"
35
36 #ifndef MU_COMPAT_CONFIG_FILE
37 # define MU_COMPAT_CONFIG_FILE SYSCONFDIR "/mailutils.rc"
38 #endif
39
40 #ifndef MU_COMPAT_USER_CONFIG_FILE
41 # define MU_COMPAT_USER_CONFIG_FILE "~/.mailutils"
42 #endif
43
44 static int
45 member (const char *array[], const char *text, size_t len)
46 {
47 int i;
48 for (i = 0; array[i]; i++)
49 if (strncmp (array[i], text, len) == 0)
50 return 1;
51 return 0;
52 }
53
54 /* Appends applicable options found in file NAME to argv. If progname
55 is NULL, all the options found are assumed to apply. Otherwise they
56 apply only if the line starts with ":something", and something is
57 found in the CAPA array, or the line starts with PROGNAME.
58 */
59 void
60 read_rc (const char *progname, const char *name, const char *capa[],
61 int *argc, char ***argv)
62 {
63 FILE *fp;
64 char *linebuf = NULL;
65 char *buf = NULL;
66 size_t n = 0;
67 int x_argc = *argc;
68 char **x_argv = *argv;
69 char* rcfile = mu_tilde_expansion (name, "/", NULL);
70
71 if (!rcfile)
72 return;
73
74 fp = fopen (rcfile, "r");
75 if (!fp)
76 {
77 free(rcfile);
78 return;
79 }
80
81 while (getline (&buf, &n, fp) > 0)
82 {
83 char *kwp, *p;
84 int len;
85
86 for (kwp = buf; *kwp && isspace (*kwp); kwp++)
87 ;
88
89 if (*kwp == '#' || *kwp == 0)
90 continue;
91
92 len = strlen (kwp);
93 if (kwp[len-1] == '\n')
94 kwp[--len] = 0;
95
96 if (kwp[len-1] == '\\' || linebuf)
97 {
98 int cont;
99
100 if (kwp[len-1] == '\\')
101 {
102 kwp[--len] = 0;
103 cont = 1;
104 }
105 else
106 cont = 0;
107
108 if (!linebuf)
109 linebuf = calloc (len + 1, 1);
110 else
111 linebuf = realloc (linebuf, strlen (linebuf) + len + 1);
112
113 if (!linebuf)
114 {
115 fprintf (stderr, _("%s: not enough memory\n"), progname);
116 exit (1);
117 }
118
119 strcpy (linebuf + strlen (linebuf), kwp);
120 if (cont)
121 continue;
122 kwp = linebuf;
123 }
124
125 len = 0;
126 if (progname)
127 {
128 for (p = kwp; *p && !isspace (*p); p++)
129 len++;
130 }
131 else
132 p = kwp; /* Use the whole line. */
133
134 if (progname == NULL
135 || (kwp[0] == ':' && member (capa, kwp+1, len-1))
136 || strncmp (progname, kwp, len) == 0
137 )
138 {
139 int i, n_argc = 0;
140 char **n_argv;
141
142 if (mu_argcv_get (p, "", NULL, &n_argc, &n_argv))
143 {
144 mu_argcv_free (n_argc, n_argv);
145 if (linebuf)
146 free (linebuf);
147 linebuf = NULL;
148 continue;
149 }
150 x_argv = realloc (x_argv,
151 (x_argc + n_argc) * sizeof (x_argv[0]));
152 if (!x_argv)
153 {
154 fprintf (stderr, _("%s: not enough memory\n"), progname);
155 exit (1);
156 }
157
158 for (i = 0; i < n_argc; i++)
159 x_argv[x_argc++] = mu_tilde_expansion (n_argv[i], "/", NULL);
160
161 free (n_argv);
162 }
163 if (linebuf)
164 free (linebuf);
165 linebuf = NULL;
166 }
167 fclose (fp);
168 free(rcfile);
169
170 *argc = x_argc;
171 *argv = x_argv;
172 }
173
174
175 void
176 mu_create_argcv (const char *capa[],
177 int argc, char **argv, int *p_argc, char ***p_argv)
178 {
179 char *progname;
180 int x_argc;
181 char **x_argv;
182 int i;
183 int rcdir = 0;
184
185 progname = strrchr (argv[0], '/');
186 if (progname)
187 progname++;
188 else
189 progname = argv[0];
190
191 x_argv = malloc (sizeof (x_argv[0]));
192 if (!x_argv)
193 {
194 fprintf (stderr, _("%s: not enough memory\n"), progname);
195 exit (1);
196 }
197
198 /* Add command name */
199 x_argc = 0;
200 x_argv[x_argc] = argv[x_argc];
201 x_argc++;
202
203 /* Add global config file. */
204 read_rc (progname, MU_COMPAT_CONFIG_FILE, capa, &x_argc, &x_argv);
205
206 /* Look for per-user config files in ~/.mailutils/ or in ~/, but
207 not both. This allows mailutils' utilities to have their config
208 files segregated, if necessary. */
209
210 {
211 struct stat s;
212 char *rcdirname = mu_tilde_expansion (MU_COMPAT_USER_CONFIG_FILE, "/", NULL);
213
214 if (!rcdirname
215 || (stat(rcdirname, &s) == 0 && S_ISDIR(s.st_mode)))
216 rcdir = 1;
217
218 free(rcdirname);
219 }
220
221 /* Add per-user config file. */
222 if (!rcdir)
223 {
224 read_rc (progname, MU_COMPAT_USER_CONFIG_FILE, capa, &x_argc, &x_argv);
225 }
226 else
227 {
228 char *userrc = NULL;
229
230 userrc = malloc (sizeof (MU_COMPAT_USER_CONFIG_FILE)
231 /* provides an extra slot
232 for null byte as well */
233 + 1 /* slash */
234 + 9 /*mailutils*/);
235
236 if (!userrc)
237 {
238 fprintf (stderr, _("%s: not enough memory\n"), progname);
239 exit (1);
240 }
241
242 sprintf (userrc, "%s/mailutils", MU_COMPAT_USER_CONFIG_FILE);
243 read_rc (progname, userrc, capa, &x_argc, &x_argv);
244
245 free (userrc);
246 }
247
248 /* Add per-user, per-program config file. */
249 {
250 char *progrc = NULL;
251 int size;
252
253 if (rcdir)
254 size = sizeof (MU_COMPAT_USER_CONFIG_FILE)
255 + 1
256 + strlen (progname)
257 + 2 /* rc */;
258 else
259 size = 6 /*~/.mu.*/
260 + strlen (progname)
261 + 3 /* "rc" + null terminator */;
262
263 progrc = malloc (size);
264
265 if (!progrc)
266 {
267 fprintf (stderr, _("%s: not enough memory\n"), progname);
268 exit (1);
269 }
270
271 if (rcdir)
272 sprintf (progrc, "%s/%src", MU_COMPAT_USER_CONFIG_FILE, progname);
273 else
274 sprintf (progrc, "~/.mu.%src", progname);
275
276 read_rc (NULL, progrc, capa, &x_argc, &x_argv);
277 free (progrc);
278 }
279
280 /* Finally, add the command line options */
281 x_argv = realloc (x_argv, (x_argc + argc) * sizeof (x_argv[0]));
282 for (i = 1; i < argc; i++)
283 x_argv[x_argc++] = argv[i];
284
285 x_argv[x_argc] = NULL;
286
287 *p_argc = x_argc;
288 *p_argv = x_argv;
289 }
290
291 error_t
292 mu_argp_parse (const struct argp *myargp,
293 int *pargc, char **pargv[],
294 unsigned flags,
295 const char *capa[],
296 int *arg_index,
297 void *input)
298 {
299 struct argp *argp;
300 error_t rc;
301 const struct argp argpnull = { 0 };
302 int i;
303
304 /* Make sure we have program version and bug address initialized */
305 mu_argp_init (argp_program_version, argp_program_bug_address);
306
307 mu_set_program_name ((*pargv)[0]);
308 mu_libargp_init ();
309 for (i = 0; capa[i]; i++)
310 {
311 #ifdef WITH_TLS
312 if (strcmp (capa[i], "tls") == 0)
313 mu_gocs_register ("tls", mu_tls_module_init);
314 else
315 #endif /* WITH_TLS */
316 #ifdef WITH_GSASL
317 if (strcmp (capa[i], "gsasl") == 0)
318 mu_gocs_register ("gsasl", mu_gsasl_module_init);
319 else
320 #endif
321 if (strcmp (capa[i], "sieve") == 0)
322 mu_gocs_register ("sieve", mu_sieve_module_init);
323 else
324 mu_gocs_register_std (capa[i]);
325 }
326
327 if (!myargp)
328 myargp = &argpnull;
329 argp = mu_argp_build (myargp);
330 rc = argp_parse (argp, *pargc, *pargv, flags, arg_index, input);
331 mu_argp_done (argp);
332 if (rc)
333 return rc;
334
335 mu_gocs_flush ();
336
337 return 0;
338 }
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
19 #ifdef HAVE_CONFIG_H 19 #ifdef HAVE_CONFIG_H
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22 #include "mailutils/libargp.h"
23 #include "cmdline.h"
24 #include <mailutils/gsasl.h> 23 #include <mailutils/gsasl.h>
25 24
26 static struct argp_option _gsasl_argp_options[] = { 25 static struct argp_option _gsasl_argp_options[] = {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
20 #ifdef HAVE_CONFIG_H 20 #ifdef HAVE_CONFIG_H
21 # include <config.h> 21 # include <config.h>
22 #endif 22 #endif
23
24 #include <pwd.h> 23 #include <pwd.h>
25 #include <stdio.h> 24 #include <stdio.h>
26 #include <stdlib.h> 25 #include <stdlib.h>
...@@ -31,135 +30,7 @@ ...@@ -31,135 +30,7 @@
31 #include <sys/types.h> 30 #include <sys/types.h>
32 #include <sys/stat.h> 31 #include <sys/stat.h>
33 32
34 #include "cmdline.h" 33 #include "mailutils/libargp.h"
35
36 char *mu_license_text =
37 N_(" GNU Mailutils is free software; you can redistribute it and/or modify\n"
38 " it under the terms of the GNU General Public License as published by\n"
39 " the Free Software Foundation; either version 3 of the License, or\n"
40 " (at your option) any later version.\n"
41 "\n"
42 " GNU Mailutils is distributed in the hope that it will be useful,\n"
43 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
44 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
45 " GNU General Public License for more details.\n"
46 "\n"
47 " You should have received a copy of the GNU General Public License along\n"
48 " with GNU Mailutils; if not, write to the Free Software Foundation,\n"
49 " Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
50 "\n"
51 "\n"
52 );
53
54 static char *mu_conf_option[] = {
55 "VERSION=" VERSION,
56 #ifdef USE_LIBPAM
57 "USE_LIBPAM",
58 #endif
59 #ifdef HAVE_LIBLTDL
60 "HAVE_LIBLTDL",
61 #endif
62 #ifdef WITH_BDB2
63 "WITH_BDB2",
64 #endif
65 #ifdef WITH_NDBM
66 "WITH_NDBM",
67 #endif
68 #ifdef WITH_OLD_DBM
69 "WITH_OLD_DBM",
70 #endif
71 #ifdef WITH_GDBM
72 "WITH_GDBM",
73 #endif
74 #ifdef WITH_GNUTLS
75 "WITH_GNUTLS",
76 #endif
77 #ifdef WITH_GSASL
78 "WITH_GSASL",
79 #endif
80 #ifdef WITH_GSSAPI
81 "WITH_GSSAPI",
82 #endif
83 #ifdef WITH_GUILE
84 "WITH_GUILE",
85 #endif
86 #ifdef WITH_PTHREAD
87 "WITH_PTHREAD",
88 #endif
89 #ifdef WITH_READLINE
90 "WITH_READLINE",
91 #endif
92 #ifdef HAVE_MYSQL
93 "HAVE_MYSQL",
94 #endif
95 #ifdef HAVE_PGSQL
96 "HAVE_PGSQL",
97 #endif
98 #ifdef ENABLE_VIRTUAL_DOMAINS
99 "ENABLE_VIRTUAL_DOMAINS",
100 #endif
101 #ifdef ENABLE_IMAP
102 "ENABLE_IMAP",
103 #endif
104 #ifdef ENABLE_POP
105 "ENABLE_POP",
106 #endif
107 #ifdef ENABLE_MH
108 "ENABLE_MH",
109 #endif
110 #ifdef ENABLE_MAILDIR
111 "ENABLE_MAILDIR",
112 #endif
113 #ifdef ENABLE_SMTP
114 "ENABLE_SMTP",
115 #endif
116 #ifdef ENABLE_SENDMAIL
117 "ENABLE_SENDMAIL",
118 #endif
119 #ifdef ENABLE_NNTP
120 "ENABLE_NNTP",
121 #endif
122 #ifdef ENABLE_RADIUS
123 "ENABLE_RADIUS",
124 #endif
125 #ifdef WITH_INCLUDED_LIBINTL
126 "WITH_INCLUDED_LIBINTL",
127 #endif
128 NULL
129 };
130
131 void
132 mu_print_options ()
133 {
134 int i;
135
136 for (i = 0; mu_conf_option[i]; i++)
137 printf ("%s\n", mu_conf_option[i]);
138 }
139
140 const char *
141 mu_check_option (char *name)
142 {
143 int i;
144
145 for (i = 0; mu_conf_option[i]; i++)
146 {
147 int len;
148 char *q, *p = strchr (mu_conf_option[i], '=');
149 if (p)
150 len = p - mu_conf_option[i];
151 else
152 len = strlen (mu_conf_option[i]);
153
154 if (strncasecmp (mu_conf_option[i], name, len) == 0)
155 return mu_conf_option[i];
156 else if ((q = strchr (mu_conf_option[i], '_')) != NULL
157 && strncasecmp (q + 1, name,
158 len - (q - mu_conf_option[i]) - 1) == 0)
159 return mu_conf_option[i];
160 }
161 return NULL;
162 }
163 34
164 35
165 /* ************************************************************************* */ 36 /* ************************************************************************* */
......
...@@ -20,7 +20,15 @@ ...@@ -20,7 +20,15 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "muinit.h" 23 #include "mailutils/libcfg.h"
24 #include "mailutils/libargp.h"
25
26 void
27 mu_argp_init (const char *vers, const char *bugaddr)
28 {
29 argp_program_version = vers ? vers : PACKAGE_STRING;
30 argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
31 }
24 32
25 int 33 int
26 mu_app_init (struct argp *myargp, const char **capa, 34 mu_app_init (struct argp *myargp, const char **capa,
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 #include <mailutils/pam.h> 24 #include <mailutils/pam.h>
25 25
26 static char *service_name; 26 static char *service_name;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 #include <mailutils/radius.h> 24 #include <mailutils/radius.h>
25 25
26 static struct argp_option mu_radius_argp_option[] = { 26 static struct argp_option mu_radius_argp_option[] = {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 #ifdef HAVE_CONFIG_H 20 #ifdef HAVE_CONFIG_H
21 # include <config.h> 21 # include <config.h>
22 #endif 22 #endif
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 #include "mailutils/libsieve.h" 24 #include "mailutils/libsieve.h"
25 25
26 26
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 #include "mailutils/sql.h" 24 #include "mailutils/sql.h"
25 #include "mailutils/mutil.h" 25 #include "mailutils/mutil.h"
26 26
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 #include <mailutils/tls.h> 24 #include <mailutils/tls.h>
25 25
26 static struct argp_option _tls_argp_options[] = { 26 static struct argp_option _tls_argp_options[] = {
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 # include <config.h> 20 # include <config.h>
21 #endif 21 #endif
22 22
23 #include "cmdline.h" 23 #include "mailutils/libargp.h"
24 24
25 static char *virtdir; 25 static char *virtdir;
26 26
......
...@@ -21,7 +21,6 @@ AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \ ...@@ -21,7 +21,6 @@ AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \
21 -DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\" 21 -DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\"
22 22
23 lib_LTLIBRARIES = libmucfg.la 23 lib_LTLIBRARIES = libmucfg.la
24 noinst_HEADERS = libcfg.h
25 libmucfg_la_SOURCES=\ 24 libmucfg_la_SOURCES=\
26 auth.c\ 25 auth.c\
27 common.c\ 26 common.c\
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/mu_auth.h> 22 #include <mailutils/mu_auth.h>
20 #include <string.h> 23 #include <string.h>
21 24
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <string.h> 22 #include <string.h>
20 #include <mailutils/daemon.h> 23 #include <mailutils/daemon.h>
21 24
...@@ -124,3 +127,4 @@ static struct mu_cfg_param mu_daemon_param[] = { ...@@ -124,3 +127,4 @@ static struct mu_cfg_param mu_daemon_param[] = {
124 { NULL } 127 { NULL }
125 }; 128 };
126 129
130 DCL_CFG_CAPA (daemon);
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/gsasl.h> 22 #include <mailutils/gsasl.h>
20 23
21 static struct mu_gsasl_module_data gsasl_settings; 24 static struct mu_gsasl_module_data gsasl_settings;
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <string.h> 22 #include <string.h>
20 #include <stdlib.h> 23 #include <stdlib.h>
21 24
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 22
20 static char *pam_settings; 23 static char *pam_settings;
21 24
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/radius.h> 22 #include <mailutils/radius.h>
20 23
21 static struct mu_radius_module_data radius_settings; 24 static struct mu_radius_module_data radius_settings;
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/libsieve.h> 22 #include <mailutils/libsieve.h>
20 23
21 static struct mu_gocs_sieve sieve_settings; 24 static struct mu_gocs_sieve sieve_settings;
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/sql.h> 22 #include <mailutils/sql.h>
20 #include <mailutils/mutil.h> 23 #include <mailutils/mutil.h>
21 24
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 #include <mailutils/tls.h> 22 #include <mailutils/tls.h>
20 23
21 static struct mu_tls_module_config tls_settings; 24 static struct mu_tls_module_config tls_settings;
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
15 along with this program. If not, see <http://www.gnu.org/licenses/>. 15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include "libcfg.h" 18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21 #include "mailutils/libcfg.h"
19 22
20 static char *virtdomain_settings; 23 static char *virtdomain_settings;
21 24
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
91 # define USE_MAILBOX_QUOTAS 1 91 # define USE_MAILBOX_QUOTAS 1
92 #endif 92 #endif
93 93
94 #include "muinit.h" 94 #include "mailutils/libargp.h"
95 95
96 /* Debug */ 96 /* Debug */
97 extern int debug_level; 97 extern int debug_level;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include <mail.local.h> 20 #include <mail.local.h>
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 int multiple_delivery; /* Don't return errors when delivering to multiple 23 int multiple_delivery; /* Don't return errors when delivering to multiple
24 recipients */ 24 recipients */
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
43 #include <mailutils/error.h> 43 #include <mailutils/error.h>
44 #include <mailutils/nls.h> 44 #include <mailutils/nls.h>
45 #include <mailutils/mu_auth.h> 45 #include <mailutils/mu_auth.h>
46 #include "muinit.h" 46 #include "mailutils/libargp.h"
47 47
48 const char *program_version = "mail.remote (" PACKAGE_STRING ")"; 48 const char *program_version = "mail.remote (" PACKAGE_STRING ")";
49 static char doc[] = 49 static char doc[] =
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include "mail.h" 20 #include "mail.h"
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 /* Global variables and constants*/ 23 /* Global variables and constants*/
24 mu_mailbox_t mbox; /* Mailbox being operated upon */ 24 mu_mailbox_t mbox; /* Mailbox being operated upon */
......
...@@ -95,6 +95,7 @@ libmailutils_la_SOURCES = \ ...@@ -95,6 +95,7 @@ libmailutils_la_SOURCES = \
95 tcp.c\ 95 tcp.c\
96 ticket.c\ 96 ticket.c\
97 url.c\ 97 url.c\
98 version.c\
98 wicket.c\ 99 wicket.c\
99 imaxtostr.c offtostr.c umaxtostr.c 100 imaxtostr.c offtostr.c umaxtostr.c
100 101
......
...@@ -635,7 +635,7 @@ _mu_parse_config (char *file, char *progname, ...@@ -635,7 +635,7 @@ _mu_parse_config (char *file, char *progname,
635 NULL, 635 NULL,
636 NULL); 636 NULL);
637 637
638 if (rc == 0) 638 if (rc == 0 && root_container)
639 { 639 {
640 struct mu_cfg_cont *cont = root_container; 640 struct mu_cfg_cont *cont = root_container;
641 641
......
...@@ -442,88 +442,3 @@ is_known_folder (mu_url_t url, mu_folder_t *pfolder) ...@@ -442,88 +442,3 @@ is_known_folder (mu_url_t url, mu_folder_t *pfolder)
442 return ret; 442 return ret;
443 } 443 }
444 444
445 /* Deprecated functions */
446 static int
447 list_to_0_6_folder_list (mu_list_t flist, struct mu_0_6_folder_list *pflist)
448 {
449 int status = 0;
450 size_t count;
451
452 mu_list_count (flist, &count);
453 pflist->num = count;
454 if (count == 0)
455 pflist->element = NULL;
456 else
457 {
458 pflist->element = calloc (count, sizeof (pflist->element[0]));
459 if (!pflist->element)
460 status = ENOMEM;
461 else
462 {
463 size_t i;
464 mu_iterator_t itr;
465
466 mu_list_set_destroy_item (flist, NULL);
467 mu_list_get_iterator (flist, &itr);
468 for (mu_iterator_first (itr), i = 0;
469 !mu_iterator_is_done (itr); mu_iterator_next(itr), i++)
470 mu_iterator_current (itr, (void**) &pflist->element[i]);
471 mu_iterator_destroy (&itr);
472 }
473 }
474 return status;
475 }
476
477 int
478 mu_0_6_folder_list (mu_folder_t folder,
479 const char *dirname, const char *basename,
480 struct mu_0_6_folder_list *pflist)
481 {
482 mu_list_t flist;
483 int status = 0;
484
485 status = mu_folder_list (folder, dirname, basename, 0, &flist);
486 if (status)
487 return status;
488 status = list_to_0_6_folder_list (flist, pflist);
489 mu_list_destroy (&flist);
490 return status;
491 }
492
493 int
494 mu_0_6_folder_lsub (mu_folder_t folder,
495 const char *dirname, const char *basename,
496 struct mu_0_6_folder_list *pflist)
497 {
498 mu_list_t flist;
499 int status = 0;
500
501 status = mu_folder_lsub (folder, dirname, basename, &flist);
502 if (status)
503 return status;
504 status = list_to_0_6_folder_list (flist, pflist);
505 mu_list_destroy (&flist);
506 return status;
507 }
508
509 int
510 mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *pflist)
511 {
512 size_t i;
513 if (pflist == NULL)
514 return 0;
515 for (i = 0 ; i < pflist->num; i++)
516 {
517 if (pflist->element[i])
518 {
519 if (pflist->element[i]->name)
520 free (pflist->element[i]->name);
521 free (pflist->element[i]);
522 }
523 }
524 if (i > 0)
525 free (pflist->element);
526 pflist->element = NULL;
527 pflist->num = 0;
528 return 0;
529 }
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 2007 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 3 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General
15 Public License along with this library; if not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301 USA */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include <mailutils/nls.h>
24 #include <stdio.h>
25 #include <string.h>
26
27 char *mu_license_text =
28 N_(" GNU Mailutils is free software; you can redistribute it and/or modify\n"
29 " it under the terms of the GNU General Public License as published by\n"
30 " the Free Software Foundation; either version 3 of the License, or\n"
31 " (at your option) any later version.\n"
32 "\n"
33 " GNU Mailutils is distributed in the hope that it will be useful,\n"
34 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
35 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
36 " GNU General Public License for more details.\n"
37 "\n"
38 " You should have received a copy of the GNU General Public License along\n"
39 " with GNU Mailutils; if not, write to the Free Software Foundation,\n"
40 " Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
41 "\n"
42 "\n"
43 );
44
45 static char *mu_conf_option[] = {
46 "VERSION=" VERSION,
47 #ifdef USE_LIBPAM
48 "USE_LIBPAM",
49 #endif
50 #ifdef HAVE_LIBLTDL
51 "HAVE_LIBLTDL",
52 #endif
53 #ifdef WITH_BDB2
54 "WITH_BDB2",
55 #endif
56 #ifdef WITH_NDBM
57 "WITH_NDBM",
58 #endif
59 #ifdef WITH_OLD_DBM
60 "WITH_OLD_DBM",
61 #endif
62 #ifdef WITH_GDBM
63 "WITH_GDBM",
64 #endif
65 #ifdef WITH_GNUTLS
66 "WITH_GNUTLS",
67 #endif
68 #ifdef WITH_GSASL
69 "WITH_GSASL",
70 #endif
71 #ifdef WITH_GSSAPI
72 "WITH_GSSAPI",
73 #endif
74 #ifdef WITH_GUILE
75 "WITH_GUILE",
76 #endif
77 #ifdef WITH_PTHREAD
78 "WITH_PTHREAD",
79 #endif
80 #ifdef WITH_READLINE
81 "WITH_READLINE",
82 #endif
83 #ifdef HAVE_MYSQL
84 "HAVE_MYSQL",
85 #endif
86 #ifdef HAVE_PGSQL
87 "HAVE_PGSQL",
88 #endif
89 #ifdef ENABLE_VIRTUAL_DOMAINS
90 "ENABLE_VIRTUAL_DOMAINS",
91 #endif
92 #ifdef ENABLE_IMAP
93 "ENABLE_IMAP",
94 #endif
95 #ifdef ENABLE_POP
96 "ENABLE_POP",
97 #endif
98 #ifdef ENABLE_MH
99 "ENABLE_MH",
100 #endif
101 #ifdef ENABLE_MAILDIR
102 "ENABLE_MAILDIR",
103 #endif
104 #ifdef ENABLE_SMTP
105 "ENABLE_SMTP",
106 #endif
107 #ifdef ENABLE_SENDMAIL
108 "ENABLE_SENDMAIL",
109 #endif
110 #ifdef ENABLE_NNTP
111 "ENABLE_NNTP",
112 #endif
113 #ifdef ENABLE_RADIUS
114 "ENABLE_RADIUS",
115 #endif
116 #ifdef WITH_INCLUDED_LIBINTL
117 "WITH_INCLUDED_LIBINTL",
118 #endif
119 NULL
120 };
121
122 void
123 mu_fprint_options (FILE *fp)
124 {
125 int i;
126
127 for (i = 0; mu_conf_option[i]; i++)
128 fprintf (fp, "%s\n", mu_conf_option[i]);
129 }
130
131 void
132 mu_print_options (FILE *fp)
133 {
134 mu_fprint_options (stdout);
135 }
136
137 const char *
138 mu_check_option (char *name)
139 {
140 int i;
141
142 for (i = 0; mu_conf_option[i]; i++)
143 {
144 int len;
145 char *q, *p = strchr (mu_conf_option[i], '=');
146 if (p)
147 len = p - mu_conf_option[i];
148 else
149 len = strlen (mu_conf_option[i]);
150
151 if (strncasecmp (mu_conf_option[i], name, len) == 0)
152 return mu_conf_option[i];
153 else if ((q = strchr (mu_conf_option[i], '_')) != NULL
154 && strncasecmp (q + 1, name,
155 len - (q - mu_conf_option[i]) - 1) == 0)
156 return mu_conf_option[i];
157 }
158 return NULL;
159 }
160
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
27 #endif 27 #endif
28 28
29 #include <mailutils/mailutils.h> 29 #include <mailutils/mailutils.h>
30 #include "muinit.h" 30 #include "mailutils/libargp.h"
31 31
32 static int messages_count (const char *); 32 static int messages_count (const char *);
33 33
......
...@@ -194,7 +194,7 @@ main (int argc, char **argv) ...@@ -194,7 +194,7 @@ main (int argc, char **argv)
194 /* Native Language Support */ 194 /* Native Language Support */
195 mu_init_nls (); 195 mu_init_nls ();
196 196
197 mu_argp_init (program_version, NULL); 197 mh_argp_init (program_version);
198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
199 opt_handler, NULL, &index); 199 opt_handler, NULL, &index);
200 200
......
...@@ -118,7 +118,7 @@ main (int argc, char **argv) ...@@ -118,7 +118,7 @@ main (int argc, char **argv)
118 118
119 mu_init_nls (); 119 mu_init_nls ();
120 120
121 mu_argp_init (program_version, NULL); 121 mh_argp_init (program_version);
122 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 122 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
123 opt_handler, NULL, &index); 123 opt_handler, NULL, &index);
124 124
......
...@@ -550,7 +550,7 @@ main (int argc, char **argv) ...@@ -550,7 +550,7 @@ main (int argc, char **argv)
550 /* Native Language Support */ 550 /* Native Language Support */
551 mu_init_nls (); 551 mu_init_nls ();
552 552
553 mu_argp_init (program_version, NULL); 553 mh_argp_init (program_version);
554 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 554 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
555 opt_handler, NULL, &index); 555 opt_handler, NULL, &index);
556 556
......
...@@ -212,7 +212,7 @@ main (int argc, char **argv) ...@@ -212,7 +212,7 @@ main (int argc, char **argv)
212 /* Native Language Support */ 212 /* Native Language Support */
213 mu_init_nls (); 213 mu_init_nls ();
214 214
215 mu_argp_init (program_version, NULL); 215 mh_argp_init (program_version);
216 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 216 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
217 opt_handler, NULL, &index); 217 opt_handler, NULL, &index);
218 218
......
...@@ -105,7 +105,7 @@ main (int argc, char **argv) ...@@ -105,7 +105,7 @@ main (int argc, char **argv)
105 /* Native Language Support */ 105 /* Native Language Support */
106 mu_init_nls (); 106 mu_init_nls ();
107 107
108 mu_argp_init (program_version, NULL); 108 mh_argp_init (program_version);
109 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 109 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
110 opt_handler, NULL, NULL); 110 opt_handler, NULL, NULL);
111 111
......
...@@ -937,7 +937,7 @@ main (int argc, char **argv) ...@@ -937,7 +937,7 @@ main (int argc, char **argv)
937 /* Native Language Support */ 937 /* Native Language Support */
938 mu_init_nls (); 938 mu_init_nls ();
939 939
940 mu_argp_init (program_version, NULL); 940 mh_argp_init (program_version);
941 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 941 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
942 opt_handler, NULL, &index); 942 opt_handler, NULL, &index);
943 943
......
...@@ -425,7 +425,7 @@ main (int argc, char **argv) ...@@ -425,7 +425,7 @@ main (int argc, char **argv)
425 /* Native Language Support */ 425 /* Native Language Support */
426 mu_init_nls (); 426 mu_init_nls ();
427 427
428 mu_argp_init (program_version, NULL); 428 mh_argp_init (program_version);
429 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 429 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
430 opt_handler, NULL, &index); 430 opt_handler, NULL, &index);
431 431
......
...@@ -181,7 +181,7 @@ main (int argc, char **argv) ...@@ -181,7 +181,7 @@ main (int argc, char **argv)
181 /* Native Language Support */ 181 /* Native Language Support */
182 mu_init_nls (); 182 mu_init_nls ();
183 183
184 mu_argp_init (program_version, NULL); 184 mh_argp_init (program_version);
185 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 185 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
186 opt_handler, NULL, NULL); 186 opt_handler, NULL, NULL);
187 187
......
...@@ -71,7 +71,7 @@ main (int argc, char **argv) ...@@ -71,7 +71,7 @@ main (int argc, char **argv)
71 /* Native Language Support */ 71 /* Native Language Support */
72 mu_init_nls (); 72 mu_init_nls ();
73 73
74 mu_argp_init (program_version, NULL); 74 mh_argp_init (program_version);
75 mh_auto_install = 0; 75 mh_auto_install = 0;
76 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 76 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
77 opt_handler, NULL, NULL); 77 opt_handler, NULL, NULL);
......
...@@ -194,7 +194,7 @@ main (int argc, char **argv) ...@@ -194,7 +194,7 @@ main (int argc, char **argv)
194 mu_url_t url; 194 mu_url_t url;
195 195
196 mu_init_nls (); 196 mu_init_nls ();
197 mu_argp_init (program_version, NULL); 197 mh_argp_init (program_version);
198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
199 opt_handler, NULL, &index); 199 opt_handler, NULL, &index);
200 200
......
...@@ -94,6 +94,13 @@ my_argp_parse (struct argp *argp, int argc, char **argv, int flags, ...@@ -94,6 +94,13 @@ my_argp_parse (struct argp *argp, int argc, char **argv, int flags,
94 return rc; 94 return rc;
95 } 95 }
96 96
97 void
98 mh_argp_init (const char *vers)
99 {
100 argp_program_version = vers ? vers : PACKAGE_STRING;
101 argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
102 }
103
97 int 104 int
98 mh_argp_parse (int *pargc, char **pargv[], 105 mh_argp_parse (int *pargc, char **pargv[],
99 int flags, 106 int flags,
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 18
19 #include <mailutils/nls.h> 19 #include <mailutils/nls.h>
20 #include "argp.h" 20 #include "argp.h"
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 #define MH_OPT_BOOL 1 23 #define MH_OPT_BOOL 1
24 #define MH_OPT_ARG 2 24 #define MH_OPT_ARG 2
...@@ -182,6 +182,7 @@ enum mh_arg { ...@@ -182,6 +182,7 @@ enum mh_arg {
182 ARG_ZERO 182 ARG_ZERO
183 }; 183 };
184 184
185 void mh_argp_init (const char *vers);
185 void mh_argv_preproc (int argc, char **argv, struct mh_argp_data *data); 186 void mh_argv_preproc (int argc, char **argv, struct mh_argp_data *data);
186 int mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc); 187 int mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc);
187 int mh_argp_parse (int *argc, char **argv[], 188 int mh_argp_parse (int *argc, char **argv[],
......
...@@ -223,7 +223,7 @@ main (int argc, char **argv) ...@@ -223,7 +223,7 @@ main (int argc, char **argv)
223 interactive = isatty (1) && isatty (0); 223 interactive = isatty (1) && isatty (0);
224 224
225 mu_init_nls (); 225 mu_init_nls ();
226 mu_argp_init (program_version, NULL); 226 mh_argp_init (program_version);
227 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 227 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
228 opt_handler, NULL, &index); 228 opt_handler, NULL, &index);
229 229
......
...@@ -2763,7 +2763,7 @@ main (int argc, char **argv) ...@@ -2763,7 +2763,7 @@ main (int argc, char **argv)
2763 2763
2764 mu_init_nls (); 2764 mu_init_nls ();
2765 2765
2766 mu_argp_init (program_version, NULL); 2766 mh_argp_init (program_version);
2767 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 2767 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
2768 opt_handler, NULL, &index); 2768 opt_handler, NULL, &index);
2769 2769
......
...@@ -125,7 +125,7 @@ main (int argc, char **argv) ...@@ -125,7 +125,7 @@ main (int argc, char **argv)
125 /* Native Language Support */ 125 /* Native Language Support */
126 mu_init_nls (); 126 mu_init_nls ();
127 127
128 mu_argp_init (program_version, NULL); 128 mh_argp_init (program_version);
129 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 129 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
130 opt_handler, NULL, &index); 130 opt_handler, NULL, &index);
131 131
......
...@@ -82,7 +82,7 @@ main (int argc, char **argv) ...@@ -82,7 +82,7 @@ main (int argc, char **argv)
82 /* Native Language Support */ 82 /* Native Language Support */
83 mu_init_nls (); 83 mu_init_nls ();
84 84
85 mu_argp_init (program_version, NULL); 85 mh_argp_init (program_version);
86 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 86 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
87 opt_handler, NULL, &index); 87 opt_handler, NULL, &index);
88 88
......
...@@ -348,7 +348,7 @@ main (int argc, char **argv) ...@@ -348,7 +348,7 @@ main (int argc, char **argv)
348 348
349 flags = mh_interactive_mode_p () ? 0 : ARGP_NO_ERRS; 349 flags = mh_interactive_mode_p () ? 0 : ARGP_NO_ERRS;
350 mu_init_nls (); 350 mu_init_nls ();
351 mu_argp_init (program_version, NULL); 351 mh_argp_init (program_version);
352 mh_argp_parse (&argc, &argv, flags, options, mh_option, 352 mh_argp_parse (&argc, &argv, flags, options, mh_option,
353 args_doc, doc, opt_handler, NULL, &index); 353 args_doc, doc, opt_handler, NULL, &index);
354 if (pick_parse (lexlist)) 354 if (pick_parse (lexlist))
......
...@@ -231,7 +231,7 @@ main (int argc, char **argv) ...@@ -231,7 +231,7 @@ main (int argc, char **argv)
231 /* Native Language Support */ 231 /* Native Language Support */
232 mu_init_nls (); 232 mu_init_nls ();
233 233
234 mu_argp_init (program_version, NULL); 234 mh_argp_init (program_version);
235 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 235 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
236 opt_handler, NULL, &index); 236 opt_handler, NULL, &index);
237 237
......
...@@ -405,7 +405,7 @@ main (int argc, char **argv) ...@@ -405,7 +405,7 @@ main (int argc, char **argv)
405 /* Native Language Support */ 405 /* Native Language Support */
406 mu_init_nls (); 406 mu_init_nls ();
407 407
408 mu_argp_init (program_version, NULL); 408 mh_argp_init (program_version);
409 409
410 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 410 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
411 opt_handler, NULL, &index); 411 opt_handler, NULL, &index);
......
...@@ -194,7 +194,7 @@ main (int argc, char **argv) ...@@ -194,7 +194,7 @@ main (int argc, char **argv)
194 /* Native Language Support */ 194 /* Native Language Support */
195 mu_init_nls (); 195 mu_init_nls ();
196 196
197 mu_argp_init (program_version, NULL); 197 mh_argp_init (program_version);
198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 198 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
199 opt_handler, NULL, NULL); 199 opt_handler, NULL, NULL);
200 200
......
...@@ -77,7 +77,7 @@ main (int argc, char **argv) ...@@ -77,7 +77,7 @@ main (int argc, char **argv)
77 /* Native Language Support */ 77 /* Native Language Support */
78 mu_init_nls (); 78 mu_init_nls ();
79 79
80 mu_argp_init (program_version, NULL); 80 mh_argp_init (program_version);
81 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 81 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
82 opt_handler, NULL, &index); 82 opt_handler, NULL, &index);
83 83
......
...@@ -178,7 +178,7 @@ main (int argc, char **argv) ...@@ -178,7 +178,7 @@ main (int argc, char **argv)
178 /* Native Language Support */ 178 /* Native Language Support */
179 mu_init_nls (); 179 mu_init_nls ();
180 180
181 mu_argp_init (program_version, NULL); 181 mh_argp_init (program_version);
182 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 182 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
183 opt_handler, NULL, &index); 183 opt_handler, NULL, &index);
184 184
......
...@@ -734,7 +734,7 @@ main (int argc, char **argv) ...@@ -734,7 +734,7 @@ main (int argc, char **argv)
734 734
735 mu_init_nls (); 735 mu_init_nls ();
736 736
737 mu_argp_init (program_version, NULL); 737 mh_argp_init (program_version);
738 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 738 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
739 opt_handler, NULL, &index); 739 opt_handler, NULL, &index);
740 740
......
...@@ -554,7 +554,7 @@ main (int argc, char **argv) ...@@ -554,7 +554,7 @@ main (int argc, char **argv)
554 mu_url_t url; 554 mu_url_t url;
555 555
556 mu_init_nls (); 556 mu_init_nls ();
557 mu_argp_init (program_version, NULL); 557 mh_argp_init (program_version);
558 mh_argp_parse (&argc, &argv, 0, options, mh_option, 558 mh_argp_parse (&argc, &argv, 0, options, mh_option,
559 args_doc, doc, opt_handler, NULL, &index); 559 args_doc, doc, opt_handler, NULL, &index);
560 if (!oplist) 560 if (!oplist)
......
...@@ -108,7 +108,7 @@ main (int argc, char **argv) ...@@ -108,7 +108,7 @@ main (int argc, char **argv)
108 108
109 mu_init_nls (); 109 mu_init_nls ();
110 110
111 mu_argp_init (program_version, NULL); 111 mh_argp_init (program_version);
112 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 112 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
113 opt_handler, NULL, &index); 113 opt_handler, NULL, &index);
114 argc -= index; 114 argc -= index;
......
...@@ -113,7 +113,7 @@ main (int argc, char **argv) ...@@ -113,7 +113,7 @@ main (int argc, char **argv)
113 113
114 mu_init_nls (); 114 mu_init_nls ();
115 115
116 mu_argp_init (program_version, NULL); 116 mh_argp_init (program_version);
117 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 117 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
118 opt_handler, NULL, &index); 118 opt_handler, NULL, &index);
119 119
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
20 #ifdef HAVE_CONFIG_H 20 #ifdef HAVE_CONFIG_H
21 # include <config.h> 21 # include <config.h>
22 #endif 22 #endif
23 23
24 #include <ctype.h>
24 #include <mimeview.h> 25 #include <mimeview.h>
25 #include <mimetypes-decl.h> 26 #include <mimetypes-decl.h>
26 27
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
25 #include <sys/stat.h> 25 #include <sys/stat.h>
26 #include <sys/wait.h> 26 #include <sys/wait.h>
27 27
28 #include "muinit.h" 28 #include "mailutils/libargp.h"
29 29
30 const char *program_version = "mimeview (" PACKAGE_STRING ")"; 30 const char *program_version = "mimeview (" PACKAGE_STRING ")";
31 static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.") 31 static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.")
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
25 #include <mailutils/mailutils.h> 25 #include <mailutils/mailutils.h>
26 #include <mailutils/tls.h> 26 #include <mailutils/tls.h>
27 #include <mu_asprintf.h> 27 #include <mu_asprintf.h>
28 #include "muinit.h" 28 #include "mailutils/libargp.h"
29 29
30 const char *program_version = "movemail (" PACKAGE_STRING ")"; 30 const char *program_version = "movemail (" PACKAGE_STRING ")";
31 static char doc[] = N_("GNU movemail"); 31 static char doc[] = N_("GNU movemail");
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
18 MA 02110-1301 USA */ 18 MA 02110-1301 USA */
19 19
20 #include "pop3d.h" 20 #include "pop3d.h"
21 #include "muinit.h" 21 #include "mailutils/libargp.h"
22 22
23 static mu_stream_t istream, ostream; 23 static mu_stream_t istream, ostream;
24 24
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 19
20 #include "pop3d.h" 20 #include "pop3d.h"
21 #include "mailutils/pam.h" 21 #include "mailutils/pam.h"
22 #include "muinit.h" 22 #include "mailutils/libargp.h"
23 23
24 mu_mailbox_t mbox; 24 mu_mailbox_t mbox;
25 int state; 25 int state;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
19 #include "pop3d.h" 19 #include "pop3d.h"
20 #include <mailutils/argcv.h> 20 #include <mailutils/argcv.h>
21 #include <xalloc.h> 21 #include <xalloc.h>
22 #include "muinit.h" 22 #include "mailutils/libargp.h"
23 23
24 int db_list (char *input_name, char *output_name); 24 int db_list (char *input_name, char *output_name);
25 int db_make (char *input_name, char *output_name); 25 int db_make (char *input_name, char *output_name);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 23
24 #include "readmsg.h" 24 #include "readmsg.h"
25 #include "xalloc.h" 25 #include "xalloc.h"
26 #include "muinit.h" 26 #include "mailutils/libargp.h"
27 27
28 #define WEEDLIST_SEPARATOR " :," 28 #define WEEDLIST_SEPARATOR " :,"
29 29
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
45 #include <mailutils/nls.h> 45 #include <mailutils/nls.h>
46 #include <mailutils/tls.h> 46 #include <mailutils/tls.h>
47 47
48 #include "muinit.h" 48 #include "mailutils/libargp.h"
49 49
50 const char *program_version = "sieve (" PACKAGE_STRING ")"; 50 const char *program_version = "sieve (" PACKAGE_STRING ")";
51 51
......