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 740 additions and 365 deletions
2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua>
* 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
2007-11-18 Sergey Poznyakoff <gray@gnu.org.ua>
* bootstrap (cp_mark_as_generated): Create target directory if
......
GNU mailutils NEWS -- history of user-visible changes. 2007-11-10
GNU mailutils NEWS -- history of user-visible changes. 2007-11-19
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
See the end of file for copying conditions.
......@@ -94,6 +94,8 @@ Previous versions incorrectly understood such an URL as `a/b'
* Fixed APOP handling.
* Remove v0.6 compatibility layer.
Version 1.2:
......
......@@ -18,7 +18,7 @@
MA 02110-1301 USA */
#include "comsat.h"
#include "muinit.h"
#include "mailutils/libargp.h"
#ifndef PATH_DEV
# define PATH_DEV "/dev"
......
......@@ -22,7 +22,7 @@
#include <string.h>
#include <mailutils/mailutils.h>
#include <mu_asprintf.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "mailutils-config (" PACKAGE_STRING ")";
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)
int j;
char *ptr;
add_entry (-1, LINK_FLAGS);
add_entry (-100, LINK_FLAGS);
add_entry (100, LINK_POSTFLAGS);
add_entry (1, "-lmailutils");
#ifdef ENABLE_NLS
......@@ -205,6 +205,10 @@ main (int argc, char **argv)
add_entry (-1, "-lmu_scm " GUILE_LIBS);
}
#endif
else if (strcmp (argv[0], "cfg") == 0)
add_entry (-1, "-lmucfg");
else if (strcmp (argv[0], "argp") == 0)
add_entry (-2, "-lmuargp");
else if (strcmp (argv[0], "all") == 0)
{
struct lib_descr *p;
......
......@@ -26,7 +26,7 @@ AC_CONFIG_HEADERS([config.h])
AC_PREREQ(2.60)
dnl Library versioning
AC_SUBST(VI_CURRENT, 2)
AC_SUBST(VI_CURRENT, 3)
AC_SUBST(VI_REVISION, 2)
AC_SUBST(VI_AGE, 1)
......@@ -50,7 +50,7 @@ dnl Other variables
AC_SUBST(SIEVE_MODDIR,'$(libdir)/$(PACKAGE)')
AC_SUBST(MU_COMMON_LIBRARIES,'$(LTLIBINTL) $(LTLIBICONV)')
AC_SUBST(MU_APP_LIBRARIES,'../lib/libmuaux.la ../libargp/libargp.a -L${top_builddir}/libcfg -lmucfg')
AC_SUBST(MU_APP_LIBRARIES,'../lib/libmuaux.la ../libargp/libmuargp.a ../libcfg/libmucfg.la')
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')
......
......@@ -31,7 +31,7 @@
#include <mailutils/locker.h>
#include <mailutils/nls.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "GNU dotlock (" PACKAGE_STRING ")";
static char doc[] =
......
......@@ -25,7 +25,7 @@
#include <ctype.h>
#include <string.h>
#include <mailutils/mailutils.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "muauth (" PACKAGE_STRING ")";
static char doc[] =
......
......@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <mailutils/mutil.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *capa[] = {
"address",
......
......@@ -64,7 +64,7 @@
#include <mailutils/mutil.h>
#include <mailutils/mime.h>
#include "muinit.h"
#include "mailutils/libargp.h"
typedef int (*frm_select_t) (size_t index, mu_message_t msg);
......
......@@ -18,7 +18,7 @@
MA 02110-1301 USA */
#include "guimb.h"
#include "muinit.h"
#include "mailutils/libargp.h"
char *program_file;
char *program_expr;
......
......@@ -21,7 +21,7 @@
#ifdef WITH_GSASL
# include <mailutils/gsasl.h>
#endif
#include "muinit.h"
#include "mailutils/libargp.h"
mu_mailbox_t mbox;
char *homedir;
......
......@@ -36,7 +36,6 @@ pkginclude_HEADERS = \
auth.h\
body.h\
cfg.h\
compat.h\
daemon.h\
debug.h\
envelope.h\
......@@ -49,6 +48,8 @@ pkginclude_HEADERS = \
guile.h\
header.h\
iterator.h\
libargp.h\
libcfg.h\
libsieve.h\
list.h\
locker.h\
......@@ -77,7 +78,8 @@ pkginclude_HEADERS = \
syslog.h\
sql.h\
tls.h\
url.h
url.h\
version.h
nobase_pkginclude_HEADERS = \
sys/nntp.h\
......
......@@ -77,22 +77,6 @@ extern int mu_folder_decrement (mu_folder_t);
extern void mu_list_response_free (void *data);
/* Deprecated calls */
struct mu_0_6_folder_list
{
struct mu_list_response **element;
size_t num;
};
extern int mu_0_6_folder_list (mu_folder_t, const char *, const char *,
struct mu_0_6_folder_list *)
__attribute__((deprecated));
extern int mu_0_6_folder_lsub (mu_folder_t, const char *, const char *,
struct mu_0_6_folder_list *)
__attribute__((deprecated));
extern int mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *)
__attribute__((deprecated));
#ifdef __cplusplus
}
#endif
......
......@@ -17,20 +17,20 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MAILUTILS_CMDLINE_H
#define _MAILUTILS_CMDLINE_H
#ifndef _MAILUTILS_LIBARGP_H
#define _MAILUTILS_LIBARGP_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/types.h"
#include "mailutils/gocs.h"
#include "mailutils/nls.h"
#include "mailutils/error.h"
#include "mailutils/errno.h"
#include "mailutils/version.h"
#include "argp.h"
#include <errno.h> /* May declare program_invocation_name */
#include <strings.h>
#include "errno.h"
#include "strings.h"
#include "mailutils/libcfg.h"
#ifdef __cplusplus
extern "C" {
......@@ -103,8 +103,6 @@ extern struct mu_cmdline_capa mu_sql_cmdline;
extern struct mu_cmdline_capa mu_virtdomain_cmdline;
extern struct mu_cmdline_capa mu_auth_cmdline;
extern char *mu_license_text;
extern void mu_libargp_init (void);
extern struct argp *mu_argp_build (const struct argp *argp);
......@@ -112,8 +110,17 @@ extern void mu_argp_done (struct argp *argp);
extern int mu_register_argp_capa (const char *name, struct argp_child *child);
extern void mu_print_options (void);
extern const char *mu_check_option (char *name);
void mu_argp_init (const char *vers, const char *bugaddr);
int mu_app_init (struct argp *myargp, const char **capa,
struct mu_cfg_param *cfg_param,
int argc, char **argv, int flags, int *pindex, void *data);
error_t mu_argp_parse (const struct argp *myargp,
int *pargc, char **pargv[],
unsigned flags,
const char *capa[],
int *arg_index,
void *input) __attribute__ ((deprecated));
#ifdef __cplusplus
}
......
......@@ -16,9 +16,9 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifndef _MAILUTILS_LIBCFG_H
#define _MAILUTILS_LIBCFG_H
#include <mailutils/cfg.h>
#include <mailutils/gocs.h>
#include <mailutils/nls.h>
......@@ -33,6 +33,10 @@
# define MU_USER_CONFIG_FILE "~/.mailutils"
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct mu_cfg_capa
{
char *name;
......@@ -89,3 +93,8 @@ extern struct mu_cfg_capa mu_sql_cfg_capa;
extern struct mu_cfg_capa mu_tls_cfg_capa;
extern struct mu_cfg_capa mu_virtdomain_cfg_capa;
#ifdef __cplusplus
}
#endif
#endif
......
......@@ -53,9 +53,10 @@
#include <mailutils/types.h>
#include <mailutils/url.h>
#include <mailutils/gocs.h>
#include <mailutils/version.h>
#ifdef MU_COMPAT
# include <mailutils/compat.h>
# error "Version 0.6 is no longer supported. Please, update your program."
#endif
/* EOF */
......
......@@ -16,16 +16,22 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#ifndef _MAILUTILS_VERSION_H
#define _MAILUTILS_VERSION_H
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#include "muinit.h"
extern char *mu_license_text;
extern void mu_print_options (void);
extern void mu_fprint_options (FILE *fp);
extern const char *mu_check_option (char *name);
void
mu_argp_init (const char *vers, const char *bugaddr)
{
argp_program_version = vers ? vers : PACKAGE_STRING;
argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
#ifdef __cplusplus
}
#endif
#endif
......
......@@ -23,11 +23,8 @@ include gnulib.mk
INCLUDES = @MU_COMMON_INCLUDES@
libmuaux_la_SOURCES += \
argpinit.c\
daemon.c\
mailcap.c\
muinit.h\
muinit.c\
mu_dbm.c
noinst_HEADERS +=\
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#include "cmdline.h"
#include "libcfg.h"
void mu_argp_init (const char *vers, const char *bugaddr);
int mu_app_init (struct argp *myargp, const char **capa,
struct mu_cfg_param *cfg_param,
int argc, char **argv, int flags, int *pindex, void *data);
......@@ -20,16 +20,17 @@ INCLUDES = @MU_COMMON_INCLUDES@
AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \
-DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\"
noinst_LIBRARIES = libargp.a
noinst_HEADERS = cmdline.h
lib_LIBRARIES = libmuargp.a
libargp_a_SOURCES =\
libmuargp_a_SOURCES =\
auth.c\
cmdline.c\
common.c\
compat.c\
gsasl.c\
mu_argp.h\
mu_argp.c\
muinit.c\
pam.c\
radius.c\
sieve.c\
......
......@@ -19,8 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
/* ************************************************************************* */
......
......@@ -19,8 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
static struct mu_cmdline_capa *all_cmdline_capa[] = {
&mu_common_cmdline,
......
......@@ -19,8 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include <string.h>
#include <mailutils/syslog.h>
#include <mailutils/daemon.h>
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include "mailutils/libargp.h"
#include "mailutils/argcv.h"
#include "mailutils/mutil.h"
#ifdef WITH_TLS
# include "mailutils/tls.h"
#endif
#ifdef WITH_GSASL
# include "mailutils/gsasl.h"
#endif
#include "mailutils/libsieve.h"
#ifndef MU_COMPAT_CONFIG_FILE
# define MU_COMPAT_CONFIG_FILE SYSCONFDIR "/mailutils.rc"
#endif
#ifndef MU_COMPAT_USER_CONFIG_FILE
# define MU_COMPAT_USER_CONFIG_FILE "~/.mailutils"
#endif
static int
member (const char *array[], const char *text, size_t len)
{
int i;
for (i = 0; array[i]; i++)
if (strncmp (array[i], text, len) == 0)
return 1;
return 0;
}
/* Appends applicable options found in file NAME to argv. If progname
is NULL, all the options found are assumed to apply. Otherwise they
apply only if the line starts with ":something", and something is
found in the CAPA array, or the line starts with PROGNAME.
*/
void
read_rc (const char *progname, const char *name, const char *capa[],
int *argc, char ***argv)
{
FILE *fp;
char *linebuf = NULL;
char *buf = NULL;
size_t n = 0;
int x_argc = *argc;
char **x_argv = *argv;
char* rcfile = mu_tilde_expansion (name, "/", NULL);
if (!rcfile)
return;
fp = fopen (rcfile, "r");
if (!fp)
{
free(rcfile);
return;
}
while (getline (&buf, &n, fp) > 0)
{
char *kwp, *p;
int len;
for (kwp = buf; *kwp && isspace (*kwp); kwp++)
;
if (*kwp == '#' || *kwp == 0)
continue;
len = strlen (kwp);
if (kwp[len-1] == '\n')
kwp[--len] = 0;
if (kwp[len-1] == '\\' || linebuf)
{
int cont;
if (kwp[len-1] == '\\')
{
kwp[--len] = 0;
cont = 1;
}
else
cont = 0;
if (!linebuf)
linebuf = calloc (len + 1, 1);
else
linebuf = realloc (linebuf, strlen (linebuf) + len + 1);
if (!linebuf)
{
fprintf (stderr, _("%s: not enough memory\n"), progname);
exit (1);
}
strcpy (linebuf + strlen (linebuf), kwp);
if (cont)
continue;
kwp = linebuf;
}
len = 0;
if (progname)
{
for (p = kwp; *p && !isspace (*p); p++)
len++;
}
else
p = kwp; /* Use the whole line. */
if (progname == NULL
|| (kwp[0] == ':' && member (capa, kwp+1, len-1))
|| strncmp (progname, kwp, len) == 0
)
{
int i, n_argc = 0;
char **n_argv;
if (mu_argcv_get (p, "", NULL, &n_argc, &n_argv))
{
mu_argcv_free (n_argc, n_argv);
if (linebuf)
free (linebuf);
linebuf = NULL;
continue;
}
x_argv = realloc (x_argv,
(x_argc + n_argc) * sizeof (x_argv[0]));
if (!x_argv)
{
fprintf (stderr, _("%s: not enough memory\n"), progname);
exit (1);
}
for (i = 0; i < n_argc; i++)
x_argv[x_argc++] = mu_tilde_expansion (n_argv[i], "/", NULL);
free (n_argv);
}
if (linebuf)
free (linebuf);
linebuf = NULL;
}
fclose (fp);
free(rcfile);
*argc = x_argc;
*argv = x_argv;
}
void
mu_create_argcv (const char *capa[],
int argc, char **argv, int *p_argc, char ***p_argv)
{
char *progname;
int x_argc;
char **x_argv;
int i;
int rcdir = 0;
progname = strrchr (argv[0], '/');
if (progname)
progname++;
else
progname = argv[0];
x_argv = malloc (sizeof (x_argv[0]));
if (!x_argv)
{
fprintf (stderr, _("%s: not enough memory\n"), progname);
exit (1);
}
/* Add command name */
x_argc = 0;
x_argv[x_argc] = argv[x_argc];
x_argc++;
/* Add global config file. */
read_rc (progname, MU_COMPAT_CONFIG_FILE, capa, &x_argc, &x_argv);
/* Look for per-user config files in ~/.mailutils/ or in ~/, but
not both. This allows mailutils' utilities to have their config
files segregated, if necessary. */
{
struct stat s;
char *rcdirname = mu_tilde_expansion (MU_COMPAT_USER_CONFIG_FILE, "/", NULL);
if (!rcdirname
|| (stat(rcdirname, &s) == 0 && S_ISDIR(s.st_mode)))
rcdir = 1;
free(rcdirname);
}
/* Add per-user config file. */
if (!rcdir)
{
read_rc (progname, MU_COMPAT_USER_CONFIG_FILE, capa, &x_argc, &x_argv);
}
else
{
char *userrc = NULL;
userrc = malloc (sizeof (MU_COMPAT_USER_CONFIG_FILE)
/* provides an extra slot
for null byte as well */
+ 1 /* slash */
+ 9 /*mailutils*/);
if (!userrc)
{
fprintf (stderr, _("%s: not enough memory\n"), progname);
exit (1);
}
sprintf (userrc, "%s/mailutils", MU_COMPAT_USER_CONFIG_FILE);
read_rc (progname, userrc, capa, &x_argc, &x_argv);
free (userrc);
}
/* Add per-user, per-program config file. */
{
char *progrc = NULL;
int size;
if (rcdir)
size = sizeof (MU_COMPAT_USER_CONFIG_FILE)
+ 1
+ strlen (progname)
+ 2 /* rc */;
else
size = 6 /*~/.mu.*/
+ strlen (progname)
+ 3 /* "rc" + null terminator */;
progrc = malloc (size);
if (!progrc)
{
fprintf (stderr, _("%s: not enough memory\n"), progname);
exit (1);
}
if (rcdir)
sprintf (progrc, "%s/%src", MU_COMPAT_USER_CONFIG_FILE, progname);
else
sprintf (progrc, "~/.mu.%src", progname);
read_rc (NULL, progrc, capa, &x_argc, &x_argv);
free (progrc);
}
/* Finally, add the command line options */
x_argv = realloc (x_argv, (x_argc + argc) * sizeof (x_argv[0]));
for (i = 1; i < argc; i++)
x_argv[x_argc++] = argv[i];
x_argv[x_argc] = NULL;
*p_argc = x_argc;
*p_argv = x_argv;
}
error_t
mu_argp_parse (const struct argp *myargp,
int *pargc, char **pargv[],
unsigned flags,
const char *capa[],
int *arg_index,
void *input)
{
struct argp *argp;
error_t rc;
const struct argp argpnull = { 0 };
int i;
/* Make sure we have program version and bug address initialized */
mu_argp_init (argp_program_version, argp_program_bug_address);
mu_set_program_name ((*pargv)[0]);
mu_libargp_init ();
for (i = 0; capa[i]; i++)
{
#ifdef WITH_TLS
if (strcmp (capa[i], "tls") == 0)
mu_gocs_register ("tls", mu_tls_module_init);
else
#endif /* WITH_TLS */
#ifdef WITH_GSASL
if (strcmp (capa[i], "gsasl") == 0)
mu_gocs_register ("gsasl", mu_gsasl_module_init);
else
#endif
if (strcmp (capa[i], "sieve") == 0)
mu_gocs_register ("sieve", mu_sieve_module_init);
else
mu_gocs_register_std (capa[i]);
}
if (!myargp)
myargp = &argpnull;
argp = mu_argp_build (myargp);
rc = argp_parse (argp, *pargc, *pargv, flags, arg_index, input);
mu_argp_done (argp);
if (rc)
return rc;
mu_gocs_flush ();
return 0;
}
......@@ -19,8 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include <mailutils/gsasl.h>
static struct argp_option _gsasl_argp_options[] = {
......
......@@ -20,7 +20,6 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -31,135 +30,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "cmdline.h"
char *mu_license_text =
N_(" GNU Mailutils is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 3 of the License, or\n"
" (at your option) any later version.\n"
"\n"
" GNU Mailutils is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n"
"\n"
" You should have received a copy of the GNU General Public License along\n"
" with GNU Mailutils; if not, write to the Free Software Foundation,\n"
" Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
"\n"
"\n"
);
static char *mu_conf_option[] = {
"VERSION=" VERSION,
#ifdef USE_LIBPAM
"USE_LIBPAM",
#endif
#ifdef HAVE_LIBLTDL
"HAVE_LIBLTDL",
#endif
#ifdef WITH_BDB2
"WITH_BDB2",
#endif
#ifdef WITH_NDBM
"WITH_NDBM",
#endif
#ifdef WITH_OLD_DBM
"WITH_OLD_DBM",
#endif
#ifdef WITH_GDBM
"WITH_GDBM",
#endif
#ifdef WITH_GNUTLS
"WITH_GNUTLS",
#endif
#ifdef WITH_GSASL
"WITH_GSASL",
#endif
#ifdef WITH_GSSAPI
"WITH_GSSAPI",
#endif
#ifdef WITH_GUILE
"WITH_GUILE",
#endif
#ifdef WITH_PTHREAD
"WITH_PTHREAD",
#endif
#ifdef WITH_READLINE
"WITH_READLINE",
#endif
#ifdef HAVE_MYSQL
"HAVE_MYSQL",
#endif
#ifdef HAVE_PGSQL
"HAVE_PGSQL",
#endif
#ifdef ENABLE_VIRTUAL_DOMAINS
"ENABLE_VIRTUAL_DOMAINS",
#endif
#ifdef ENABLE_IMAP
"ENABLE_IMAP",
#endif
#ifdef ENABLE_POP
"ENABLE_POP",
#endif
#ifdef ENABLE_MH
"ENABLE_MH",
#endif
#ifdef ENABLE_MAILDIR
"ENABLE_MAILDIR",
#endif
#ifdef ENABLE_SMTP
"ENABLE_SMTP",
#endif
#ifdef ENABLE_SENDMAIL
"ENABLE_SENDMAIL",
#endif
#ifdef ENABLE_NNTP
"ENABLE_NNTP",
#endif
#ifdef ENABLE_RADIUS
"ENABLE_RADIUS",
#endif
#ifdef WITH_INCLUDED_LIBINTL
"WITH_INCLUDED_LIBINTL",
#endif
NULL
};
void
mu_print_options ()
{
int i;
for (i = 0; mu_conf_option[i]; i++)
printf ("%s\n", mu_conf_option[i]);
}
const char *
mu_check_option (char *name)
{
int i;
for (i = 0; mu_conf_option[i]; i++)
{
int len;
char *q, *p = strchr (mu_conf_option[i], '=');
if (p)
len = p - mu_conf_option[i];
else
len = strlen (mu_conf_option[i]);
if (strncasecmp (mu_conf_option[i], name, len) == 0)
return mu_conf_option[i];
else if ((q = strchr (mu_conf_option[i], '_')) != NULL
&& strncasecmp (q + 1, name,
len - (q - mu_conf_option[i]) - 1) == 0)
return mu_conf_option[i];
}
return NULL;
}
#include "mailutils/libargp.h"
/* ************************************************************************* */
......
......@@ -20,7 +20,15 @@
# include <config.h>
#endif
#include "muinit.h"
#include "mailutils/libcfg.h"
#include "mailutils/libargp.h"
void
mu_argp_init (const char *vers, const char *bugaddr)
{
argp_program_version = vers ? vers : PACKAGE_STRING;
argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
}
int
mu_app_init (struct argp *myargp, const char **capa,
......
......@@ -20,7 +20,7 @@
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include <mailutils/pam.h>
static char *service_name;
......
......@@ -20,7 +20,7 @@
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include <mailutils/radius.h>
static struct argp_option mu_radius_argp_option[] = {
......
......@@ -20,7 +20,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include "mailutils/libsieve.h"
......
......@@ -20,7 +20,7 @@
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include "mailutils/sql.h"
#include "mailutils/mutil.h"
......
......@@ -20,7 +20,7 @@
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
#include <mailutils/tls.h>
static struct argp_option _tls_argp_options[] = {
......
......@@ -20,7 +20,7 @@
# include <config.h>
#endif
#include "cmdline.h"
#include "mailutils/libargp.h"
static char *virtdir;
......
......@@ -21,7 +21,6 @@ AM_CFLAGS = -DSITE_VIRTUAL_PWDDIR=\"@SITE_VIRTUAL_PWDDIR@\" \
-DSITE_CRAM_MD5_PWD=\"@SITE_CRAM_MD5_PWD@\"
lib_LTLIBRARIES = libmucfg.la
noinst_HEADERS = libcfg.h
libmucfg_la_SOURCES=\
auth.c\
common.c\
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/mu_auth.h>
#include <string.h>
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <string.h>
#include <mailutils/daemon.h>
......@@ -124,3 +127,4 @@ static struct mu_cfg_param mu_daemon_param[] = {
{ NULL }
};
DCL_CFG_CAPA (daemon);
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/gsasl.h>
static struct mu_gsasl_module_data gsasl_settings;
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <string.h>
#include <stdlib.h>
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
static char *pam_settings;
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/radius.h>
static struct mu_radius_module_data radius_settings;
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/libsieve.h>
static struct mu_gocs_sieve sieve_settings;
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/sql.h>
#include <mailutils/mutil.h>
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
#include <mailutils/tls.h>
static struct mu_tls_module_config tls_settings;
......
......@@ -15,7 +15,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "libcfg.h"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "mailutils/libcfg.h"
static char *virtdomain_settings;
......
......@@ -91,7 +91,7 @@
# define USE_MAILBOX_QUOTAS 1
#endif
#include "muinit.h"
#include "mailutils/libargp.h"
/* Debug */
extern int debug_level;
......
......@@ -18,7 +18,7 @@
MA 02110-1301 USA */
#include <mail.local.h>
#include "muinit.h"
#include "mailutils/libargp.h"
int multiple_delivery; /* Don't return errors when delivering to multiple
recipients */
......
......@@ -43,7 +43,7 @@
#include <mailutils/error.h>
#include <mailutils/nls.h>
#include <mailutils/mu_auth.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "mail.remote (" PACKAGE_STRING ")";
static char doc[] =
......
......@@ -18,7 +18,7 @@
MA 02110-1301 USA */
#include "mail.h"
#include "muinit.h"
#include "mailutils/libargp.h"
/* Global variables and constants*/
mu_mailbox_t mbox; /* Mailbox being operated upon */
......
......@@ -95,6 +95,7 @@ libmailutils_la_SOURCES = \
tcp.c\
ticket.c\
url.c\
version.c\
wicket.c\
imaxtostr.c offtostr.c umaxtostr.c
......
......@@ -635,7 +635,7 @@ _mu_parse_config (char *file, char *progname,
NULL,
NULL);
if (rc == 0)
if (rc == 0 && root_container)
{
struct mu_cfg_cont *cont = root_container;
......
......@@ -442,88 +442,3 @@ is_known_folder (mu_url_t url, mu_folder_t *pfolder)
return ret;
}
/* Deprecated functions */
static int
list_to_0_6_folder_list (mu_list_t flist, struct mu_0_6_folder_list *pflist)
{
int status = 0;
size_t count;
mu_list_count (flist, &count);
pflist->num = count;
if (count == 0)
pflist->element = NULL;
else
{
pflist->element = calloc (count, sizeof (pflist->element[0]));
if (!pflist->element)
status = ENOMEM;
else
{
size_t i;
mu_iterator_t itr;
mu_list_set_destroy_item (flist, NULL);
mu_list_get_iterator (flist, &itr);
for (mu_iterator_first (itr), i = 0;
!mu_iterator_is_done (itr); mu_iterator_next(itr), i++)
mu_iterator_current (itr, (void**) &pflist->element[i]);
mu_iterator_destroy (&itr);
}
}
return status;
}
int
mu_0_6_folder_list (mu_folder_t folder,
const char *dirname, const char *basename,
struct mu_0_6_folder_list *pflist)
{
mu_list_t flist;
int status = 0;
status = mu_folder_list (folder, dirname, basename, 0, &flist);
if (status)
return status;
status = list_to_0_6_folder_list (flist, pflist);
mu_list_destroy (&flist);
return status;
}
int
mu_0_6_folder_lsub (mu_folder_t folder,
const char *dirname, const char *basename,
struct mu_0_6_folder_list *pflist)
{
mu_list_t flist;
int status = 0;
status = mu_folder_lsub (folder, dirname, basename, &flist);
if (status)
return status;
status = list_to_0_6_folder_list (flist, pflist);
mu_list_destroy (&flist);
return status;
}
int
mu_0_6_folder_list_destroy (struct mu_0_6_folder_list *pflist)
{
size_t i;
if (pflist == NULL)
return 0;
for (i = 0 ; i < pflist->num; i++)
{
if (pflist->element[i])
{
if (pflist->element[i]->name)
free (pflist->element[i]->name);
free (pflist->element[i]);
}
}
if (i > 0)
free (pflist->element);
pflist->element = NULL;
pflist->num = 0;
return 0;
}
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 2007 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <mailutils/nls.h>
#include <stdio.h>
#include <string.h>
char *mu_license_text =
N_(" GNU Mailutils is free software; you can redistribute it and/or modify\n"
" it under the terms of the GNU General Public License as published by\n"
" the Free Software Foundation; either version 3 of the License, or\n"
" (at your option) any later version.\n"
"\n"
" GNU Mailutils is distributed in the hope that it will be useful,\n"
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
" GNU General Public License for more details.\n"
"\n"
" You should have received a copy of the GNU General Public License along\n"
" with GNU Mailutils; if not, write to the Free Software Foundation,\n"
" Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n"
"\n"
"\n"
);
static char *mu_conf_option[] = {
"VERSION=" VERSION,
#ifdef USE_LIBPAM
"USE_LIBPAM",
#endif
#ifdef HAVE_LIBLTDL
"HAVE_LIBLTDL",
#endif
#ifdef WITH_BDB2
"WITH_BDB2",
#endif
#ifdef WITH_NDBM
"WITH_NDBM",
#endif
#ifdef WITH_OLD_DBM
"WITH_OLD_DBM",
#endif
#ifdef WITH_GDBM
"WITH_GDBM",
#endif
#ifdef WITH_GNUTLS
"WITH_GNUTLS",
#endif
#ifdef WITH_GSASL
"WITH_GSASL",
#endif
#ifdef WITH_GSSAPI
"WITH_GSSAPI",
#endif
#ifdef WITH_GUILE
"WITH_GUILE",
#endif
#ifdef WITH_PTHREAD
"WITH_PTHREAD",
#endif
#ifdef WITH_READLINE
"WITH_READLINE",
#endif
#ifdef HAVE_MYSQL
"HAVE_MYSQL",
#endif
#ifdef HAVE_PGSQL
"HAVE_PGSQL",
#endif
#ifdef ENABLE_VIRTUAL_DOMAINS
"ENABLE_VIRTUAL_DOMAINS",
#endif
#ifdef ENABLE_IMAP
"ENABLE_IMAP",
#endif
#ifdef ENABLE_POP
"ENABLE_POP",
#endif
#ifdef ENABLE_MH
"ENABLE_MH",
#endif
#ifdef ENABLE_MAILDIR
"ENABLE_MAILDIR",
#endif
#ifdef ENABLE_SMTP
"ENABLE_SMTP",
#endif
#ifdef ENABLE_SENDMAIL
"ENABLE_SENDMAIL",
#endif
#ifdef ENABLE_NNTP
"ENABLE_NNTP",
#endif
#ifdef ENABLE_RADIUS
"ENABLE_RADIUS",
#endif
#ifdef WITH_INCLUDED_LIBINTL
"WITH_INCLUDED_LIBINTL",
#endif
NULL
};
void
mu_fprint_options (FILE *fp)
{
int i;
for (i = 0; mu_conf_option[i]; i++)
fprintf (fp, "%s\n", mu_conf_option[i]);
}
void
mu_print_options (FILE *fp)
{
mu_fprint_options (stdout);
}
const char *
mu_check_option (char *name)
{
int i;
for (i = 0; mu_conf_option[i]; i++)
{
int len;
char *q, *p = strchr (mu_conf_option[i], '=');
if (p)
len = p - mu_conf_option[i];
else
len = strlen (mu_conf_option[i]);
if (strncasecmp (mu_conf_option[i], name, len) == 0)
return mu_conf_option[i];
else if ((q = strchr (mu_conf_option[i], '_')) != NULL
&& strncasecmp (q + 1, name,
len - (q - mu_conf_option[i]) - 1) == 0)
return mu_conf_option[i];
}
return NULL;
}
......@@ -27,7 +27,7 @@
#endif
#include <mailutils/mailutils.h>
#include "muinit.h"
#include "mailutils/libargp.h"
static int messages_count (const char *);
......
......@@ -194,7 +194,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -118,7 +118,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -550,7 +550,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -212,7 +212,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -105,7 +105,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -937,7 +937,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -425,7 +425,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -181,7 +181,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -71,7 +71,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_auto_install = 0;
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -194,7 +194,7 @@ main (int argc, char **argv)
mu_url_t url;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -94,6 +94,13 @@ my_argp_parse (struct argp *argp, int argc, char **argv, int flags,
return rc;
}
void
mh_argp_init (const char *vers)
{
argp_program_version = vers ? vers : PACKAGE_STRING;
argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
}
int
mh_argp_parse (int *pargc, char **pargv[],
int flags,
......
......@@ -18,7 +18,7 @@
#include <mailutils/nls.h>
#include "argp.h"
#include "muinit.h"
#include "mailutils/libargp.h"
#define MH_OPT_BOOL 1
#define MH_OPT_ARG 2
......@@ -182,6 +182,7 @@ enum mh_arg {
ARG_ZERO
};
void mh_argp_init (const char *vers);
void mh_argv_preproc (int argc, char **argv, struct mh_argp_data *data);
int mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc);
int mh_argp_parse (int *argc, char **argv[],
......
......@@ -223,7 +223,7 @@ main (int argc, char **argv)
interactive = isatty (1) && isatty (0);
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -2763,7 +2763,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -125,7 +125,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -82,7 +82,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -348,7 +348,7 @@ main (int argc, char **argv)
flags = mh_interactive_mode_p () ? 0 : ARGP_NO_ERRS;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, flags, options, mh_option,
args_doc, doc, opt_handler, NULL, &index);
if (pick_parse (lexlist))
......
......@@ -231,7 +231,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -405,7 +405,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -194,7 +194,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, NULL);
......
......@@ -77,7 +77,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -178,7 +178,7 @@ main (int argc, char **argv)
/* Native Language Support */
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -734,7 +734,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -554,7 +554,7 @@ main (int argc, char **argv)
mu_url_t url;
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option,
args_doc, doc, opt_handler, NULL, &index);
if (!oplist)
......
......@@ -108,7 +108,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
argc -= index;
......
......@@ -113,7 +113,7 @@ main (int argc, char **argv)
mu_init_nls ();
mu_argp_init (program_version, NULL);
mh_argp_init (program_version);
mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
opt_handler, NULL, &index);
......
......@@ -21,6 +21,7 @@
# include <config.h>
#endif
#include <ctype.h>
#include <mimeview.h>
#include <mimetypes-decl.h>
......
......@@ -25,7 +25,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "mimeview (" PACKAGE_STRING ")";
static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.")
......
......@@ -25,7 +25,7 @@
#include <mailutils/mailutils.h>
#include <mailutils/tls.h>
#include <mu_asprintf.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "movemail (" PACKAGE_STRING ")";
static char doc[] = N_("GNU movemail");
......
......@@ -18,7 +18,7 @@
MA 02110-1301 USA */
#include "pop3d.h"
#include "muinit.h"
#include "mailutils/libargp.h"
static mu_stream_t istream, ostream;
......
......@@ -19,7 +19,7 @@
#include "pop3d.h"
#include "mailutils/pam.h"
#include "muinit.h"
#include "mailutils/libargp.h"
mu_mailbox_t mbox;
int state;
......
......@@ -19,7 +19,7 @@
#include "pop3d.h"
#include <mailutils/argcv.h>
#include <xalloc.h>
#include "muinit.h"
#include "mailutils/libargp.h"
int db_list (char *input_name, char *output_name);
int db_make (char *input_name, char *output_name);
......
......@@ -23,7 +23,7 @@
#include "readmsg.h"
#include "xalloc.h"
#include "muinit.h"
#include "mailutils/libargp.h"
#define WEEDLIST_SEPARATOR " :,"
......
......@@ -45,7 +45,7 @@
#include <mailutils/nls.h>
#include <mailutils/tls.h>
#include "muinit.h"
#include "mailutils/libargp.h"
const char *program_version = "sieve (" PACKAGE_STRING ")";
......