]>
Commit | Line | Data |
---|---|---|
a9171047 | 1 | #! @KSH@ |
a316c1f6 | 2 | # Copyright (C) 2011, 2012 Free Software Foundation, Inc. |
a9171047 UD |
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 | |
59ba27a6 PE |
16 | # License along with the GNU C Library; if not, see |
17 | # <http://www.gnu.org/licenses/>. | |
a9171047 UD |
18 | |
19 | # We should be able to find the translation right at the beginning. | |
20 | TEXTDOMAIN=libc | |
21 | TEXTDOMAINDIR=@TEXTDOMAINDIR@ | |
22 | ||
23 | unset SOTRUSS_FROMLIST | |
24 | unset SOTRUSS_TOLIST | |
25 | unset SOTRUSS_OUTNAME | |
26 | unset SOTRUSS_EXIT | |
27 | unset SOTRUSS_NOINDENT | |
28 | SOTRUSS_WHICH=$$ | |
29 | lib='@PREFIX@/$LIB/audit/sotruss-lib.so' | |
30 | ||
31 | function do_help { | |
32 | echo $"Usage: sotruss [OPTION...] [--] EXECUTABLE [EXECUTABLE-OPTION...] | |
633e9e0f UD |
33 | -F, --from FROMLIST Trace calls from objects on FROMLIST |
34 | -T, --to TOLIST Trace calls to objects on TOLIST | |
a9171047 | 35 | |
633e9e0f UD |
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 | |
a9171047 UD |
39 | -f is also used) instead of standard error |
40 | ||
633e9e0f UD |
41 | -?, --help Give this help list |
42 | --usage Give a short usage message | |
43 | --version Print program version" | |
a9171047 UD |
44 | |
45 | echo | |
46 | printf $"Mandatory arguments to long options are also mandatory for any corresponding\nshort options.\n" | |
47 | echo | |
48 | ||
633e9e0f | 49 | printf $"For bug reporting instructions, please see: |
a9171047 UD |
50 | <http://www.gnu.org/software/libc/bugs.html>. |
51 | " | |
52 | exit 0 | |
53 | } | |
54 | ||
55 | function do_missing_arg { | |
56 | printf >&2 $"%s: option requires an argument -- '%s'\n" sotruss "$1" | |
57 | printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss | |
58 | exit 1 | |
59 | } | |
60 | ||
61 | function do_ambiguous { | |
62 | printf >&2 $"%s: option is ambiguous; possibilities:" | |
63 | while test $# -gt 0; do | |
64 | printf >&2 " '%s'" $1 | |
65 | shift | |
66 | done | |
67 | printf >&2 "\n" | |
68 | printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss | |
69 | exit 1 | |
70 | } | |
71 | ||
72 | while test $# -gt 0; do | |
73 | case "$1" in | |
74 | --v | --ve | --ver | --vers | --versi | --versio | --version) | |
75 | echo "sotruss (GNU libc) @VERSION@" | |
76 | printf $"Copyright (C) %s Free Software Foundation, Inc. | |
77 | This is free software; see the source for copying conditions. There is NO | |
78 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
a316c1f6 | 79 | " "2012" |
a9171047 UD |
80 | printf $"Written by %s.\n" "Ulrich Drepper" |
81 | exit 0 | |
82 | ;; | |
633e9e0f | 83 | -\? | --h | --he | --hel | --help) |
a9171047 UD |
84 | do_help |
85 | ;; | |
86 | --u | --us | --usa | --usag | --usage) | |
87 | printf $"Usage: %s [-ef] [-F FROMLIST] [-o FILENAME] [-T TOLIST] [--exit] | |
633e9e0f UD |
88 | [--follow] [--from FROMLIST] [--output FILENAME] [--to TOLIST] |
89 | [--help] [--usage] [--version] [--] | |
90 | EXECUTABLE [EXECUTABLE-OPTION...]\n" sotruss | |
a9171047 UD |
91 | exit 0 |
92 | ;; | |
93 | -F | --fr | --fro | --from) | |
94 | if test $# -eq 1; then | |
95 | do_missing_arg "$1" | |
96 | fi | |
97 | shift | |
98 | SOTRUSS_FROMLIST="$2" | |
99 | ;; | |
100 | -T | --t | --to) | |
101 | if test $# -eq 1; then | |
102 | do_missing_arg "$1" | |
103 | fi | |
104 | shift | |
105 | SOTRUSS_TOLIST="$2" | |
106 | ;; | |
107 | -o | --o | --ou | --out | --outp | --outpu | --output) | |
108 | if test $# -eq 1; then | |
109 | do_missing_arg "$1" | |
110 | fi | |
111 | shift | |
112 | SOTRUSS_OUTNAME="$1" | |
113 | ;; | |
114 | -f | --fo | --fol | --foll | --follo | --follow) | |
115 | unset SOTRUSS_WHICH | |
116 | ;; | |
117 | -l | --l | --li | --lib) | |
118 | if test $# -eq 1; then | |
119 | do_missing_arg "$1" | |
120 | fi | |
121 | shift | |
122 | lib="$1" | |
123 | ;; | |
124 | -e | --e | --ex | --exi | --exit) | |
125 | SOTRUSS_EXIT=1 | |
126 | ;; | |
127 | --f) | |
128 | do_ambiguous '--from' '--follow' | |
129 | ;; | |
130 | --) | |
131 | shift | |
132 | break | |
133 | ;; | |
134 | -*) | |
135 | printf >&2 $"%s: unrecognized option '%c%s'\n" sotruss '-' ${1#-} | |
136 | printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" sotruss sotruss | |
137 | exit 1 | |
138 | ;; | |
139 | *) | |
140 | break | |
141 | ;; | |
142 | esac | |
143 | shift | |
144 | done | |
145 | ||
146 | export SOTRUSS_FROMLIST | |
147 | export SOTRUSS_TOLIST | |
148 | export SOTRUSS_OUTNAME | |
149 | export SOTRUSS_WHICH | |
150 | export SOTRUSS_EXIT | |
151 | export LD_AUDIT="$lib" | |
152 | ||
153 | exec "$@" | |
154 | # Local Variables: | |
155 | # mode:ksh | |
156 | # End: |