commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. release-2.2-157-geb3a07e


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-157-geb3a07e
Date: Sun, 24 Oct 2010 18:40:57 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=eb3a07ec466ebc923230618d059bdb4c29b170b9

The branch, master has been updated
       via  eb3a07ec466ebc923230618d059bdb4c29b170b9 (commit)
       via  686a73448881868fbbf0a6d9d83fa3fc6fc692af (commit)
      from  be1380d7aa53c031a237b5e993187733eab3fa40 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eb3a07ec466ebc923230618d059bdb4c29b170b9
Author: Sergey Poznyakoff <address@hidden>
Date:   Sun Oct 24 21:18:58 2010 +0300

    Move `mailutils-config' functionality to `mu'.  Retain `mailutils-config' 
for backward compatibility.
    
    * config/.gitignore: Remove.
    * config/Makefile.am: Remove.
    * config/mailutils-config.c: Remove.
    * config/maint.mk: Remove.
    * config/mailutils.m4: Move to mu-aux/mailutils.m4
    * mu-aux/Makefile.am (m4datadir, dist_m4data_DATA): New variables.
    
    * Makefile.am (SUBDIRS) <config>: Remove.
    * configure.ac (AC_CONFIG_FILES): Remove config.
    
    * mu/mailutils-config: New file.
    * mu/cflags.c: New file.
    * mu/ldflags.c: New file.
    * mu/Makefile.am (dist_bin_SCRIPTS, EXTRA_DIST): Add mailutils-config.
    (mu_SOURCES): Add cflags.c and ldflags.c.
    (AM_CPPFLAGS): New variable.
    * mu/mu.c: Add new modes: cflags and ldflags.
    * mu/mu.h (mutool_ldflags, mutool_cflags): New protos.
    * po/POTFILES.in: Update.

