Improve dhcpclient and rad_counter online help

Resolves: Bug:#1146966
This commit is contained in:
Nikolai Kondrashov 2014-12-15 16:36:38 +02:00
parent b46bc32401
commit 7eb2ab3d96
4 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,26 @@
From 313d551547efa8493741ef1344e0629aab04dd70 Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Date: Fri, 5 Dec 2014 15:07:59 +0200
Subject: [PATCH 3/3] dhcpclient: Add a short description to help output
Add a short description of the program's function to the help output of
dhcpclient.
---
src/modules/proto_dhcp/dhcpclient.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/modules/proto_dhcp/dhcpclient.c b/src/modules/proto_dhcp/dhcpclient.c
index 64debfe..5677588 100644
--- a/src/modules/proto_dhcp/dhcpclient.c
+++ b/src/modules/proto_dhcp/dhcpclient.c
@@ -70,6 +70,7 @@ char const *dhcpclient_version = "dhcpclient version " RADIUSD_VERSION_STRING
static void NEVER_RETURNS usage(void)
{
fprintf(stderr, "Usage: dhcpclient [options] server[:port] <command>\n");
+ fprintf(stderr, "Send a DHCP request with provided RADIUS attrs and output response.\n");
fprintf(stderr, " <command> One of discover, request, offer, decline, release, inform.\n");
fprintf(stderr, " -d <directory> Set the directory where the dictionaries are stored (defaults to " RADDBDIR ").\n");
--
2.1.3

View File

@ -0,0 +1,64 @@
From 68b1b158029501208d1c6a60aa2794d9589c2a08 Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Date: Fri, 5 Dec 2014 12:24:37 +0200
Subject: [PATCH 2/3] rad_counter: Refine help message
Refine rad_counter help message:
* use executable name without path,
* add program purpose,
* shorten usage summary line for clarity,
* separate arguments and options,
* add full stops to sentences,
* wrap a long line.
---
src/modules/rlm_counter/rad_counter | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/modules/rlm_counter/rad_counter b/src/modules/rlm_counter/rad_counter
index b6c1159..1beef29 100755
--- a/src/modules/rlm_counter/rad_counter
+++ b/src/modules/rlm_counter/rad_counter
@@ -6,6 +6,7 @@ use warnings ;
use GDBM_File ;
use Fcntl ;
use Getopt::Long;
+use File::Basename;
my $user = '';
my $divisor = 1;
@@ -19,17 +20,22 @@ my $help = 0;
$filename = '';
sub show_help {
- print <<"EOF";
-Usage: $0 --file=<counter filename> [--reset=<seconds>] [--match=<regexp>]
-[--user=<username>] [--help] [--hours|--minutes|--seconds]
+ my $progname = basename($0);
+ print <<EOF;
+Usage: $progname --file=<counter filename> [OPTION...]
+Query and maintain FreeRADIUS rlm_counter DB file.
---user=<username> Information for specific user
---file=<filename> Counter db filename
---match=<regexp> Information for matching users
+Arguments:
+--file=<filename> Counter DB filename.
+
+Options:
+--user=<username> Information for specific user.
+--match=<regexp> Information for matching users.
--reset=<number> Reset counter to <number>.
- If divisor is set use it, else <number> means seconds
---help Show this help screen
---(hours|minutes|seconds) Specify information divisor
+ If divisor is set use it,
+ else <number> means seconds.
+--help Show this help screen.
+--(hours|minutes|seconds) Specify information divisor.
EOF
exit 0;
}
--
2.1.3

View File

@ -0,0 +1,47 @@
From 70686e8d2b400a804277ba0cdc664e71dd393dd5 Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Date: Fri, 5 Dec 2014 12:12:19 +0200
Subject: [PATCH 1/3] rad_counter: Use heredoc for help message
Use Perl's here document syntax for rad_counter's help message and
replace tab escape sequences with spaces to make the source more
readable and easier to modify.
---
src/modules/rlm_counter/rad_counter | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/modules/rlm_counter/rad_counter b/src/modules/rlm_counter/rad_counter
index be0a33a..b6c1159 100755
--- a/src/modules/rlm_counter/rad_counter
+++ b/src/modules/rlm_counter/rad_counter
@@ -19,15 +19,18 @@ my $help = 0;
$filename = '';
sub show_help {
- print "Usage: $0 --file=<counter filename> [--reset=<seconds>] [--match=<regexp>]\n";
- print "[--user=<username>] [--help] [--hours|--minutes|--seconds]\n\n";
- print "--user=<username>", "\t\t", "Information for specific user\n";
- print "--file=<filename>", "\t\t", "Counter db filename\n";
- print "--match=<regexp>", "\t\t", "Information for matching users\n";
- print "--reset=<number>", "\t\t", "Reset counter to <number>.\n";
- print "\t\t\t\t", "If divisor is set use it, else <number> means seconds\n";
- print "--help", "\t\t\t\t", "Show this help screen\n";
- print "--(hours|minutes|seconds)", "\t", "Specify information divisor\n";
+ print <<"EOF";
+Usage: $0 --file=<counter filename> [--reset=<seconds>] [--match=<regexp>]
+[--user=<username>] [--help] [--hours|--minutes|--seconds]
+
+--user=<username> Information for specific user
+--file=<filename> Counter db filename
+--match=<regexp> Information for matching users
+--reset=<number> Reset counter to <number>.
+ If divisor is set use it, else <number> means seconds
+--help Show this help screen
+--(hours|minutes|seconds) Specify information divisor
+EOF
exit 0;
}
--
2.1.3

View File

@ -45,6 +45,9 @@ Patch21: freeradius-added-D-option-to-mirror-radclient.patch
Patch22: freeradius-man-remove-client-attribute-description.patch
Patch23: freeradius-man-remove-references-to-naslist-and-clients.patch
Patch24: freeradius-valuepair-don-t-remove-unkown-backslash.patch
Patch25: freeradius-rad_counter-use-heredoc-for-help-message.patch
Patch26: freeradius-rad_counter-Refine-help-message.patch
Patch27: freeradius-dhcpclient-Add-a-short-description-to-help-output.patch
%global docdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
@ -225,6 +228,9 @@ This plugin provides the unixODBC support for the FreeRADIUS server project.
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%build
# Force compile/link options, extra security for network facing daemon