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. --- server/wallet-backend | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'server') 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 -- cgit v1.2.3