git: 65fd76b5f566 - main - makeman: extend duplicate option warning to OPT_ options

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Thu, 16 May 2024 17:31:08 UTC
The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=65fd76b5f566a21d4e017711e8d0678aab6fe59e

commit 65fd76b5f566a21d4e017711e8d0678aab6fe59e
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-05-13 19:05:39 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-05-16 17:30:37 +0000

    makeman: extend duplicate option warning to OPT_ options
    
    In a local tree I accidentally had OPT_INIT_ALL defaulting to zero in
    userland and none in kernel.  This resulted in the INIT_ALL text
    appearing twice in src.conf.5.
    
    Reviewed by:    brooks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D45184
---
 tools/build/options/makeman | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/build/options/makeman b/tools/build/options/makeman
index 30416b03b983..e0980d3be607 100755
--- a/tools/build/options/makeman
+++ b/tools/build/options/makeman
@@ -379,12 +379,18 @@ EOF
 The following options accept a single value from a list of valid values.
 .Bl -tag -width indent
 EOF
+	prev_opt=
 	show_group_options |
 	while read opt ; do
 		if [ ! -f ${opt} ] ; then
 			echo "no description found for ${opt}, skipping" >&2
 			continue
 		fi
+		if [ $opt = "$prev_opt" ]; then
+			echo "ignoring duplicate option $opt" >&2
+			continue
+		fi
+		prev_opt=$opt
 
 		echo ".It Va ${opt}"
 		cat ${opt}