summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/ChangeLog7
-rw-r--r--tools/Makefile.am9
-rw-r--r--tools/watchgnupg.c61
3 files changed, 58 insertions, 19 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index e764d7b6a..bd99271d6 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-12 Werner Koch <wk@gnupg.org>
+
+ * watchgnupg.c (main): Implement option "--".
+ (print_version): New.
+
+ * Makefile.am: Include cmacros.am for common flags.
+
2004-02-03 Werner Koch <wk@gnupg.org>
* addgnupghome: Try to use getent, so that it also works for NIS
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 32dd709fa..71a77356f 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -21,18 +21,19 @@ EXTRA_DIST = Manifest watchgnupg.c \
rfc822parse.c rfc822parse.h gpgparsemail.c \
addgnupghome
-localedir = $(datadir)/locale
-INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\"
+AM_CPPFLAGS = -I$(top_srcdir)/intl -I$(top_srcdir)/common
+include $(top_srcdir)/am/cmacros.am
# Note, that we require GPG_ERROR_CFLAGS only because some share header files
# require that file. It is not actually used in gpgconf.
-AM_CFLAGS = -I$(top_srcdir)/common -I$(top_srcdir)/intl @GPG_ERROR_CFLAGS@
+AM_CFLAGS = @GPG_ERROR_CFLAGS@
sbin_SCRIPTS = addgnupghome
-bin_PROGRAMS = gpgconf
+bin_PROGRAMS = gpgconf watchgnupg
gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c no-libgcrypt.c
gpgconf_LDADD = ../jnlib/libjnlib.a ../common/libcommon.a @INTLLIBS@
+watchgnupg_SOURCES = watchgnupg.c
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index dfb11f2de..7f79f2f18 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -1,5 +1,5 @@
/* watchgnupg.c - Socket server for GnuPG logs
- * Copyright (C) 2003 Free Software Foundation, Inc.
+ * Copyright (C) 2003, 2004 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -18,6 +18,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
@@ -33,8 +36,16 @@
#define PGM "watchgnupg"
+/* Allow for a standalone build. */
+#ifdef VERSION
+#define MYVERSION_LINE PGM " (GnuPG) " VERSION
+#define BUGREPORT_LINE "\nReport bugs to <bug-gnupg@gnu.org>.\n"
+#else
+#define MYVERSION_LINE PGM
+#define BUGREPORT_LINE ""
+#endif
+
static int verbose;
-static int debug;
static void
@@ -169,6 +180,29 @@ print_line (client_t c, const char *line)
}
+static void
+print_version (int with_help)
+{
+ fputs (MYVERSION_LINE "\n"
+ "Copyright (C) 2004 Free Software Foundation, Inc.\n"
+ "This program comes with ABSOLUTELY NO WARRANTY.\n"
+ "This is free software, and you are welcome to redistribute it\n"
+ "under certain conditions. See the file COPYING for details.\n",
+ stdout);
+
+ if (with_help)
+ fputs ("\n"
+ "Usage: " PGM " [OPTIONS] SOCKETNAME\n"
+ "Open the local socket SOCKETNAME and display log messages\n"
+ "\n"
+ " --force delete an already existing socket file\n"
+ " --verbose enable extra informational output\n"
+ " --version print version of the program and exit\n"
+ " --help display this help and exit\n"
+ BUGREPORT_LINE, stdout );
+
+ exit (0);
+}
int
main (int argc, char **argv)
@@ -189,22 +223,18 @@ main (int argc, char **argv)
while (argc && last_argc != argc )
{
last_argc = argc;
- if (!strcmp (*argv, "--help"))
+ if (!strcmp (*argv, "--"))
{
- puts (
- "usage: " PGM " [options] socketname\n"
- "\n"
- " Options are --verbose, --debug and --force");
- exit (0);
- }
- if (!strcmp (*argv, "--verbose"))
- {
- verbose = 1;
argc--; argv++;
+ break;
}
- else if (!strcmp (*argv, "--debug"))
+ else if (!strcmp (*argv, "--version"))
+ print_version (0);
+ else if (!strcmp (*argv, "--help"))
+ print_version (1);
+ else if (!strcmp (*argv, "--verbose"))
{
- verbose = debug = 1;
+ verbose = 1;
argc--; argv++;
}
else if (!strcmp (*argv, "--force"))
@@ -216,7 +246,8 @@ main (int argc, char **argv)
if (argc != 1)
{
- die ("usage: " PGM " socketname\n");
+ fprintf (stderr, "usage: " PGM " socketname\n");
+ exit (1);
}