git: 8739d155b4 - main - documentation/tools: Make *key.sh more portable

Igor Ostapenko <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by igoro:

URL: https://cgit.FreeBSD.org/doc/commit/?id=8739d155b4416c7a2f68085cc76c5400ea06cffe

commit 8739d155b4416c7a2f68085cc76c5400ea06cffe
Author:     Igor Ostapenko <[email protected]>
AuthorDate: 2024-09-09 20:10:12 +0000
Commit:     Igor Ostapenko <[email protected]>
CommitDate: 2024-09-09 20:18:02 +0000

    documentation/tools: Make *key.sh more portable
    
    POSIX does not include ";&" as a case fallthrough syntax.
    
    Reviewed by:    kp, des, markj
    Approved by:    kp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D46453
---
 documentation/tools/addkey.sh   | 15 ++++++++-------
 documentation/tools/checkkey.sh | 16 ++++++++--------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/documentation/tools/addkey.sh b/documentation/tools/addkey.sh
index 9b77bdf4df..776aeee40c 100755
--- a/documentation/tools/addkey.sh
+++ b/documentation/tools/addkey.sh
@@ -73,19 +73,20 @@ if [ $# -ne 0 ] ; then
 		case $(expr "${arg}" : '^[0-9A-Fa-f]\{8,16\}$') in
 		8)
 			warning "${arg}: recommend using 16-digit keyid"
-			;&
+			;;
 		16)
-			keyid=$(getkeybyid "${arg}")
-			if [ -n "${keyid}" ] ; then
-				keyids="${keyids} ${keyid}"
-			else
-				warning "${arg} not found"
-			fi
 			;;
 		*)
 			warning "${arg} does not appear to be a valid key ID"
+			continue
 			;;
 		esac
+		keyid=$(getkeybyid "${arg}")
+		if [ -n "${keyid}" ] ; then
+			keyids="${keyids} ${keyid}"
+		else
+			warning "${arg} not found"
+		fi
 	done
 else
 	# Search for keys by freebsd.org email
diff --git a/documentation/tools/checkkey.sh b/documentation/tools/checkkey.sh
index c4772f13b3..8740a5dde6 100755
--- a/documentation/tools/checkkey.sh
+++ b/documentation/tools/checkkey.sh
@@ -105,20 +105,20 @@ if [ $# -ne 0 ] ; then
 		case $(expr "${arg}" : '^[0-9A-Fa-f]\{8,16\}$') in
 		8)
 			warning "${arg}: recommend using 16-digit keyid"
-			;&
+			;;
 		16)
-			keyid=$(getkeybyid "${arg}")
-			if [ -n "${keyid}" ] ; then
-				keyids="${keyids} ${keyid}"
-			else
-				warning "${arg} not found"
-			fi
 			;;
 		*)
 			warning "${arg} does not appear to be a valid key ID"
+			continue
 			;;
 		esac
-		shift
+		keyid=$(getkeybyid "${arg}")
+		if [ -n "${keyid}" ] ; then
+			keyids="${keyids} ${keyid}"
+		else
+			warning "${arg} not found"
+		fi
 	done
 else
 	# Search for keys by freebsd.org email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.