summary refs log tree commit diff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2014-01-25 00:33:48 -0500
committerMike Frysinger <vapier@gentoo.org>2014-03-13 19:56:01 -0400
commitb93834ef81bcc3ba41609b899d432c96adae9eda (patch)
treeeaef6f5827f4dfaf35d7163c40d3d1031dbdf45b
parentf3a4632a3f5bae8d0bdee2738afcd2d6e715ea99 (diff)
downloadglibc-b93834ef81bcc3ba41609b899d432c96adae9eda.tar.gz
glibc-b93834ef81bcc3ba41609b899d432c96adae9eda.tar.xz
glibc-b93834ef81bcc3ba41609b899d432c96adae9eda.zip
sotruss: drop ksh support and add basic POSIX shell support
This script works fine under bash as-is, so we don't need ksh anymore.

Once we tweak the function style, the code even works (for the most part)
under a POSIX shell.  The localized strings will be prepended with a $,
but it is otherwise functional.
-rw-r--r--ChangeLog8
-rw-r--r--elf/Makefile6
-rwxr-xr-xelf/sotruss.sh (renamed from elf/sotruss.ksh)11
3 files changed, 15 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index e290c04912..64b93efed8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2014-03-13  Mike Frysinger  <vapier@gentoo.org>
 
+	* elf/Makefile: Delete $(have-ksh) check.
+	($(objpfx)sotruss): Change KSH to BASH.
+	* elf/sotruss.ksh: Rename to ...
+	* elf/sotruss.sh: ... this.  Change @KSH@ to @BASH@.  Change
+	function style to match POSIX.  Drop ksh vim mode setting.
+
+2014-03-13  Mike Frysinger  <vapier@gentoo.org>
+
 	* manual/time.texi (Specifying the Time Zone with TZ): Change
 	Tuesday to Thursday.
 
diff --git a/elf/Makefile b/elf/Makefile
index 2db3c980da..8abc60b821 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -93,7 +93,7 @@ pldd-modules := xmalloc
 # To find xmalloc.c and xstrdup.c
 vpath %.c ../locale/programs
 
-ifeq ($(have-ksh)$(build-shared),yesyes)
+ifeq ($(build-shared),yes)
 extra-objs += sotruss-lib.os sotruss-lib.so
 install-others += $(inst_auditdir)/sotruss-lib.so
 install-bin-script += sotruss
@@ -104,8 +104,8 @@ $(objpfx)sotruss-lib.so: $(objpfx)sotruss-lib.os
 $(objpfx)sotruss-lib.so: $(common-objpfx)libc.so $(objpfx)ld.so \
 	$(common-objpfx)libc_nonshared.a
 
-$(objpfx)sotruss: sotruss.ksh $(common-objpfx)config.make
-	sed -e 's%@KSH@%$(KSH)%g' \
+$(objpfx)sotruss: sotruss.sh $(common-objpfx)config.make
+	sed -e 's%@BASH@%$(BASH)%g' \
 	    -e 's%@VERSION@%$(version)%g' \
 	    -e 's%@TEXTDOMAINDIR@%$(msgcatdir)%g' \
 	    -e 's%@PREFIX@%$(prefix)%g' \
diff --git a/elf/sotruss.ksh b/elf/sotruss.sh
index 371a70b3e1..483513e80c 100755
--- a/elf/sotruss.ksh
+++ b/elf/sotruss.sh
@@ -1,4 +1,4 @@
-#! @KSH@
+#! @BASH@
 # Copyright (C) 2011-2014 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -28,7 +28,7 @@ unset SOTRUSS_NOINDENT
 SOTRUSS_WHICH=$$
 lib='@PREFIX@/$LIB/audit/sotruss-lib.so'
 
-function do_help {
+do_help() {
   echo $"Usage: sotruss [OPTION...] [--] EXECUTABLE [EXECUTABLE-OPTION...]
   -F, --from FROMLIST     Trace calls from objects on FROMLIST
   -T, --to TOLIST         Trace calls to objects on TOLIST
@@ -51,13 +51,13 @@ function do_help {
   exit 0
 }
 
-function do_missing_arg {
+do_missing_arg() {
   printf >&2 $"%s: option requires an argument -- '%s'\n" sotruss "$1"
   printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss
   exit 1
 }
 
-function do_ambiguous {
+do_ambiguous() {
   printf >&2 $"%s: option is ambiguous; possibilities:"
   while test $# -gt 0; do
     printf >&2 " '%s'" $1
@@ -150,6 +150,3 @@ export SOTRUSS_EXIT
 export LD_AUDIT="$lib"
 
 exec "$@"
-# Local Variables:
-#  mode:ksh
-# End: