Module Name:    src
Committed By:   lukem
Date:           Sun Jan  9 03:31:23 UTC 2022

Modified Files:
        src/usr.sbin/etcupdate: etcupdate etcupdate.8

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/etcupdate/etcupdate
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/etcupdate/etcupdate.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/etcupdate/etcupdate
diff -u src/usr.sbin/etcupdate/etcupdate:1.62 src/usr.sbin/etcupdate/etcupdate:1.63
--- src/usr.sbin/etcupdate/etcupdate:1.62	Sun Jan  9 03:25:38 2022
+++ src/usr.sbin/etcupdate/etcupdate	Sun Jan  9 03:31:23 2022
@@ -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_PWD_MKDB=false
 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 @@ do
 		DESTDIR="${OPTARG}"
 		;;
 	h)
-		usage
+		help
+		exit 0
 		;;
 	l)
 		LOCALSKIP=true

Index: src/usr.sbin/etcupdate/etcupdate.8
diff -u src/usr.sbin/etcupdate/etcupdate.8:1.23 src/usr.sbin/etcupdate/etcupdate.8:1.24
--- src/usr.sbin/etcupdate/etcupdate.8:1.23	Wed Nov 21 20:18:11 2018
+++ src/usr.sbin/etcupdate/etcupdate.8	Sun Jan  9 03:31:23 2022
@@ -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 @@ For example,
 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 @@ but it can be changed either with this o
 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.

Reply via email to