Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/etcupdate etcupdate: -h to stdout. improve help



details:   https://anonhg.NetBSD.org/src/rev/26881a468354
branches:  trunk
changeset: 359541:26881a468354
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sun Jan 09 03:31:23 2022 +0000

description:
etcupdate: -h to stdout. improve help

Send -h help to stdout not stderr, and exit 0 not 1.
Show options alphabetically.
Use UPPER_CASE instead of lowercase as the convention for argument names.

diffstat:

 usr.sbin/etcupdate/etcupdate   |  51 +++++++++++++++++++++++------------------
 usr.sbin/etcupdate/etcupdate.8 |  16 +++++++-----
 2 files changed, 38 insertions(+), 29 deletions(-)

diffs (138 lines):

diff -r 57537db2f1b4 -r 26881a468354 usr.sbin/etcupdate/etcupdate
--- a/usr.sbin/etcupdate/etcupdate      Sun Jan 09 03:25:38 2022 +0000
+++ b/usr.sbin/etcupdate/etcupdate      Sun Jan 09 03:31:23 2022 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.62 2022/01/09 03:25:38 lukem Exp $
+# $NetBSD: etcupdate,v 1.63 2022/01/09 03:31:23 lukem Exp $
 #
 # Copyright (c) 2001-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -80,34 +80,40 @@
 NEED_SERVICES_MKDB=false
 
 
-usage()
+help()
 {
-       cat << EOF >&2
+       cat << EOF
 
-Usage: ${PROG} [options]
+Usage: ${PROG} [-alv] [-d DESTDIR] [-p PAGER] [-s SRC_ARG] [-t TEMPROOT] [-w WIDTH]
+       ${PROG} -h
 
 Options:
 
-  -p pager     Which pager to use              (default: /usr/bin/more)
-  -s {srcdir|tgzfile|tempdir}                  (default: /usr/src)
-               Location of the source files.  This may be any of the
-               following:
-               * A directory that contains a NetBSD source tree;
-               * A distribution set file such as "etc.tgz" or
-                 "xetc.tgz".  Pass multiple -s options to specify
-                 multiple such files;
-               * A temporary directory in which one or both of
-                 "etc.tgz" and "xetc.tgz" have been extracted.
-  -t temproot  Where to store temporary files  (default: /tmp/temproot)
-  -d destdir   Destination directory to check. (default: /)
-  -w width     Screen width                    (default: 80)
-  -a           Automatically update unmodified files
+  -a           Automatically update unmodified files.
+  -d DESTDIR   Destination directory to check. [/]
+  -h           Display this help, and exit.
   -l           Automatically skip files with strictly local changes
-               (this option has no effect on files lacking RCS Ids)
-  -h           This help text
-  -v           Be more verbose
+               (this option has no effect on files lacking RCS Ids).
+  -p PAGER     Which pager to use              [/usr/bin/more]
+  -s SRC_ARG   Location of the source files.   [/usr/src]
+               This may be any of the following:
+                 -s SRC_DIR   A directory that contains a NetBSD
+                              source tree.
+                 -s TGZ_DIR   A directory in which one or both of
+                              "etc.tgz" and "xetc.tgz" have been extracted.
+                 -s TGZ_FILE  A distribution set file such as "etc.tgz" or
+                              "xetc.tgz".  May be specified multiple times.
+
+  -t TEMPROOT  Where to store temporary files. [/tmp/temproot]
+  -w WIDTH     Screen width.                   [80]
+  -v           Be more verbose.
 
 EOF
+}
+
+usage()
+{
+       help 1>&2
        exit 1
 }
 
@@ -481,7 +487,8 @@
                DESTDIR="${OPTARG}"
                ;;
        h)
-               usage
+               help
+               exit 0
                ;;
        l)
                LOCALSKIP=true
diff -r 57537db2f1b4 -r 26881a468354 usr.sbin/etcupdate/etcupdate.8
--- a/usr.sbin/etcupdate/etcupdate.8    Sun Jan 09 03:25:38 2022 +0000
+++ b/usr.sbin/etcupdate/etcupdate.8    Sun Jan 09 03:31:23 2022 +0000
@@ -1,6 +1,6 @@
-.\"    $NetBSD: etcupdate.8,v 1.23 2018/11/21 20:18:11 martin Exp $
+.\"    $NetBSD: etcupdate.8,v 1.24 2022/01/09 03:31:23 lukem Exp $
 .\"
-.\" Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2001-2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 20, 2018
+.Dd January 9, 2022
 .Dt ETCUPDATE 8
 .Os
 .Sh NAME
@@ -36,12 +36,14 @@
 .Pa /etc
 .Sh SYNOPSIS
 .Nm
-.Op Fl ahlv
+.Op Fl alv
 .Op Fl d Ar destdir
 .Op Fl p Ar pager
-.Op Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
+.Op Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile
 .Op Fl t Ar temproot
 .Op Fl w Ar width
+.Nm
+.Fl h
 .Sh DESCRIPTION
 .Nm
 is a tool that lets the administrator update the configuration and
@@ -148,7 +150,7 @@
 will be used instead of
 .Pa /etc .
 .It Fl h
-Prints a help text.
+Prints a help text, and exit.
 .It Fl l
 Automatically skip files with unchanged RCS IDs.
 This has the effect of leaving alone files that have been altered
@@ -167,7 +169,7 @@
 or by defining the
 .Ev PAGER
 variable.
-.It Fl s Brq Ar srcdir | Ar tgzdir | Ar tgzfile
+.It Fl s Pq Ar srcdir | Ar tgzdir | Ar tgzfile
 The location of the reference files, or the
 .Nx
 source files used to create the reference files.



Home | Main Index | Thread Index | Old Index