diff options
author | Devin Teske <dteske@FreeBSD.org> | 2018-05-12 05:41:28 +0000 |
---|---|---|
committer | Devin Teske <dteske@FreeBSD.org> | 2018-05-12 05:41:28 +0000 |
commit | 5f2202d104736a9446569c03f3919aa5841e5c1c (patch) | |
tree | 02b536ce73e03610eabe8696bf863c29314e7e62 /cddl/usr.sbin | |
parent | 4a84c26cfc241ffa113d2e815d61d4b406b937e9 (diff) | |
download | src-5f2202d104736a9446569c03f3919aa5841e5c1c.tar.gz src-5f2202d104736a9446569c03f3919aa5841e5c1c.zip |
dwatch(1): Separate default values so `-[BK] num' don't affect usage
If you were to pass an invalid option after `-B num' or `-K num' you
would see that the usage statement would show the value you passed
instead of the actual default.
Moving the default values to separate variables that are unaffected
by the options-parsing allows the usage statement to correctly show
the hard-coded default values if no flags are used.
Sponsored by: Smule, Inc.
Notes
Notes:
svn path=/head/; revision=333514
Diffstat (limited to 'cddl/usr.sbin')
-rwxr-xr-x | cddl/usr.sbin/dwatch/dwatch | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cddl/usr.sbin/dwatch/dwatch b/cddl/usr.sbin/dwatch/dwatch index 2da14a9d9459..ecf6e1c9aa35 100755 --- a/cddl/usr.sbin/dwatch/dwatch +++ b/cddl/usr.sbin/dwatch/dwatch @@ -57,6 +57,12 @@ pgm="${0##*/}" # Program basename PROBE_ARG= # +# Command-line defaults +# +_MAX_ARGS=64 # -B num +_MAX_DEPTH=64 # -K num + +# # Command-line options # CONSOLE= # -y @@ -77,8 +83,8 @@ GROUP= # -g group JID= # -j jail LIST= # -l LIST_PROFILES= # -Q -MAX_ARGS=64 # -B num -MAX_DEPTH=64 # -K num +MAX_ARGS=$_MAX_ARGS # -B num +MAX_DEPTH=$_MAX_DEPTH # -K num ONELINE= # -1 OUTPUT= # -o file OUTPUT_CMD= # -O cmd @@ -144,7 +150,7 @@ usage() printf "$optfmt" "-1" \ "Print one line per process/profile (Default; disables \`-R')." printf "$optfmt" "-B num" \ - "Maximum process arguments to display (Default $MAX_ARGS)." + "Maximum process arguments to display (Default $_MAX_ARGS)." printf "$optfmt" "-d" \ "Debug. Send dtrace(1) script to stdout instead of executing." printf "$optfmt" "-e" \ @@ -162,7 +168,7 @@ usage() printf "$optfmt" "-k name" \ "Only show processes matching name." printf "$optfmt" "-K num" \ - "Maximum directory depth to display (Default $MAX_DEPTH)." + "Maximum directory depth to display (Default $_MAX_DEPTH)." printf "$optfmt" "-l" \ "List available probes on standard output and exit." printf "$optfmt" "-m" \ |