From: Roy Marples Date: Fri, 4 Jul 2008 12:08:51 +0000 (+0000) Subject: Send LOG_INFO to the console by default so users know what it's doing a little more... X-Git-Tag: v4.0.2~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3f53aeaff648137dd0314b3434c876036304f5b;p=thirdparty%2Fdhcpcd.git Send LOG_INFO to the console by default so users know what it's doing a little more. This can be disabled with the new -q, --quiet option. --- diff --git a/dhcpcd.8.in b/dhcpcd.8.in index ed83ac4f..b8a8c256 100644 --- a/dhcpcd.8.in +++ b/dhcpcd.8.in @@ -22,14 +22,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd Jun 30, 2008 +.Dd Jul 04, 2008 .Dt DHCPCD 8 SMM .Sh NAME .Nm dhcpcd .Nd an RFC 2131 compliant DHCP client .Sh SYNOPSIS .Nm -.Op Fl dknpADEGKLSTV +.Op Fl dknpqADEGKLSTV .Op Fl c , -script Ar script .Op Fl f , -config Ar file .Op Fl h , -hostname Ar hostname @@ -307,6 +307,11 @@ However, there are sometimes situations where you don't want the things to be configured exactly how the the DHCP server wants. Here are some options that deal with turning these bits off. .Bl -tag -width indent +.It Fl q , -quiet +Quiet +.Nm +on the command line, only warnings and errors will be displayed. +The messagea are still logged though. .It Fl A , -noarp Don't request or claim the address by ARP. This also disables IPv4LL. diff --git a/dhcpcd.c b/dhcpcd.c index 82770af5..663785e5 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -52,7 +52,7 @@ const char copyright[] = "Copyright (c) 2006-2008 Roy Marples"; /* Don't set any optional arguments here so we retain POSIX * compatibility with getopt */ -#define OPTS "c:df:h:i:kl:m:no:pr:s:t:u:v:xAC:DEF:GI:KLO:TV" +#define OPTS "c:df:h:i:kl:m:no:pqr:s:t:u:v:xAC:DEF:GI:KLO:TV" static int doversion = 0; static int dohelp = 0; @@ -68,6 +68,7 @@ static const struct option longopts[] = { {"renew", no_argument, NULL, 'n'}, {"option", required_argument, NULL, 'o'}, {"persistent", no_argument, NULL, 'p'}, + {"quiet", no_argument, NULL, 'q'}, {"inform", optional_argument, NULL, 's'}, {"request", optional_argument, NULL, 'r'}, {"timeout", required_argument, NULL, 't'}, @@ -157,7 +158,7 @@ read_pid(const char *pidfile) static void usage(void) { - printf("usage: "PACKAGE" [-dknpxADEGHKLOTV] [-c script] [-f file ] [-h hostname]\n" + printf("usage: "PACKAGE" [-dknpqxADEGHKLOTV] [-c script] [-f file ] [-h hostname]\n" " [-i classID ] [-l leasetime] [-m metric] [-o option] [-r ipaddr]\n" " [-s ipaddr] [-t timeout] [-u userclass] [-F none|ptr|both]\n" " [-I clientID] [-C hookscript] \n"); @@ -368,6 +369,9 @@ parse_option(int opt, char *oarg, struct options *options) case 'p': options->options |= DHCPCD_PERSISTENT; break; + case 'q': + setloglevel(LOG_WARNING); + break; case 's': options->options |= DHCPCD_INFORM; options->options |= DHCPCD_PERSISTENT; diff --git a/logger.c b/logger.c index e9d3de46..6eb0c295 100644 --- a/logger.c +++ b/logger.c @@ -35,7 +35,7 @@ #include "common.h" #include "logger.h" -static int loglevel = LOG_WARNING; +static int loglevel = LOG_INFO; static char logprefix[12] = {0}; struct logname {