$OpenBSD: patch-script_tprofprel,v 1.2 2007/06/29 11:06:25 kili Exp $

Fix shell gibberish. Note that this is not POSIX. If you want POSIX,
use foo=$((foo + 1)) instead. I don't care unless someone removes
"let" from our /bin/sh.

--- script/tprofprel.orig	Tue Nov  2 10:56:38 2004
+++ script/tprofprel	Sat Jun 23 00:05:03 2007
@@ -7,20 +7,6 @@ case $# in
   1) exit 1;;
 esac
 
-case $BASH in
-  "") if ( bash --version -e >/dev/null 2>&1 )
-      then exec bash $0 "$@"
-      fi ;;
-  *) ;;
-esac
-
-
-# Nasty compatibility stuff between /bin/sh/ and bash for arithmetic.
-if sh --version 2>/dev/null | grep -i gnu >/dev/null
-then increment() { ( let x=$1+1; echo $x; ); }
-else increment() { echo $1 + 1 | bc; }
-fi
-
 BUILTIN='Builtin' #Runtime Module added to beginning
 MODNAMES=''
 nummods=0
@@ -35,7 +21,7 @@ do 
   else
     MODNAMES=${MODNAMES}' _95Driver'
   fi
-  nummods=`increment $nummods`
+  let nummods++
   if test "'$1'" != "''" 
   then 
     shift
@@ -91,7 +77,7 @@ fi
 if test "'$USRPREL'" != "'0'" 
 then
   MODNAMES=${BUILTIN}' '${MODNAMES}
-  nummods=`increment $nummods`
+  let nummods++
   if test "'$USRPREL'" = "'1'" 
   then
     echo '#include <string.h>'
@@ -100,7 +86,7 @@ then
     echo '  char *strc;'
     echo '  int i = strlen(str)+1;'
     echo '  if(0==(strc = (char *)malloc(i))) {'
-    echo '    fprintf(stderr,"No space to duplicate \"%s\"\n",str);'
+    echo '    fprintf(stderr,"No space to duplicate \"%s\"\\n",str);'
     echo '    exit(-1);'
     echo '  }'
     echo '  strcpy(strc,str);'
@@ -162,7 +148,7 @@ then
       echo '    tprofInitTree(&TMIP_'${USRPREL}${mod}',strdup("-'${NUMSTR}${mod}'"),&TM_'${mod}');'
       echo '  else'
       echo '    tprofInitTree(&TMIP_'${USRPREL}${mod}',strdup("+'${NUMSTR}${mod}'"),&TM_'${mod}');'
-      num=`increment $num`
+      let num++
     else
       echo '    tprofInitTree(&TMIP_'${USRPREL}'Driver,strdup("-'00_Driver'"),&TM_'${mod}');'
       echo '  else'