commit 686a73448881868fbbf0a6d9d83fa3fc6fc692af
Author: Sergey Poznyakoff <address@hidden>
Date:   Sun Oct 24 19:09:58 2010 +0300

    New `mu' mode: wicket.
    
    * mu/wicket.c: New file.
    * mu/mu.h (mutool_wicket): New proto.
    * mu/mu.c (mutool_action_tab): Add an entry for wicket mode.
    * mu/Makefile.am (mu_SOURCES): Add wicket.c
    * .gitignore: Update.

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                      |    1 +
 Makefile.am                     |    1 -
 config/.gitignore               |    5 -
 config/Makefile.am              |   39 ----
 config/mailutils-config.c       |  367 ---------------------------------------
 config/maint.mk                 |   29 ---
 configure.ac                    |    1 -
 libmailutils/cfg/.gitignore     |    6 +-
 mu-aux/Makefile.am              |    2 +
 {config => mu-aux}/mailutils.m4 |    0
 mu/Makefile.am                  |   14 ++-
 lib/signal.c => mu/cflags.c     |   43 +++--
 mu/ldflags.c                    |  193 ++++++++++++++++++++
 mu/mailutils-config             |  109 ++++++++++++
 mu/mu.c                         |    6 +
 mu/mu.h                         |    5 +-
 mu/wicket.c                     |  196 +++++++++++++++++++++
 po/POTFILES.in                  |    5 +-
 18 files changed, 555 insertions(+), 467 deletions(-)
 delete mode 100644 config/.gitignore
 delete mode 100644 config/Makefile.am
 delete mode 100644 config/mailutils-config.c
 delete mode 100644 config/maint.mk
 rename {config => mu-aux}/mailutils.m4 (100%)
 copy lib/signal.c => mu/cflags.c (59%)
 create mode 100644 mu/ldflags.c
 create mode 100755 mu/mailutils-config
 create mode 100644 mu/wicket.c

diff --git a/.gitignore b/.gitignore
index d827e24..a530f29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ config.h.in
 config.log
 config.status
 configure
+core
 git-describe
 git-describe.h
 libtool
diff --git a/Makefile.am b/Makefile.am
index 3558c92..aed3f5a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -104,7 +104,6 @@ SUBDIRS = . \
  libmu_sieve\
  $(PYTHON_DIR)\
  doc\
- config\
  examples\
  mu\
  $(FRM_DIR)\
diff --git a/config/.gitignore b/config/.gitignore
deleted file mode 100644
index 94e05b5..0000000
--- a/config/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-mailutils-config
diff --git a/config/Makefile.am b/config/Makefile.am
deleted file mode 100644
index b850f7f..0000000
--- a/config/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-## This file is part of GNU Mailutils.
-## Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software
-## Foundation, Inc.
-##
-## GNU Mailutils is free software; you can redistribute it and/or
-## modify it under the terms of the GNU General Public License as
-## published by the Free Software Foundation; either version 3, or (at
-## your option) any later version.
-##
-## GNU Mailutils 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
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
-
-INCLUDES = @MU_APP_COMMON_INCLUDES@ 
-
-bin_PROGRAMS = mailutils-config
-
-mailutils_config_SOURCES = mailutils-config.c
-mailutils_config_LDADD = \
- ${MU_APP_LIBRARIES}\
- ${MU_LIB_MAILUTILS}\
- @MU_COMMON_LIBRARIES@
-
-mailutils_config_CFLAGS = -DCOMPILE_FLAGS="\"-I$(includedir)\"" \
-  -I$(top_srcdir)/intl \
-  -I${top_srcdir}/lib \
-  -DLINK_FLAGS="\"-L$(libdir)\"" \
-  -DLINK_POSTFLAGS="\"$(MU_LINK_POSTFLAGS)\"" \
-  -DAUTHLIBS="\"$(MU_AUTHLIBS)\"" \
-  -DGUILE_LIBS="\"$(GUILE_LIBS)\"" \
-  -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \
-  -DI18NLIBS="\"$(LIBINTL)\""
-
-m4datadir = $(datadir)/aclocal
-dist_m4data_DATA = mailutils.m4
diff --git a/config/mailutils-config.c b/config/mailutils-config.c
deleted file mode 100644
index 6a34497..0000000
--- a/config/mailutils-config.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 1999, 2000, 2001, 2002, 2007, 2009, 2010 Free Software
-   Foundation, Inc.
-
-   GNU Mailutils is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
-
-   GNU Mailutils 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 General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <string.h>
-#include <mailutils/mailutils.h>
-#include <mu_asprintf.h>
-#include "mailutils/libargp.h"
-
-static char doc[] = N_("GNU mailutils-config -- display compiler and loader 
options needed for building a program with mailutils.");
-static char args_doc[] = N_("[arg...]");
-
-static struct argp_option options[] = {
-  {"compile", 'c', NULL,   0,
-   N_("print C compiler flags to compile with"), 0},
-  {"link",    'l', NULL,   0,
-   N_("print libraries to link with; possible arguments are: auth, guile, "
-      "mbox, mh, maildir, mailer, imap, pop, sieve and all"), 0},
-  {"info", 'i', NULL, 0,
-   N_("print a list of configuration options used to build mailutils; "
-      "optional arguments are interpreted as a list of configuration "
-      "options to check for"), 0},
-  {"query", 'q', N_("FILE"), OPTION_ARG_OPTIONAL,
-   N_("query configuration values from FILE (default mailutils.rc)"),
-   0 },
-  {"verbose", 'v', NULL, 0,
-   N_("increase output verbosity"), 0},
-  {0, 0, 0, 0}
-};
-
-enum config_mode {
-  MODE_VOID,
-  MODE_COMPILE,
-  MODE_LINK,
-  MODE_INFO,
-  MODE_QUERY
-};
-
-enum config_mode mode;
-int verbose;
-char *query_config_file;
-
-static error_t
-parse_opt (int key, char *arg, struct argp_state *state)
-{
-  switch (key)
-    {
-    case 'l':
-      mode = MODE_LINK;
-      break;
-
-    case 'c':
-      mode = MODE_COMPILE;
-      break;
-
-    case 'i':
-      mode = MODE_INFO;
-      break;
-
-    case 'q':
-      if (arg)
-       query_config_file = arg;
-      mode = MODE_QUERY;
-      break;
-      
-    case 'v':
-      verbose++;
-      break;
-      
-    default: 
-      return ARGP_ERR_UNKNOWN;
-    }
-  return 0;
-}
-
-static struct argp argp = {
-  options,
-  parse_opt,
-  args_doc,
-  doc,
-  NULL,
-  NULL, NULL
-};
-
-static const char *argp_capa[] = {
-  "common",
-  "license",
-  NULL
-};
-
-#ifdef WITH_TLS
-# define NEEDAUTH 1
-#else
-# define NEEDAUTH 0
-#endif
-#define NOTALL   2
-
-struct lib_descr {
-  char *name;
-  char *libname;
-  int flags;
-} lib_descr[] = {
-  { "mbox",   "mu_mbox", 0 },
-  { "mh",     "mu_mh",   0 },
-  { "maildir","mu_maildir", 0 },
-  { "imap",   "mu_imap", NEEDAUTH },
-  { "pop",    "mu_pop",  NEEDAUTH },
-  { "nntp",   "mu_nntp", 0 },
-  { "mailer", "mu_mailer", 0 },
-  { "sieve",  "mu_sieve", NOTALL },
-  { NULL }
-};
-
-struct lib_entry {
-  int level;
-  char *ptr;
-} lib_entry[16];
-
-int nentry;
-
-void
-add_entry (int level, char *ptr)
-{
-  int i;
-  if (nentry >= sizeof(lib_entry)/sizeof(lib_entry[0]))
-    {
-      mu_error (_("too many arguments"));
-      exit (1);
-    }
-  
-  for (i = 0; i < nentry; i++)
-    if (strcmp (lib_entry[i].ptr, ptr) == 0)
-      return;
-  lib_entry[nentry].level = level;
-  lib_entry[nentry].ptr = ptr;
-  nentry++;
-}
-
-/* Sort the entries by their level. */
-void
-sort_entries ()
-{
-  int j;
-
-  for (j = 0; j < nentry; j++)
-    {
-      int i;
-             
-      for (i = j; i < nentry; i++)
-       if (lib_entry[j].level > lib_entry[i].level)
-         {
-           struct lib_entry tmp;
-           tmp = lib_entry[i];
-           lib_entry[i] = lib_entry[j];
-           lib_entry[j] = tmp;
-         }
-      
-    }
-}
-
-int
-main (int argc, char **argv)
-{
-  int index;
-  int i, rc;
-  struct argp *myargp;
-  char **excapa;
-  mu_cfg_tree_t *tree = NULL;
-  mu_stream_t stream;
-  int fmtflags = 0;
-  
-  mu_argp_init (NULL, NULL);
-
-  mu_set_program_name (argv[0]);
-  mu_libargp_init ();
-  for (i = 0; argp_capa[i]; i++)
-    mu_gocs_register_std (argp_capa[i]); /*FIXME*/
-  myargp = mu_argp_build (&argp, &excapa);
-  
-  if (argp_parse (myargp, argc, argv, 0, &index, NULL))
-    {
-      argp_help (myargp, stdout, ARGP_HELP_SEE, program_invocation_short_name);
-      return 1;
-    }
-  mu_argp_done (myargp);
-  mu_set_program_name (program_invocation_name);
-  
-  argc -= index;
-  argv += index;
-  
-  switch (mode)
-    {
-    case MODE_VOID:
-      break;
-
-    case MODE_LINK:
-       {
-         int j;
-         char *ptr;
-         
-         add_entry (-100, LINK_FLAGS);
-         add_entry (100, LINK_POSTFLAGS);
-         add_entry (1, "-lmailutils");
-#ifdef ENABLE_NLS
-         if (sizeof (I18NLIBS) > 1)
-           add_entry (10, I18NLIBS);
-#endif
-
-         for ( ; argc > 0; argc--, argv++)
-           {
-             if (strcmp (argv[0], "auth") == 0)
-               {
-                 add_entry (2, "-lmu_auth " AUTHLIBS);
-               }
-#ifdef WITH_GUILE            
-             else if (strcmp (argv[0], "guile") == 0)
-               {
-                 add_entry (-1, "-lmu_scm " GUILE_LIBS);
-               }
-#endif
-#ifdef WITH_PYTHON
-             else if (strcmp (argv[0], "python") == 0)
-               {
-                 add_entry (-1, "-lmu_py " PYTHON_LIBS);
-               }
-#endif
-             else if (strcmp (argv[0], "cfg") == 0)
-               add_entry (-1, "-lmu_cfg");
-             else if (strcmp (argv[0], "argp") == 0)
-               add_entry (-2, "-lmu_argp");
-             else if (strcmp (argv[0], "all") == 0)
-               {
-                 struct lib_descr *p;
-                 
-                 for (p = lib_descr; p->name; p++)
-                   {
-                     if (p->flags & NOTALL)
-                       continue;
-                     asprintf (&ptr, "-l%s", p->libname);
-                     add_entry (0, ptr);
-                     if (p->flags & NEEDAUTH)
-                       add_entry (2, "-lmu_auth " AUTHLIBS);
-                   }
-               }
-             else
-               {
-                 struct lib_descr *p;
-                 
-                 for (p = lib_descr; p->name; p++)
-                   if (mu_c_strcasecmp (p->name, argv[0]) == 0)
-                     break;
-
-                 if (p->name)
-                   {
-                     asprintf (&ptr, "-l%s", p->libname);
-                     add_entry (0, ptr);
-                     if (p->flags & NEEDAUTH)
-                       add_entry (2, "-lmu_auth " AUTHLIBS);
-                   }
-                 else
-                   {
-                     argp_help (&argp, stdout, ARGP_HELP_USAGE,
-                                program_invocation_short_name);
-                     return 1;
-                   }
-               }
-           }
-         
-         sort_entries ();
-         
-         /* At least one entry is always present */
-         printf ("%s", lib_entry[0].ptr);
-
-         /* Print the rest of them separated by a space */
-         for (j = 1; j < nentry; j++)
-           {
-             printf (" %s", lib_entry[j].ptr);
-           }
-         printf ("\n");
-         return 0;
-       }
-       
-    case MODE_COMPILE:
-      if (argc != 0)
-       break;
-      printf ("%s\n", COMPILE_FLAGS);
-      return 0;
-
-    case MODE_INFO:
-      if (argc == 0)
-       mu_fprint_options (stdout, verbose);
-      else
-       {
-         int i, found = 0;
-         
-         for (i = 0; i < argc; i++)
-           {
-             const struct mu_conf_option *opt = mu_check_option (argv[i]);
-             if (opt)
-               {
-                 found++;
-                 mu_fprint_conf_option (stdout, opt, verbose);
-               }
-           }
-         return found == argc ? 0 : 1;
-       }
-      return 0;
-
-    case MODE_QUERY:
-      if (argc == 0)
-       {
-         mu_error (_("not enough arguments"));
-         return 1;
-       }
-
-      if (query_config_file)
-       {
-         mu_load_site_rcfile = 0;
-         mu_load_user_rcfile = 0;
-         mu_load_rcfile = query_config_file;
-       }
-
-      if (mu_libcfg_parse_config (&tree))
-       exit (1);
-      if (!tree)
-       exit (0);
-      rc = mu_stdio_stream_create (&stream, MU_STDOUT_FD, 0);
-      if (rc)
-       {
-         mu_error ("mu_stdio_stream_create: %s", mu_strerror (rc));
-         exit (1);
-       }
-      if (verbose)
-       fmtflags = MU_CFG_FMT_LOCUS;
-      for ( ; argc > 0; argc--, argv++)
-       {
-         char *path = *argv;
-         mu_cfg_node_t *node;
-
-         if (mu_cfg_find_node (tree, path, &node) == 0)
-           {
-             mu_cfg_format_node (stream, node, fmtflags);
-           }
-       }
-      exit (0);
-    }
-  
-  argp_help (&argp, stdout, ARGP_HELP_USAGE, program_invocation_short_name);
-  return 0;
-}
-  
diff --git a/config/maint.mk b/config/maint.mk
deleted file mode 100644
index 69049bf..0000000
--- a/config/maint.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# This file is part of GNU Mailutils.
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
-#
-# Written by Sergey Poznyakoff
-#
-# GNU Mailutils is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Mailutils 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
-
-include Makefile
-mailutils_config_CFLOW_INPUT=$(mailutils_config_SOURCES)
-mailutils-config.cflow: $(mailutils_config_CFLOW_INPUT) Makefile
-       cflow -o$@ $(CFLOW_FLAGS) $(DEFS) \
-               $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-               $(CPPFLAGS) \
-       $(mailutils_config_CFLOW_INPUT)
-
-flowgraph: mailutils-config.cflow
-maintclean:
-       rm -f mailutils-config.cflow
diff --git a/configure.ac b/configure.ac
index c7a627d..27ff3f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1337,7 +1337,6 @@ AC_CONFIG_FILES([
  Makefile
  sql/Makefile
  comsat/Makefile
- config/Makefile
  doc/Makefile
  doc/man/Makefile
  doc/texinfo/Makefile
diff --git a/libmailutils/cfg/.gitignore b/libmailutils/cfg/.gitignore
index 473803d..8993e60 100644
--- a/libmailutils/cfg/.gitignore
+++ b/libmailutils/cfg/.gitignore
@@ -1,3 +1,3 @@
-cfg_lexer.c
-cfg_parser.c
-cfg_parser.h
+lexer.c
+parser.c
+parser.h
diff --git a/mu-aux/Makefile.am b/mu-aux/Makefile.am
index 7273a9f..ec41589 100644
--- a/mu-aux/Makefile.am
+++ b/mu-aux/Makefile.am
@@ -24,3 +24,5 @@ EXTRA_DIST = \
  sqlmod.sh\
  generr.awk
 
+m4datadir = $(datadir)/aclocal
+dist_m4data_DATA = mailutils.m4
diff --git a/config/mailutils.m4 b/mu-aux/mailutils.m4
similarity index 100%
rename from config/mailutils.m4
rename to mu-aux/mailutils.m4
diff --git a/mu/Makefile.am b/mu/Makefile.am
index e724b0c..6fe40d9 100644
--- a/mu/Makefile.am
+++ b/mu/Makefile.am
@@ -16,6 +16,7 @@
 ## along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
 bin_PROGRAMS = mu
+dist_bin_SCRIPTS = mailutils-config
 
 if MU_COND_SUPPORT_POP
  POP_C=pop.c
@@ -25,14 +26,17 @@ EXTRA_DIST=pop.c
 
 mu_SOURCES = \
  acl.c\
+ cflags.c\
  info.c\
  mu.h\
  mu.c\
  filter.c\
  flt2047.c\
+ ldflags.c\
  $(POP_C)\
  query.c\
- shell.c
+ shell.c\
+ wicket.c
 
 mu_LDADD = \
  ${MU_APP_LIBRARIES}\
@@ -49,3 +53,11 @@ mu_LDADD = \
  @READLINE_LIBS@ @MU_COMMON_LIBRARIES@
 
 INCLUDES = @MU_APP_COMMON_INCLUDES@ @MU_AUTHINCS@
+AM_CPPFLAGS = \
+  -DCOMPILE_FLAGS="\"-I$(includedir)\"" \
+  -DLINK_FLAGS="\"-L$(libdir)\"" \
+  -DLINK_POSTFLAGS="\"$(MU_LINK_POSTFLAGS)\"" \
+  -DAUTHLIBS="\"$(MU_AUTHLIBS)\"" \
+  -DGUILE_LIBS="\"$(GUILE_LIBS)\"" \
+  -DPYTHON_LIBS="\"$(PYTHON_LIBS)\"" \
+  -DI18NLIBS="\"$(LIBINTL)\""
diff --git a/lib/signal.c b/mu/cflags.c
similarity index 59%
copy from lib/signal.c
copy to mu/cflags.c
index bd92e1c..9d177d0 100644
--- a/lib/signal.c
+++ b/mu/cflags.c
@@ -1,5 +1,5 @@
 /* GNU Mailutils -- a suite of utilities for electronic mail
-   Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2010 Free Software Foundation, Inc.
 
    GNU Mailutils is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -14,26 +14,33 @@
    You should have received a copy of the GNU General Public License
    along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
 
-#ifdef HAVE_CONFIG_H
+#if defined(HAVE_CONFIG_H)
 # include <config.h>
 #endif
 #include <stdlib.h>
-#include <signal.h>
+#include <mailutils/mailutils.h>
+#include <mailutils/libcfg.h>
+#include <argp.h>
 
-void
-mu_set_signals (RETSIGTYPE (*handler) (int signo), int *sigv, int sigc)
+static char cflags_doc[] = N_("mu cflags - show compiler options");
+
+static struct argp cflags_argp = {
+  NULL,
+  NULL,
+  NULL,
+  cflags_doc,
+  NULL,
+  NULL,
+  NULL
+};
+
+int
+mutool_cflags (int argc, char **argv)
 {
-  int i;
-  struct sigaction act;
-
-  act.sa_flags = 0;
-  sigemptyset (&act.sa_mask);
-  for (i = 0; i < sigc; i++)
-    sigaddset (&act.sa_mask, i);
-      
-  for (i = 0; i < sigc; i++)
-    {
-      act.sa_handler = handler;
-      sigaction (sigv[i], &act, NULL);
-    }
+  if (argp_parse (&cflags_argp, argc, argv, ARGP_IN_ORDER, NULL, NULL))
+    return 1;
+  printf ("%s\n", COMPILE_FLAGS);
+  return 0;
 }
+
+
diff --git a/mu/ldflags.c b/mu/ldflags.c
new file mode 100644
index 0000000..ba00bf8
--- /dev/null
+++ b/mu/ldflags.c
@@ -0,0 +1,193 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   GNU Mailutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GNU Mailutils 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
+
+#if defined(HAVE_CONFIG_H)
+# include <config.h>
+#endif
+#include <stdlib.h>
+#include <mailutils/mailutils.h>
+#include <mailutils/libcfg.h>
+#include <argp.h>
+
+static char ldflags_doc[] = N_("mu ldflags - list libraries required to link");
+static char ldflags_args_doc[] = N_("KEYWORD [KEYWORD...]");
+
+static struct argp ldflags_argp = {
+  NULL,
+  NULL,
+  ldflags_args_doc,
+  ldflags_doc,
+  NULL,
+  NULL,
+  NULL
+};
+
+
+#ifdef WITH_TLS
+# define NEEDAUTH 1
+#else
+# define NEEDAUTH 0
+#endif
+#define NOTALL   2
+
+struct lib_descr {
+  char *name;
+  char *libname;
+  int flags;
+} lib_descr[] = {
+  { "mbox",   "mu_mbox", 0 },
+  { "mh",     "mu_mh",   0 },
+  { "maildir","mu_maildir", 0 },
+  { "imap",   "mu_imap", NEEDAUTH },
+  { "pop",    "mu_pop",  NEEDAUTH },
+  { "nntp",   "mu_nntp", 0 },
+  { "mailer", "mu_mailer", 0 },
+  { "sieve",  "mu_sieve", NOTALL },
+  { NULL }
+};
+
+struct lib_entry {
+  int level;
+  char *ptr;
+} lib_entry[16];
+
+int nentry;
+
+void
+add_entry (int level, char *ptr)
+{
+  int i;
+  if (nentry >= sizeof(lib_entry)/sizeof(lib_entry[0]))
+    {
+      mu_error (_("too many arguments"));
+      exit (1);
+    }
+  
+  for (i = 0; i < nentry; i++)
+    if (strcmp (lib_entry[i].ptr, ptr) == 0)
+      return;
+  lib_entry[nentry].level = level;
+  lib_entry[nentry].ptr = ptr;
+  nentry++;
+}
+
+/* Sort the entries by their level. */
+void
+sort_entries ()
+{
+  int j;
+
+  for (j = 0; j < nentry; j++)
+    {
+      int i;
+             
+      for (i = j; i < nentry; i++)
+       if (lib_entry[j].level > lib_entry[i].level)
+         {
+           struct lib_entry tmp;
+           tmp = lib_entry[i];
+           lib_entry[i] = lib_entry[j];
+           lib_entry[j] = tmp;
+         }
+    }
+}
+
+
+int
+mutool_ldflags (int argc, char **argv)
+{
+  int i, j;
+  char *ptr;
+  
+  if (argp_parse (&ldflags_argp, argc, argv, ARGP_IN_ORDER, &i, NULL))
+    return 1;
+
+  argc -= i;
+  argv += i;
+  
+  add_entry (-100, LINK_FLAGS);
+  add_entry (100, LINK_POSTFLAGS);
+  add_entry (1, "-lmailutils");
+#ifdef ENABLE_NLS
+  if (sizeof (I18NLIBS) > 1)
+    add_entry (10, I18NLIBS);
+#endif
+
+  for ( ; argc > 0; argc--, argv++)
+    {
+      if (strcmp (argv[0], "auth") == 0)
+       add_entry (2, "-lmu_auth " AUTHLIBS);
+#ifdef WITH_GUILE            
+      else if (strcmp (argv[0], "guile") == 0)
+       add_entry (-1, "-lmu_scm " GUILE_LIBS);
+#endif
+#ifdef WITH_PYTHON
+      else if (strcmp (argv[0], "python") == 0)
+       add_entry (-1, "-lmu_py " PYTHON_LIBS);
+#endif
+      else if (strcmp (argv[0], "cfg") == 0)
+       add_entry (-1, "-lmu_cfg");
+      else if (strcmp (argv[0], "argp") == 0)
+       add_entry (-2, "-lmu_argp");
+      else if (strcmp (argv[0], "all") == 0)
+       {
+         struct lib_descr *p;
+                 
+         for (p = lib_descr; p->name; p++)
+           {
+             if (p->flags & NOTALL)
+               continue;
+             asprintf (&ptr, "-l%s", p->libname);
+             add_entry (0, ptr);
+             if (p->flags & NEEDAUTH)
+               add_entry (2, "-lmu_auth " AUTHLIBS);
+           }
+       }
+      else
+       {
+         struct lib_descr *p;
+         
+         for (p = lib_descr; p->name; p++)
+           if (mu_c_strcasecmp (p->name, argv[0]) == 0)
+             break;
+
+         if (p->name)
+           {
+             asprintf (&ptr, "-l%s", p->libname);
+             add_entry (0, ptr);
+             if (p->flags & NEEDAUTH)
+               add_entry (2, "-lmu_auth " AUTHLIBS);
+           }
+         else
+           {
+             mu_error (_("unknown keyword: %s"), argv[0]);
+             return 1;
+           }
+       }
+    }
+  
+  sort_entries ();
+         
+  /* At least one entry is always present */
+  printf ("%s", lib_entry[0].ptr);
+
+  /* Print the rest of them separated by a space */
+  for (j = 1; j < nentry; j++)
+    printf (" %s", lib_entry[j].ptr);
+  putchar ('\n');
+  return 0;
+}
+
diff --git a/mu/mailutils-config b/mu/mailutils-config
new file mode 100755
index 0000000..2545265
--- /dev/null
+++ b/mu/mailutils-config
@@ -0,0 +1,109 @@
+#! /bin/sh
+# A deprecated interface to GNU Mailutils configuration facilities.
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# GNU Mailutils is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2, or (at
+# your option) any later version.
+#
+# GNU Mailutils 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
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
+
+mode=
+file=
+dir=`expr "$0" : '\(.*\)/.*'`
+
+test -n "$dir" && PATH=$PATH:$dir
+
+usage() {
+    cat <<EOT
+This is a deprecated interface to GNU Mailutils configuration facilities.
+It will be removed in future versions.  Please, consider using these
+alternatives instead:
+
+       Traditional usage          |   Use instead
+    ------------------------------+-------------------
+    mailutils-config --compile    | mu cflags
+    mailutils-config --link       | mu ldflags
+    mailutils-config --info       | mu info
+    mailutils-config --query      | mu query
+    mailutils-config --query=FILE | mu query -f FILE
+
+For more information, try \`mu --help'.
+
+EOT
+    exit 0
+}
+
+while test $# -ne 0
+do
+  arg=$1
+  shift
+  case $arg in
+  -c|--c|--co|--com|--comp|--compil|--compile)
+    mode=cflags
+    break
+    ;;
+  -i|--i|--in|--inf|--info)
+    mode=info
+    break
+    ;;
+  -l|--l|--li|--lin|--link)
+    mode=ldflags
+    break
+    ;;
+  --)
+    break
+    ;;
+  -q*=*|--q*=*)
+    opt=`expr "$arg" : '\(.*\)='`
+    arg=`expr "$arg" : '.*=\(.*\)'`
+    case $opt in
+    -q|--q|--qu|--que|--quer|--query)
+      mode=query
+      file=arg
+      break
+      ;;
+    *)
+      echo >&2 "$0: invalid option: $1"
+      exit 1
+    esac
+    ;;
+  -q|--q|--qu|--que|--quer|--query)
+    mode=query
+    break
+    ;;
+  -q*)
+    mode=query
+    file=`expr "$arg" : '-q\(.*\)'`
+    break
+    ;;
+  --usage|--u|--us|--usa|--usag|--help|--hel|--he|--h)
+    usage
+    ;;
+  -V|--version|--versio|--versi|--vers|--ver|--ve|--v)
+    mu --version | sed -n '1{s/^mu/mailutils-config/;s/(\(GNU Mailutils\)) 
\([0-9][0-9.]*\).*/(\1 \2)/;p}'
+    exit 0
+    ;;
+  *)
+    echo >&2 "$0: unexpected argument; try \`$0 --usage' for help"
+    exit 1
+    ;;
+  esac
+done
+
+if test -z "$mode"; then
+  usage
+fi
+
+if test -n "$file"; then
+  set -- -f"$file" $*
+fi
+
+mu $mode $*
diff --git a/mu/mu.c b/mu/mu.c
index 2490805..a0900f7 100644
--- a/mu/mu.c
+++ b/mu/mu.c
@@ -33,6 +33,9 @@ Commands are:\n\
     mu filter - filter program\n\
     mu 2047   - decode/encode message headers as per RFC 2047\n\
     mu acl    - test access control lists\n\
+    mu wicket - find matching URL in wicket\n\
+    mu ldflags- list libraries required to link\n\
+    mu cflags - list compiler flags\n\
 \n\
 Try `mu COMMAND --help' to get help on a particular COMMAND.\n\
 \n\
@@ -106,6 +109,9 @@ struct mutool_action_tab mutool_action_tab[] = {
   { "2047", mutool_flt2047 },
   { "query", mutool_query },
   { "acl", mutool_acl },
