#! @BASH@
-# Copyright (C) 1999-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1999-2017 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/>.
memusageso='@SLIBDIR@/libmemusage.so'
memusagestat='@BINDIR@/memusagestat'
# Print usage message.
do_usage() {
- echo >&2 $"Try \`memusage --help' for more information."
+ printf >&2 $"Try \`%s --help' or \`%s --usage' for more information.\n" memusage memusage
exit 1
}
# Message for missing argument.
do_missing_arg() {
- echo >&2 $"memusage: option \`$1' requires an argument"
+ printf >&2 $"%s: option '%s' requires an argument\n" memusage "$1"
do_usage
}
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>."
+"
+ printf $"For bug reporting instructions, please see:\\n%s.\\n" \
+ "@REPORT_BUGS_TO@"
exit 0
}
do_version() {
- echo 'memusage (GNU libc) @VERSION@'
+ echo 'memusage @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.
-" "2007"
+" "2017"
printf $"Written by %s.
" "Ulrich Drepper"
exit 0
}
+# These variables are local
+buffer=
+data=
+memusagestat_args=
+notimer=
+png=
+progname=
+tracemmap=
+
# Process arguments. But stop as soon as the program name is found.
while test $# -gt 0; do
case "$1" in
;;
--us | --usa | --usag | --usage)
echo $"Syntax: memusage [--data=FILE] [--progname=NAME] [--png=FILE] [--unbuffered]
- [--buffer=SIZE] [--no-timer] [--time-based] [--total]
- [--title=STRING] [--x-size=SIZE] [--y-size=SIZE]
- PROGRAM [PROGRAMOPTION]..."
+ [--buffer=SIZE] [--no-timer] [--time-based] [--total]
+ [--title=STRING] [--x-size=SIZE] [--y-size=SIZE]
+ PROGRAM [PROGRAMOPTION]..."
exit 0
;;
-n | --pr | --pro | --prog | --progn | --progna | --prognam | --progname)
if test -n "$data"; then
datafile="$data"
elif test -n "$png"; then
- datafile=$(mktemp ${TMPDIR:-/tmp}/memusage.XXXXXX 2> /dev/null)
- if test $? -ne 0; then
- # Lame, but if there is no `mktemp' program the user cannot expect more.
- if test "$RANDOM" != "$RANDOM"; then
- datafile=${TMPDIR:-/tmp}/memusage.$RANDOM
- else
- datafile=${TMPDIR:-/tmp}/memusage.$$
- fi
- fi
+ datafile=$(mktemp -t memusage.XXXXXX) || exit
+ trap 'rm -f "$datafile"; exit 1' HUP INT QUIT TERM PIPE
fi
if test -n "$datafile"; then
add_env="$add_env MEMUSAGE_OUTPUT=$datafile"