summaryrefslogtreecommitdiff
path: root/libsieve/argp.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-17 16:38:20 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-11-17 16:38:20 +0000
commitcd6f3aa2be6ee19afc67b2d187542418f8b5a609 (patch)
tree571ac29d848960cb73545c9be46a31ac363d847f /libsieve/argp.c
parent7e7a878f730f23533e2101ea88ae40cc9e204dff (diff)
downloadmailutils-cd6f3aa2be6ee19afc67b2d187542418f8b5a609.tar.gz
mailutils-cd6f3aa2be6ee19afc67b2d187542418f8b5a609.tar.bz2
Move rc file and argp parsing into separate abstract layers.
* include/mailutils/gocs.h, include/mailutils/pam.h, include/mailutils/radius.h, include/mailutils/syslog.h: New files * lib/argpinit.c, lib/muinit.c, lib/muinit.h: New files. * libsieve/conf.c: New file. * libcfg: New directory * libcfg/libcfg.h, libcfg/auth.c, libcfg/common.c, libcfg/init.c, libcfg/gsasl.c, libcfg/pam.c, libcfg/radius.c, libcfg/sieve.c, libcfg/sql.c, libcfg/tls.c, libcfg/virtdomain.c, libcfg/.cvsignore: New files. * libargp: New directory * libargp/auth.c, libargp/cmdline.h, libargp/common.c, libargp/gsasl.c, libargp/mu_argp.h, libargp/mu_argp.c, libargp/pam.c, libargp/radius.c, libargp/sieve.c, libargp/sql.c, libargp/tls.c, libargp/virtdomain.c, libargp/.cvsignore: New files. * mailbox/.cvsignore: Add cfg_parser.c and cfg_parser.h. * Makefile.am (SUBDIRS): Add libargp and libcfg. * configure.ac (MU_APP_LIBRARIES): New variable (MU_COMMON_INCLUDES): add libargp and libcfg (AC_CONFIG_FILES): Add libargp and libcfg. * auth/gsasl.c, auth/pam.c, auth/radius.c, auth/sql.c, auth/sql.h, auth/tls.c, auth/virtual.c, comsat/comsat.h, frm/frm.h, guimb/guimb.h, imap4d/imap4d.h, include/mailutils/gsasl.h, include/mailutils/libsieve.h, include/mailutils/mailutils.h, include/mailutils/mu_auth.h, include/mailutils/tls.h, include/mailutils/sql.h, maidag/maidag.h, mail/mail.h, mail.local/mail.local.h, mailbox/daemon.c, mailbox/system.c, mh/mh_argp.c, mh/mh_getopt.h, pop3d/pop3d.h, readmsg/readmsg.h: Remove argp stuff * comsat/comsat.c, config/mailutils-config.c, dotlock/dotlock.c, examples/muauth.c, examples/muemail.c, frm/frm.c, frm/from.c, guimb/main.c, imap4d/idle.c, imap4d/imap4d.c, imap4d/util.c, imap4d/version.c, maidag/lmtp.c, maidag/maidag.c, maidag/mailquota.c, mail/mail.c, mail/send.c, mail/version.c, mail.local/mailquota.c, mail.local/main.c, mail.remote/mail.remote.c, mailbox/mu_auth.c, messages/messages.c, mimeview/mimeview.c, movemail/movemail.c, pop3d/extra.c, pop3d/pop3d.c, pop3d/popauth.c, readmsg/readmsg.c, sieve/sieve.c: Use mu_app_init for parsing command line and configuration files. * comsat/Makefile.am, config/Makefile.am, dotlock/Makefile.am, examples/Makefile.am, frm/Makefile.am, guimb/Makefile.am, imap4d/Makefile.am, maidag/Makefile.am, mail/Makefile.am, mail.local/Makefile.am, mail.remote/Makefile.am, mailbox/Makefile.am, messages/Makefile.am, mimeview/Makefile.am, movemail/Makefile.am, pop3d/Makefile.am, readmsg/Makefile.am, sieve/Makefile.am: Use MU_APP_LIBRARIES. * include/mailutils/Makefile.am: Add new files. * include/mailutils/argp.h: Remove. * include/mailutils/cfg.h: New file. * include/mailutils/daemon.h (MODE_INTERACTIVE,MODE_DAEMON): New defines (from removed argp.h). (mu_gocs_daemon): New decl. * include/mailutils/error.h (mu_program_name): New variable (mu_set_program_name): New function. * lib/Makefile.am (libmuaux_la_SOURCES): Add new files. * libsieve/Makefile.am (libsieve_la_SOURCES): Remove argp.c, add conf.c instead. * libsieve/argp.c: Remove. * mailbox/cfg_parser.y (mu_cfg_parse_boolean): New function. * mailbox/mu_argp.c: Remove. * mailbox/muerror.c (mu_program_name): New variable (mu_set_program_name): New function (mu_default_error_printer): Print program name before diagnostic string. * mailbox/mutil.c (mu_sql_decode_password_type): New function. * mh/mh_whom.c (mh_alias_expand): Bugfix * po/POTFILES.in: Update * testsuite/lib/mailutils.exp (mu_init): Pass --no-site-rcfile --no-user-rcfile to all programs.
Diffstat (limited to 'libsieve/argp.c')
-rw-r--r--libsieve/argp.c124
1 files changed, 0 insertions, 124 deletions
diff --git a/libsieve/argp.c b/libsieve/argp.c
deleted file mode 100644
index 488f88772..000000000
--- a/libsieve/argp.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999, 2000, 2001, 2002, 2005,
- 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 <sieve.h>
-#include <mailutils/argp.h>
-#include <string.h>
-
-mu_list_t mu_sieve_include_path = NULL;
-mu_list_t mu_sieve_library_path = NULL;
-
-static error_t sieve_argp_parser (int key, char *arg, struct argp_state *state);
-
-#define CLEARPATH_OPTION 256
-
-/* Options used by programs that use extended authentication mechanisms. */
-static struct argp_option sieve_argp_option[] = {
- { "includedir", 'I', N_("DIR"), 0,
- N_("Append directory DIR to the list of directories searched for include files"), 0 },
- { "libdir", 'L', N_("DIR"), 0,
- N_("Append directory DIR to the list of directories searched for library files"), 0 },
- { "clearpath", CLEARPATH_OPTION, NULL, 0,
- N_("Clear Sieve load path"), 0 },
- { NULL, 0, NULL, 0, NULL, 0 }
-};
-
-static struct argp sieve_argp = {
- sieve_argp_option,
- sieve_argp_parser,
-};
-
-static struct argp_child sieve_argp_child = {
- &sieve_argp,
- 0,
- "Sieve options",
- 0
-};
-
-static void
-destroy_string (void *str)
-{
- free (str);
-}
-
-static error_t
-sieve_argp_parser (int key, char *arg, struct argp_state *state)
-{
- mu_list_t *plist = NULL;
-
- switch (key)
- {
- case 'I':
- plist = &mu_sieve_include_path;
- break;
-
- case 'L':
- plist = &mu_sieve_library_path;
- break;
-
- case CLEARPATH_OPTION:
- mu_list_destroy (&mu_sieve_library_path);
- break;
-
- case ARGP_KEY_INIT:
-#ifdef SIEVE_MODDIR
- plist = &mu_sieve_library_path;
- arg = SIEVE_MODDIR;
-#endif
- break;
-
- case ARGP_KEY_FINI:
- sieve_load_add_path (mu_sieve_library_path);
- break;
-
- default:
- return ARGP_ERR_UNKNOWN;
- }
-
- if (plist)
- {
- if (!*plist)
- {
- int rc = mu_list_create (plist);
- if (rc)
- {
- argp_error (state, "can't create list: %s",
- mu_strerror (rc));
- exit (1);
- }
- mu_list_set_destroy_item (*plist, destroy_string);
- }
- mu_list_append (*plist, strdup (arg));
- }
-
- return 0;
-}
-
-void
-mu_sieve_argp_init ()
-{
- if (mu_register_capa ("sieve", &sieve_argp_child, NULL))
- {
- mu_error ("INTERNAL ERROR: cannot register argp capability sieve");
- abort ();
- }
-}

Return to:

Send suggestions and report system problems to the System administrator.