PageRenderTime 51ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/glibc-2.16-75f0d304/elf/sotruss.ksh

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