From 5dd1bb69f28e1a38259dd939cfd00469c5b786eb Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 12 Feb 2008 23:38:36 +0000 Subject: wallet-backend now supports a -q flag, which disables syslog logging. --- NEWS | 2 ++ server/wallet-backend | 26 ++++++++++++++++++++++---- tests/data/cmd-wrapper.in | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d17e4ef..960271f 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,8 @@ wallet 0.8 (unreleased) environment variable WALLET_CONFIG and loads configuration from the file specified there instead of /etc/wallet/wallet.conf if it is set. + wallet-backend now supports a -q flag, which disables syslog logging. + Add a full end-to-end test suite to catch protocol mismatches between the client and server, such as the one fixed in this release. diff --git a/server/wallet-backend b/server/wallet-backend index 1a259d5..c002d89 100755 --- a/server/wallet-backend +++ b/server/wallet-backend @@ -13,11 +13,14 @@ our $ID = q$Id$; ############################################################################## use strict; + +use Getopt::Long qw(GetOptions); use Sys::Syslog qw(openlog syslog); use Wallet::Server; -# Set to zero to suppress syslog logging, which is used only for testing. Set -# to a reference to a string to append messages to that string instead. +# Set to zero to suppress syslog logging, which is used for testing and for +# the -q option. Set to a reference to a string to append messages to that +# string instead. our $SYSLOG; $SYSLOG = 1 unless defined $SYSLOG; @@ -289,7 +292,15 @@ sub command { } success (@_); } + +# Parse command-line options. +my ($quiet); +GetOptions ('q|quiet' => \$quiet) or exit 1; +$SYSLOG = 0 if $quiet; + +# Run the command. command (@ARGV); + __END__ ############################################################################## @@ -305,7 +316,7 @@ wallet-backend - Wallet server for storing and retrieving secure data =head1 SYNOPSIS -B I [I ...] +B [B<-q>] I [I ...] =head1 DESCRIPTION @@ -326,7 +337,14 @@ over and above the checking already done by the rest of the wallet code. =head1 OPTIONS -B takes no traditional options. +=over 4 + +=item B<--quiet>, B<-q> + +If this option is given, B will not log its actions to +syslog. + +=back =head1 COMMANDS diff --git a/tests/data/cmd-wrapper.in b/tests/data/cmd-wrapper.in index a45edc8..e119002 100644 --- a/tests/data/cmd-wrapper.in +++ b/tests/data/cmd-wrapper.in @@ -7,4 +7,4 @@ WALLET_CONFIG='@abs_top_srcdir@/tests/data/wallet.conf' export WALLET_CONFIG exec perl -I'@abs_top_srcdir@/perl' '@abs_top_srcdir@/server/wallet-backend' \ - "$@" + -q "$@" -- cgit v1.2.3