"Fossies" - the Fresh Open Source Software Archive

Member "mpr-2.8/mprso" (3 Jan 2004, 1926 Bytes) of package /linux/misc/old/mpr-2.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 TMP=${MPRTMP-/tmp}
    4 MPRAWK=${MPRAWK-awk}
    5 lddfile=$TMP/mprso.ldd.$$
    6 nmfile=$TMP/mprso.nm.$$
    7 
    8 case "$#" in
    9 1)  aout=`mprwhich -s "$1"` || exit 1;;
   10 *)  echo usage: mprso a.out >&2
   11     exit 1;;
   12 esac
   13 
   14 case "$LD_PRELOAD" in
   15 *libmpr.so*)
   16     echo mprso: warning: setting LD_PRELOAD=libmpr.so is NOT recommended >&2;;
   17 esac
   18 
   19 status=1
   20 trap 'rm -f $lddfile $nmfile; trap 0; exit $status' 0 1 2 15
   21 
   22 mprnm "$aout" 2>/dev/null >$nmfile
   23 if grep '   mprbt$' $nmfile >/dev/null; then
   24     status=0
   25     exit
   26 fi
   27 
   28 case `file "$aout"` in
   29 *ELF*"dynamically linked"*)
   30     if (cat $nmfile; mprnm -D "$aout" 2>/dev/null) | egrep '    (malloc|realloc)$' >/dev/null; then
   31         echo mprso: warning: "$aout" already includes malloc/realloc >&2
   32     fi;;
   33 *)  echo "mprso: error: $aout is static but is not linked with libmpr.a" >&2
   34     exit;;
   35 esac
   36 
   37 unset MPRFI
   38 if ldd "$aout" >$lddfile 2>&1; then
   39     :
   40 else
   41     echo "mprso: error: ldd $aout failed: please check LD_LIBRARY_PATH" >&2
   42     cat $lddfile >&2
   43     exit
   44 fi
   45 
   46 if grep 'not found$' $lddfile >/dev/null; then
   47     echo "mprso: error: 'ldd $aout' failed: please check LD_LIBRARY_PATH" >&2
   48     cat $lddfile >&2
   49     exit
   50 fi
   51 
   52 if grep libmpr.so $lddfile >/dev/null; then
   53     echo "mprso=true; export mprso"
   54     status=0
   55     exit
   56 fi
   57 
   58 if LD_PRELOAD="${MPRLD_PRELOAD-libmpr.so}${LD_PRELOAD:+:}$LD_PRELOAD" ldd "$aout" >$lddfile 2>&1; then
   59     :
   60 else
   61     echo "mprso: error: 'LD_PRELOAD=${MPRLD_PRELOAD-libmpr.so}${LD_PRELOAD:+:}$LD_PRELOAD ldd $aout' failed: please check LD_LIBRARY_PATH" >&2
   62     cat $lddfile >&2
   63     exit
   64 fi
   65 
   66 if grep 'not found$' $lddfile >/dev/null; then
   67     echo "mprso: error: 'LD_PRELOAD=${MPRLD_PRELOAD-libmpr.so}${LD_PRELOAD:+:}$LD_PRELOAD ldd $aout' failed: please check LD_LIBRARY_PATH" >&2
   68     cat $lddfile >&2
   69     exit
   70 fi
   71 
   72 case `file "$aout"` in
   73 *"not stripped")
   74     ;;
   75 *stripped)
   76     echo "mprso: warning: $aout is a stripped executable" >&2;;
   77 esac
   78 
   79 echo "mprso=true; export mprso"
   80 echo "MPRLD_PRELOAD=${MPRLD_PRELOAD-libmpr.so}; export MPRLD_PRELOAD"
   81 status=0