summaryrefslogtreecommitdiff
path: root/lib/declared.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/declared.sh')
-rwxr-xr-xlib/declared.sh20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/declared.sh b/lib/declared.sh
index fbd5996..ae697b2 100755
--- a/lib/declared.sh
+++ b/lib/declared.sh
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2006-2022 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# This script determines the declared global symbols in a C header file.
@@ -24,6 +24,8 @@
# - All declarations end in ';' on the same line.
# - Not more than one symbol is declared in a declaration.
+# This script requires GNU sed.
+
# func_usage
# outputs to stdout the --help usage message.
func_usage ()
@@ -44,9 +46,9 @@ Report bugs to <bruno@clisp.org>."
# outputs to stdout the --version message.
func_version ()
{
- echo "declared.sh (GNU libunistring)"
- echo "Copyright (C) 2006, 2009 Free Software Foundation, Inc.
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+ echo "declared.sh (GNU gnulib)"
+ echo "Copyright (C) 2021 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law."
echo "Written by" "Bruno Haible"
@@ -70,7 +72,7 @@ while test $# -gt 0; do
--version | --versio | --versi | --vers | --ver | --ve | --v )
func_version
exit 0 ;;
- -- ) # Stop option prcessing
+ -- ) # Stop option processing
shift; break ;;
-* )
func_fatal_error "unrecognized option: $option"
@@ -118,17 +120,17 @@ test "$sed_result" = 'aaa' \
# A sed expression that joins 'extern' declarations that are broken over
# several lines.
sed_join_multiline_externs='
-/^extern [^;]*$/{
+/^extern [^;"]*$/{
:a
N
s/\n/ /g
- /^extern [^;]*$/{
+ /^extern [^;"]*$/{
ba
}
}'
# A sed expression that extracts the identifier of each 'extern' declaration.
-sed_extract_extern_declared='s/^extern [^()]* \([A-Za-z_][A-Za-z0-9_]*\) *[;(].*$/\1/p'
+sed_extract_extern_declared='s/^extern [^()]*[ *]\([A-Za-z_][A-Za-z0-9_]*\) *[;(].*$/\1/p'
sed -e "$sed_remove_comments" \
| sed -e "$sed_join_multiline_externs" \