]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - debug/xtrace.sh
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / debug / xtrace.sh
index 950ea5d20732e99d85953cdfbf6943a91deacc6b..608af3088af84666370b9bd456102783c0013593 100755 (executable)
@@ -1,5 +1,5 @@
 #! @BASH@
-# Copyright (C) 1999, 2001-2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999-2014 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 # Contributed by Ulrich Drepper <drepper@gnu.org>, 1999.
 
 # Lesser General Public License for more details.
 
 # You should have received a copy of the GNU Lesser General Public
-# License along with the GNU C Library; if not, write to the Free
-# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307 USA.
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
 
-pcprofileso=@SLIBDIR@/libpcprofile.so
-pcprofiledump=@BINDIR@/pcprofiledump
+pcprofileso='@SLIBDIR@/libpcprofile.so'
+pcprofiledump='@BINDIR@/pcprofiledump'
 TEXTDOMAIN=libc
 
 # Print usage message.
@@ -30,13 +29,13 @@ do_usage() {
 
 # Refer to --help option.
 help_info() {
-  printf >&2 $"Try \`xtrace --help' for more information.\n"
+  printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" xtrace xtrace
   exit 1
 }
 
 # Message for missing argument.
 do_missing_arg() {
-  printf >&2 $"xtrace: option \`$1' requires an argument.\n"
+  printf >&2 $"%s: option '%s' requires an argument.\n" xtrace "$1"
   help_info
 }
 
@@ -54,17 +53,18 @@ do_help() {
 Mandatory arguments to long options are also mandatory for any corresponding
 short options.
 
-For bug reporting instructions, please see:
-<http://www.gnu.org/software/libc/bugs.html>.\n"
+"
+  printf $"For bug reporting instructions, please see:\\n%s.\\n" \
+    "@REPORT_BUGS_TO@"
   exit 0
 }
 
 do_version() {
-  echo 'xtrace (GNU libc) @VERSION@'
+  echo 'xtrace @PKGVERSION@@VERSION@'
   printf $"Copyright (C) %s Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-" "2006"
+" "2013"
   printf $"Written by %s.
 " "Ulrich Drepper"
   exit 0
@@ -161,32 +161,32 @@ if test -n "$data"; then
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
 else
-  fifo=$(mktemp -u ${TMPDIR:-/tmp}/xtrace.XXXXXX)
+  fifo=$(mktemp -ut xtrace.XXXXXX) || exit
+  trap 'rm -f "$fifo"; exit 1' HUP INT QUIT TERM PIPE
   mkfifo -m 0600 $fifo || exit 1
-  trap 'rm $fifo; exit 1' SIGINT SIGTERM SIGPIPE
 
   # Now start the program and let it write to the FIFO.
   $TERMINAL_PROG -T "xtrace - $program $*" -e /bin/sh -c "LD_PRELOAD=$pcprofileso PCPROFILE_OUTPUT=$fifo $program $*; read < $fifo" &
   termpid=$!
-  $pcprofiledump -u $fifo |
+  $pcprofiledump -u "$fifo" |
   while read line; do
-     echo $line |
+     echo "$line" |
      sed 's/this = \([^,]*\).*/\1/' |
-     addr2line -fC -e $program
+     addr2line -fC -e "$program"
   done |
   while read fct; do
     read file
     if test "$fct" != '??' -a "$file" != '??:0'; then
-      format_line $fct $file
+      format_line "$fct" "$file"
     fi
   done
   read -p "Press return here to close $TERMINAL_PROG($program)."
-  echo > $fifo
-  rm $fifo
+  echo > "$fifo"
+  rm "$fifo"
 fi
 
 exit 0