+  { "wicket", mutool_wicket },
+  { "ldflags", mutool_ldflags },
+  { "cflags", mutool_cflags },
   { NULL }
 };
 
diff --git a/mu/mu.h b/mu/mu.h
index 7ab5b70..22bcc33 100644
--- a/mu/mu.h
+++ b/mu/mu.h
@@ -35,7 +35,10 @@ int mutool_flt2047 (int argc, char **argv);
 int mutool_info (int argc, char **argv);
 int mutool_query (int argc, char **argv);
 int mutool_acl (int argc, char **argv);
-
+int mutool_wicket (int argc, char **argv);
+int mutool_ldflags (int argc, char **argv);
+int mutool_cflags (int argc, char **argv);
+  
 extern char *mutool_shell_prompt;
 extern mu_vartab_t mutool_prompt_vartab;
 extern int mutool_shell_interactive;
diff --git a/mu/wicket.c b/mu/wicket.c
new file mode 100644
index 0000000..2615cdf
--- /dev/null
+++ b/mu/wicket.c
@@ -0,0 +1,196 @@
+/* GNU Mailutils -- a suite of utilities for electronic mail
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   GNU Mailutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   GNU Mailutils 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>. */
+
+#if defined(HAVE_CONFIG_H)
+# include <config.h>
+#endif
+#include <stdlib.h>
+#include <mailutils/mailutils.h>
+#include <mailutils/libcfg.h>
+#include <argp.h>
+
+static char wicket_doc[] = N_("mu wicket - find matching URL in wicket");
+static char wicket_args_doc[] = N_("NAME");
+
+static struct argp_option wicket_options[] = {
+  { "file",    'f', N_("FILE"), 0, N_("use FILE instead of ~/.mu-tickets") },
+  { "verbose", 'v', NULL,       0, N_("increase output verbosity") },
+  { "quiet",   'q', NULL,       0, N_("suppress any output") },
+  { NULL }
+};
+
+static char *wicket_file = "~/.mu-tickets";
+static int wicket_verbose = 1;
+
+static error_t
+wicket_parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+    {
+    case 'f':
+      wicket_file = arg;
+      break;
+
+    case 'v':
+      wicket_verbose++;
+      break;
+
+    case 'q':
+      wicket_verbose = 0;
+      break;
+      
+    default:
+      return ARGP_ERR_UNKNOWN;
+    }
+  return 0;
+}
+
+static struct argp wicket_argp = {
+  wicket_options,
+  wicket_parse_opt,
+  wicket_args_doc,
+  wicket_doc,
+  NULL,
+  NULL,
+  NULL
+};
+
+
+static int
+wicket_match (mu_stream_t stream, const char *str)
+{
+  int rc, ret;
+  mu_url_t u, url;
+  struct mu_debug_locus loc;
+  
+  rc = mu_url_create (&u, str);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_url_create", str, rc);
+      return 2;
+    }
+  rc = mu_url_parse (u);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_url_parse", str, rc);
+      return 2;
+    }
+
+  rc = mu_stream_seek (stream, 0, MU_SEEK_SET, NULL);
+  if (rc)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_stream_seek", "0", rc);
+      return 2;
+    }
+  loc.file = wicket_file;
+  loc.line = 0;
+  rc = mu_wicket_stream_match_url (stream, &loc, u, &url);
+  switch (rc)
+    {
+    case 0:
+      ret = 0;
+      if (wicket_verbose)
+       {
+         printf ("%s: %s:%d", str, loc.file, loc.line);
+         if (wicket_verbose > 1)
+           {
+             printf (": %s", mu_url_to_string (url));
+             if (wicket_verbose > 2)
+               {
+                 mu_secret_t s;
+                 rc = mu_url_get_secret (url, &s);
+                 if (rc == 0)
+                   {
+                     printf (": %s", mu_secret_password (s));
+                     mu_secret_password_unref (s);
+                     mu_secret_unref (s);
+                   }
+                 else if (rc == MU_ERR_NOENT)
+                   printf (": [%s]", _("no password"));
+                 else
+                   {
+                     printf (": [error: %s]", mu_strerror (rc));
+                     ret = 2;
+                   }
+               }
+           }
+         putchar ('\n');
+       }
+      break;
+
+    case MU_ERR_NOENT:
+      if (wicket_verbose)
+       printf ("%s: %s\n", str, _("not found"));
+      ret = 1;
+      break;
+
+    default:
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_wicket_stream_match_url", str, rc);
+      ret = 2;
+    }
+  return ret;
+}
+
+int
+mutool_wicket (int argc, char **argv)
+{
+  mu_stream_t stream;
+  int rc, i, exit_code;
+  
+  if (argp_parse (&wicket_argp, argc, argv, ARGP_IN_ORDER, &i, NULL))
+    return 1;
+
+  argc -= i;
+  argv += i;
+
+  if (argc == 0)
+    {
+      mu_error (_("not enough arguments"));
+      return 1;
+    }
+
+  wicket_file = mu_tilde_expansion (wicket_file, "/", NULL);
+  if (!wicket_file)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_tilde_expansion", wicket_file,
+                      ENOMEM);
+      return 2;
+    }
+  
+  rc = mu_file_stream_create (&stream, wicket_file, MU_STREAM_READ);
+  if (rc)
+    {
+      mu_error (_("cannot open input file %s: %s"), wicket_file,
+               mu_strerror (rc));
+      return 1;
+    }
+
+  exit_code = 0;
+  for (i = 0; i < argc; i++)
+    {
+      rc = wicket_match (stream, argv[i]);
+      if (rc)
+       {
+         if (exit_code < rc)
+           exit_code = rc;
+         if (!wicket_verbose)
+           break;
+       }
+    }
+
+  mu_stream_destroy (&stream);
+  return exit_code;
+}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f07b4c5..fc1e8b1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,8 +7,6 @@
 comsat/action.c
 comsat/comsat.c
 
-config/mailutils-config.c
-
 dotlock/dotlock.c
 
 frm/common.c
@@ -213,6 +211,9 @@ mu/mu.c
 mu/pop.c
 mu/query.c
 mu/shell.c
+mu/cflags.c
+mu/ldflags.c
+mu/wicket.c
 
 # EOF
 


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]