1#!/bin/bash 2# Copyright (C) 2011-2022 Free Software Foundation, Inc. 3# This file is part of the GNU C Library. 4 5# The GNU C Library is free software; you can redistribute it and/or 6# modify it under the terms of the GNU Lesser General Public 7# License as published by the Free Software Foundation; either 8# version 2.1 of the License, or (at your option) any later version. 9 10# The GNU C Library is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13# Lesser General Public License for more details. 14 15# You should have received a copy of the GNU Lesser General Public 16# License along with the GNU C Library; if not, see 17# <https://www.gnu.org/licenses/>. 18 19# We should be able to find the translation right at the beginning. 20TEXTDOMAIN=libc 21TEXTDOMAINDIR=@TEXTDOMAINDIR@ 22 23unset SOTRUSS_FROMLIST 24unset SOTRUSS_TOLIST 25unset SOTRUSS_OUTNAME 26unset SOTRUSS_EXIT 27unset SOTRUSS_NOINDENT 28SOTRUSS_WHICH=$$ 29lib='@PREFIX@/$LIB/audit/sotruss-lib.so' 30 31do_help() { 32 echo $"Usage: sotruss [OPTION...] [--] EXECUTABLE [EXECUTABLE-OPTION...] 33 -F, --from FROMLIST Trace calls from objects on FROMLIST 34 -T, --to TOLIST Trace calls to objects on TOLIST 35 36 -e, --exit Also show exits from the function calls 37 -f, --follow Trace child processes 38 -o, --output FILENAME Write output to FILENAME (or FILENAME.$PID in case 39 -f is also used) instead of standard error 40 41 -?, --help Give this help list 42 --usage Give a short usage message 43 --version Print program version" 44 45 echo 46 printf $"Mandatory arguments to long options are also mandatory for any corresponding\nshort options.\n" 47 echo 48 49 printf $"For bug reporting instructions, please see:\\n%s.\\n" \ 50 "@REPORT_BUGS_TO@" 51 exit 0 52} 53 54do_missing_arg() { 55 printf >&2 $"%s: option requires an argument -- '%s'\n" sotruss "$1" 56 printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss 57 exit 1 58} 59 60do_ambiguous() { 61 printf >&2 $"%s: option is ambiguous; possibilities:" 62 while test $# -gt 0; do 63 printf >&2 " '%s'" $1 64 shift 65 done 66 printf >&2 "\n" 67 printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss 68 exit 1 69} 70 71while test $# -gt 0; do 72 case "$1" in 73 --v | --ve | --ver | --vers | --versi | --versio | --version) 74 echo "sotruss @PKGVERSION@@VERSION@" 75 printf $"Copyright (C) %s Free Software Foundation, Inc. 76This is free software; see the source for copying conditions. There is NO 77warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 78" "2022" 79 printf $"Written by %s.\n" "Ulrich Drepper" 80 exit 0 81 ;; 82 -\? | --h | --he | --hel | --help) 83 do_help 84 ;; 85 --u | --us | --usa | --usag | --usage) 86 printf $"Usage: %s [-ef] [-F FROMLIST] [-o FILENAME] [-T TOLIST] [--exit] 87 [--follow] [--from FROMLIST] [--output FILENAME] [--to TOLIST] 88 [--help] [--usage] [--version] [--] 89 EXECUTABLE [EXECUTABLE-OPTION...]\n" sotruss 90 exit 0 91 ;; 92 -F | --fr | --fro | --from) 93 if test $# -eq 1; then 94 do_missing_arg "$1" 95 fi 96 shift 97 SOTRUSS_FROMLIST="$1" 98 ;; 99 -T | --t | --to) 100 if test $# -eq 1; then 101 do_missing_arg "$1" 102 fi 103 shift 104 SOTRUSS_TOLIST="$1" 105 ;; 106 -o | --o | --ou | --out | --outp | --outpu | --output) 107 if test $# -eq 1; then 108 do_missing_arg "$1" 109 fi 110 shift 111 SOTRUSS_OUTNAME="$1" 112 ;; 113 -f | --fo | --fol | --foll | --follo | --follow) 114 unset SOTRUSS_WHICH 115 ;; 116 -l | --l | --li | --lib) 117 if test $# -eq 1; then 118 do_missing_arg "$1" 119 fi 120 shift 121 lib="$1" 122 ;; 123 -e | --e | --ex | --exi | --exit) 124 SOTRUSS_EXIT=1 125 ;; 126 --f) 127 do_ambiguous '--from' '--follow' 128 ;; 129 --) 130 shift 131 break 132 ;; 133 -*) 134 printf >&2 $"%s: unrecognized option '%c%s'\n" sotruss '-' ${1#-} 135 printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss 136 exit 1 137 ;; 138 *) 139 break 140 ;; 141 esac 142 shift 143done 144 145export SOTRUSS_FROMLIST 146export SOTRUSS_TOLIST 147export SOTRUSS_OUTNAME 148export SOTRUSS_WHICH 149export SOTRUSS_EXIT 150export LD_AUDIT="$lib" 151 152exec "$@" 153