summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-05-02 16:16:44 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-05-02 17:00:00 +0300
commita5721d4bc037b7288722650cf8d6685d18c6cdfd (patch)
tree478d99a3c6de16075d632404c5d8e5b520557b53
parent82917550244d2e4d06f4450d58af7beaae51a0a7 (diff)
downloadmailutils-a5721d4bc037b7288722650cf8d6685d18c6cdfd.tar.gz
mailutils-a5721d4bc037b7288722650cf8d6685d18c6cdfd.tar.bz2
For alpha version, include git tag info in the version output.
* include/mailutils/libargp.h (mu_program_version_hook): New proto. * libmu_argp/Makefile.am (libmu_argp_a_SOURCES): Remove mu_argp.h. * libmu_argp/mu_argp.h: Remove. * libmu_argp/muinit.c [MU_ALPHA_RELEASE]: Include git-describe.h (mu_program_version_hook): New function. (mu_argp_init): Set mu_program_version_hook, unless vers is given. * comsat/comsat.c (main): Call mu_argp_init with NULL arguments. * config/mailutils-config.c: Likewise. * dotlock/dotlock.c: Likewise. * examples/muauth.c: Likewise. * frm/frm.c: Likewise. * frm/from.c: Likewise. * guimb/main.c: Likewise. * imap4d/imap4d.c: Likewise. * maidag/maidag.c: Likewise. * mail/mail.c: Likewise. * messages/messages.c: Likewise. * mimeview/mimeview.c: Likewise. * movemail/movemail.c: Likewise. * pop3d/pop3d.c: Likewise. * pop3d/popauth.c: Likewise. * readmsg/readmsg.c: Likewise. * sieve/sieve.c: Likewise.
-rw-r--r--comsat/comsat.c2
-rw-r--r--config/mailutils-config.c3
-rw-r--r--dotlock/dotlock.c3
-rw-r--r--examples/muauth.c3
-rw-r--r--frm/frm.c3
-rw-r--r--frm/from.c3
-rw-r--r--guimb/main.c3
-rw-r--r--imap4d/imap4d.c2
-rw-r--r--include/mailutils/libargp.h1
-rw-r--r--libmu_argp/Makefile.am1
-rw-r--r--libmu_argp/muinit.c39
-rw-r--r--maidag/maidag.c2
-rw-r--r--mail/mail.c2
-rw-r--r--messages/messages.c3
-rw-r--r--mimeview/mimeview.c3
-rw-r--r--movemail/movemail.c3
-rw-r--r--pop3d/pop3d.c2
-rw-r--r--pop3d/popauth.c8
-rw-r--r--readmsg/readmsg.c3
-rw-r--r--sieve/sieve.c4
20 files changed, 57 insertions, 36 deletions
diff --git a/comsat/comsat.c b/comsat/comsat.c
index 82e8056e6..ca11efef5 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -570,7 +570,7 @@ main (int argc, char **argv)
/* Native Language Support */
MU_APP_INIT_NLS ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
comsat_init ();
mu_acl_cfg_init ();
mu_m_server_cfg_init ();
diff --git a/config/mailutils-config.c b/config/mailutils-config.c
index a5aeb4f0e..ccf55ab7f 100644
--- a/config/mailutils-config.c
+++ b/config/mailutils-config.c
@@ -25,7 +25,6 @@
#include <mu_asprintf.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.");
static char args_doc[] = N_("[arg...]");
@@ -188,7 +187,7 @@ main (int argc, char **argv)
mu_stream_t stream;
int fmtflags = 0;
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
mu_set_program_name (argv[0]);
mu_libargp_init ();
diff --git a/dotlock/dotlock.c b/dotlock/dotlock.c
index 6315b2dae..d561d18bd 100644
--- a/dotlock/dotlock.c
+++ b/dotlock/dotlock.c
@@ -33,7 +33,6 @@
#include "mailutils/libargp.h"
-const char *program_version = "GNU dotlock (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU dotlock -- lock mail spool files.")
"\v"
@@ -161,7 +160,7 @@ main (int argc, char *argv[])
argp_err_exit_status = MU_DL_EX_ERROR;
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, dotlock_capa, dotlock_cfg_param,
argc, argv, 0, NULL, NULL))
exit (1);
diff --git a/examples/muauth.c b/examples/muauth.c
index 23ba521a6..c771ebfd7 100644
--- a/examples/muauth.c
+++ b/examples/muauth.c
@@ -27,7 +27,6 @@
#include <mailutils/mailutils.h>
#include "mailutils/libargp.h"
-const char *program_version = "muauth (" PACKAGE_STRING ")";
static char doc[] =
"muauth -- test mailutils authentication and authorization schemes";
static char args_doc[] = "key";
@@ -91,7 +90,7 @@ main (int argc, char * argv [])
uid_t uid;
MU_AUTH_REGISTER_ALL_MODULES ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, capa, NULL, argc, argv, 0, &index, NULL))
exit (1);
diff --git a/frm/frm.c b/frm/frm.c
index b56bff2c7..f97856020 100644
--- a/frm/frm.c
+++ b/frm/frm.c
@@ -31,7 +31,6 @@ static int align = 0; /* Tidy mode. -t option. */
#define IS_NEW 0x100
static int select_attribute;
-const char *program_version = "frm (" PACKAGE_STRING ")";
static char doc[] = N_("GNU frm -- display From: lines.");
static struct attr_tab {
@@ -358,7 +357,7 @@ main (int argc, char **argv)
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, frm_argp_capa, NULL, argc, argv, 0, &c, NULL))
exit (1);
diff --git a/frm/from.c b/frm/from.c
index 080b548f7..6b9fdf84b 100644
--- a/frm/from.c
+++ b/frm/from.c
@@ -23,7 +23,6 @@ int count_only;
char *sender_option;
char *mailbox_name;
-const char *program_version = "from (" PACKAGE_STRING ")";
static char doc[] = N_("GNU from -- display from and subject.");
static struct argp_option options[] = {
@@ -120,7 +119,7 @@ main (int argc, char **argv)
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, capa, NULL, argc, argv, 0, &c, NULL))
exit (1);
diff --git a/guimb/main.c b/guimb/main.c
index 460c6bdc0..f08d45096 100644
--- a/guimb/main.c
+++ b/guimb/main.c
@@ -122,7 +122,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
return 0;
}
-const char *program_version = "guimb (" PACKAGE_STRING ")";
static char doc[] =
N_("GNU guimb -- process contents of the specified mailboxes "
"using a Scheme program or expression.");
@@ -161,7 +160,7 @@ main (int argc, char *argv[])
/* Register the desired formats. */
mu_register_all_formats ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, guimb_argp_capa, NULL, argc, argv, 0, &index, &c))
exit (1);
diff --git a/imap4d/imap4d.c b/imap4d/imap4d.c
index 195c4af4f..b180206c2 100644
--- a/imap4d/imap4d.c
+++ b/imap4d/imap4d.c
@@ -503,7 +503,7 @@ main (int argc, char **argv)
mu_acl_cfg_init ();
mu_m_server_cfg_init ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
mu_m_server_create (&server, program_version);
mu_m_server_set_conn (server, imap4d_connection);
diff --git a/include/mailutils/libargp.h b/include/mailutils/libargp.h
index e96df3ac9..c0317bef6 100644
--- a/include/mailutils/libargp.h
+++ b/include/mailutils/libargp.h
@@ -75,6 +75,7 @@ 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);
+extern void mu_program_version_hook (FILE *stream, struct argp_state *state);
error_t mu_argp_parse (const struct argp *myargp,
int *pargc, char **pargv[],
diff --git a/libmu_argp/Makefile.am b/libmu_argp/Makefile.am
index 3106f5c1f..87fd420a6 100644
--- a/libmu_argp/Makefile.am
+++ b/libmu_argp/Makefile.am
@@ -32,7 +32,6 @@ libmu_argp_a_SOURCES =\
cmdline.h\
common.c\
compat.c\
- mu_argp.h\
mu_argp.c\
muinit.c\
sieve.c\
diff --git a/libmu_argp/muinit.c b/libmu_argp/muinit.c
index 6ed95d5d4..805fc30ca 100644
--- a/libmu_argp/muinit.c
+++ b/libmu_argp/muinit.c
@@ -25,13 +25,48 @@
#include <mailutils/stream.h>
#include "xalloc.h"
#include <string.h>
-
+#ifdef MU_ALPHA_RELEASE
+# include <git-describe.h>
+#endif
struct mu_cfg_tree *mu_argp_tree;
+const char version_etc_copyright[] =
+ /* Do *not* mark this string for translation. %s is a copyright
+ symbol suitable for this locale, and %d is the copyright
+ year. */
+ "Copyright %s 2010 Free Software Foundation, inc.";
+
+void
+mu_program_version_hook (FILE *stream, struct argp_state *state)
+{
+#ifdef GIT_DESCRIBE
+ fprintf (stream, "%s (%s) %s [%s]\n",
+ mu_program_name, PACKAGE_NAME, PACKAGE_VERSION, GIT_DESCRIBE);
+#else
+ fprintf (stream, "%s (%s) %s\n", mu_program_name,
+ PACKAGE_NAME, PACKAGE_VERSION);
+#endif
+ /* TRANSLATORS: Translate "(C)" to the copyright symbol
+ (C-in-a-circle), if this symbol is available in the user's
+ locale. Otherwise, do not translate "(C)"; leave it as-is. */
+ fprintf (stream, version_etc_copyright, _("(C)"));
+
+ fputs (_("\
+\n\
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\n\
+There is NO WARRANTY, to the extent permitted by law.\n\
+\n\
+"),
+ stream);
+}
+
void
mu_argp_init (const char *vers, const char *bugaddr)
{
- argp_program_version = vers ? vers : PACKAGE_STRING;
+ if (vers)
+ argp_program_version = vers;
+ else
+ argp_program_version_hook = mu_program_version_hook;
argp_program_bug_address = bugaddr ? bugaddr : "<" PACKAGE_BUGREPORT ">";
}
diff --git a/maidag/maidag.c b/maidag/maidag.c
index ea04f0723..894fa614f 100644
--- a/maidag/maidag.c
+++ b/maidag/maidag.c
@@ -518,7 +518,7 @@ main (int argc, char *argv[])
maidag_cfg_init ();
/* Parse command line */
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
mu_m_server_create (&server, program_version);
mu_m_server_set_conn (server, lmtp_connection);
diff --git a/mail/mail.c b/mail/mail.c
index afeb4e16f..dba26a29e 100644
--- a/mail/mail.c
+++ b/mail/mail.c
@@ -394,7 +394,7 @@ main (int argc, char **argv)
#ifdef WITH_TLS
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, mail_capa, NULL, argc, argv, 0, NULL, &args))
exit (1);
diff --git a/messages/messages.c b/messages/messages.c
index 292f59c9f..62c38b821 100644
--- a/messages/messages.c
+++ b/messages/messages.c
@@ -31,7 +31,6 @@
static int messages_count (const char *);
-const char *program_version = "messages (" PACKAGE_STRING ")";
static char doc[] = N_("GNU messages -- count the number of messages in a mailbox");
static char args_doc[] = N_("[mailbox...]");
@@ -112,7 +111,7 @@ main (int argc, char **argv)
#ifdef WITH_TLS
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, argp_capa, NULL, argc, argv, 0, NULL, &args))
exit (1);
diff --git a/mimeview/mimeview.c b/mimeview/mimeview.c
index 6192ede9b..0c359ccbc 100644
--- a/mimeview/mimeview.c
+++ b/mimeview/mimeview.c
@@ -33,7 +33,6 @@
#include "mailcap.h"
-const char *program_version = "mimeview (" PACKAGE_STRING ")";
static char doc[] = N_("GNU mimeview -- display files, using mailcap mechanism.")
"\v"
N_("Default mime.types file is ") DEFAULT_CUPS_CONFDIR "/mime.types"
@@ -281,7 +280,7 @@ main (int argc, char **argv)
int index;
MU_APP_INIT_NLS ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, capa, mimeview_cfg_param,
argc, argv, 0, &index, NULL))
exit (1);
diff --git a/movemail/movemail.c b/movemail/movemail.c
index a38517355..2004c7e49 100644
--- a/movemail/movemail.c
+++ b/movemail/movemail.c
@@ -33,7 +33,6 @@
#include "mailutils/libargp.h"
#include <muaux.h>
-const char *program_version = "movemail (" PACKAGE_STRING ")";
static char doc[] = N_("GNU movemail -- move messages across mailboxes.");
static char args_doc[] = N_("inbox-url destfile [POP-password]");
@@ -677,7 +676,7 @@ main (int argc, char **argv)
#ifdef WITH_TLS
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, movemail_capa, movemail_cfg_param,
argc, argv, 0, &index, NULL))
exit (1);
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index d0e7b6057..62c871b1f 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -338,7 +338,7 @@ main (int argc, char **argv)
mu_acl_cfg_init ();
mu_m_server_cfg_init ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
mu_m_server_create (&server, program_version);
mu_m_server_set_conn (server, pop3d_connection);
diff --git a/pop3d/popauth.c b/pop3d/popauth.c
index bc8c44351..9f73d60ed 100644
--- a/pop3d/popauth.c
+++ b/pop3d/popauth.c
@@ -56,14 +56,11 @@ int (*ftab[]) (struct action_data *) = {
action_chpass
};
-const char *program_version = "popauth (" PACKAGE_STRING ")";
static char doc[] = N_("GNU popauth -- manage pop3 authentication database");
static error_t popauth_parse_opt (int key, char *arg,
struct argp_state *astate);
void popauth_version (FILE *stream, struct argp_state *state);
-void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) =
- popauth_version;
static struct argp_option options[] =
{
@@ -202,7 +199,8 @@ main(int argc, char **argv)
/* Native Language Support */
MU_APP_INIT_NLS ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
+ argp_program_version_hook = popauth_version;
if (mu_app_init (&argp, popauth_argp_capa, NULL,
argc, argv, 0, NULL, &adata))
exit (EX_USAGE);
@@ -600,7 +598,7 @@ popauth_version (FILE *stream, struct argp_state *state)
#elif defined(WITH_TOKYOCABINET)
# define FORMAT "Tokyo Cabinet"
#endif
- printf ("%s\n", argp_program_version);
+ mu_program_version_hook (stream, state);
printf (_("Database format: %s\n"), FORMAT);
printf (_("Database location: %s\n"), APOP_PASSFILE);
exit (EX_OK);
diff --git a/readmsg/readmsg.c b/readmsg/readmsg.c
index 0ea377efb..52c7512ea 100644
--- a/readmsg/readmsg.c
+++ b/readmsg/readmsg.c
@@ -33,7 +33,6 @@ static void print_header (mu_message_t, int, int, char **);
static void print_body (mu_message_t);
static int string_starts_with (const char * s1, const char *s2);
-const char *program_version = "readmsg (" PACKAGE_STRING ")";
static char doc[] = N_("GNU readmsg -- print messages.");
static error_t readmsg_parse_opt (int key, char *arg, struct argp_state *astate);
@@ -301,7 +300,7 @@ main (int argc, char **argv)
#ifdef WITH_TLS
mu_gocs_register ("tls", mu_tls_module_init);
#endif
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
if (mu_app_init (&argp, readmsg_argp_capa, readmsg_cfg_param,
argc, argv, 0, &index, NULL))
exit (1);
diff --git a/sieve/sieve.c b/sieve/sieve.c
index 814be6557..1e1d39559 100644
--- a/sieve/sieve.c
+++ b/sieve/sieve.c
@@ -48,8 +48,6 @@
#include "mailutils/libargp.h"
-const char *program_version = "sieve (" PACKAGE_STRING ")";
-
static char doc[] =
N_("GNU sieve -- a mail filtering tool.")
"\v"
@@ -480,7 +478,7 @@ main (int argc, char *argv[])
/* Native Language Support */
MU_APP_INIT_NLS ();
- mu_argp_init (program_version, NULL);
+ mu_argp_init (NULL, NULL);
#ifdef WITH_TLS
mu_gocs_register ("tls", mu_tls_module_init);
#endif

Return to:

Send suggestions and report system problems to the System administrator.