From 9f449569df9c94670f51fd8cd5558b66884cd877 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 7 Dec 2023 22:51:52 +0100 Subject: Improve portability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- util/getdefs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'util/getdefs') diff --git a/util/getdefs b/util/getdefs index 43c0d0d..aa06947 100755 --- a/util/getdefs +++ b/util/getdefs @@ -5,20 +5,20 @@ set -e text="$(cat)" -expr='\(0x[0-9a-fA-F]\+\|[0-9]\+\)[Ll]*[Uu]*[Ll]*' -expr='\(\*\|\/\|[+~-]\|<<\|>>\)\?\s*'"$expr" +expr='\(0x[0-9a-fA-F]\{1,\}\|[0-9]\{1,\}\)[Ll]*[Uu]*[Ll]*' +expr='\(\*\|\/\|[+~-]\|<<\|>>\)\{0,1\}[[:space:]]*'"$expr" expr='\('"$expr"'\|(\|)\)' -expr='\s*\('"$expr"'\s*\)\+' +expr='[[:space:]]*\('"$expr"'[[:space:]]*\)\{1,\}' filter () { - sed -n 's/^\s*#\s*define\s\+\('"$1"'\)\s\+\('"$expr"'\)\s*\(\/.*\)\?$/\1 \2/p' + sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]]\{1,\}\('"$1"'\)[[:space:]]\{1,\}\('"$expr"'\)[[:space:]]*\(\/.*\)\{0,1\}$/\1 \2/p' } if test $# = 0; then - printf '%s\n' "$text" | filter '[A-Z0-9_]\+' + printf '%s\n' "$text" | filter '[A-Z0-9_]\{1,\}' else for prefix; do - printf '%s\n' "$text" | filter "$prefix"'_[A-Z0-9_]\+' + printf '%s\n' "$text" | filter "$prefix"'_[A-Z0-9_]\{1,\}' done fi | \ while read name value; do -- cgit v1.2.3-70-g09d2