home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-bin.lha / bin / octave-bug < prev   
Text File  |  1996-10-12  |  5KB  |  211 lines

  1. #! /bin/sh -
  2. #
  3. # octave-bug - create a bug report and mail it to the bug-octave
  4. # mailing list.
  5. #
  6. # Patterned after the bashbug script from bash 1.14.
  7. #
  8. # John W. Eaton
  9. # jwe@che.utexas.edu
  10. # Department of Chemical Engineering
  11. # The University of Texas at Austin
  12.  
  13. # Configuration:  these variables are filled in at configuration time.
  14.  
  15. VERSION="1.1.1"
  16. MACHINE="m68k-unknown-amigaos"
  17. F77=""
  18. FFLAGS="-O"
  19. FLIBS="-lf2c"
  20. F2C="f2c"
  21. F2CFLAGS=""
  22. CC="gcc"
  23. CFLAGS="-DHAVE_CONFIG_H  -g -O2"
  24. CXX="c++"
  25. CXXFLAGS="-DHAVE_CONFIG_H  -fno-implicit-templates  -g -O2 -fno-for-scope"
  26. LDFLAGS="-s"
  27. DEFS="-DOCTAVE_SOURCE=1 -DSEPCHAR=':' -DSEPCHAR_STR=":" -DNPSOL_MISSING=1 -DQPSOL_MISSING=1 -DFSQP_MISSING=1 -DHAVE_STRFTIME=1 -DSIZEOF_SHORT=2 -DSIZEOF_INT=4 -DSIZEOF_LONG=4 -DWORDS_BIGENDIAN=1 -DIEEE_BIG_ENDIAN=1 -DHAVE_ALLOCA=1 -DF77_APPEND_UNDERSCORE=1 -DHAVE_ASSERT_H=1 -DHAVE_FLOAT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MEMORY_H=1 -DHAVE_PWD_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_VARARGS_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_UTSNAME_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_FCNTL_H=1 -DHAVE_SYS_RESOURCE_H=1 -DHAVE_DIRENT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TERMIOS_H=1 -DHAVE_SETVBUF=1 -DHAVE_GETCWD=1 -DHAVE_GETHOSTNAME=1 -DHAVE_BZERO=1 -DHAVE_BCOPY=1 -DHAVE_RINDEX=1 -DHAVE_VFPRINTF=1 -DHAVE_VSPRINTF=1 -DHAVE_STRICMP=1 -DHAVE_STRNICMP=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_STRERROR=1 -DHAVE_ATEXIT=1 -DHAVE_TEMPNAM=1 -DHAVE_MEMMOVE=1 -DHAVE_PUTENV=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_GETRUSAGE=1 -DHAVE_LIBM=1 -DHAVE_FINITE=1 -DHAVE_ISNAN=1 -DHAVE_ISINF=1 -DHAVE_ACOSH=1 -DHAVE_ASINH=1 -DHAVE_ATANH=1 -DRETSIGTYPE=void -DSYS_SIGLIST_DECLARED=1 -DHAVE_SYS_SIGLIST=1 "
  28.  
  29. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:$PATH
  30. export PATH
  31.  
  32. TEMP=/tmp/octave-bug.$$
  33.  
  34. : ${EDITOR=emacs}
  35.  
  36. trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
  37. trap 'rm -f $TEMP $TEMP.x' 0
  38.  
  39. UN=
  40. if (uname) > /dev/null 2>&1
  41. then
  42.   UN=`uname -a`
  43. fi
  44.  
  45. HAVE_FMT=false
  46. if (fmt < /dev/null) > /dev/null 2>&1
  47. then
  48.   HAVE_FMT=true
  49. fi
  50.  
  51. ss_p=`echo $VERSION | grep "^ss-"`
  52. if test -n "$ss_p"
  53. then
  54.   BUGADDR="octave-maintainers@che.utexas.edu"
  55. else
  56.   BUGADDR="bug-octave@che.utexas.edu"
  57. fi
  58.  
  59. SUBJECT="[50 character or so descriptive subject here (for reference)]"
  60. if test $# -gt 0
  61. then
  62.   case "$1" in
  63.     -s)
  64.       shift
  65.       if test $# -gt 0
  66.       then
  67.         SUBJECT="$1"
  68.         shift
  69.       else
  70.         echo "usage: octave-bug [-s subject]"
  71.         exit 1
  72.       fi
  73.     ;;
  74.   esac
  75. fi
  76.  
  77. cat > $TEMP << EOF
  78. To: $BUGADDR
  79. Subject: $SUBJECT
  80. --------
  81. Bug report for Octave $VERSION configured for $MACHINE
  82.  
  83. Description:
  84. -----------
  85.  
  86.   * Please replace this item with a detailed description of the
  87.     problem.  Suggestions or general comments are also welcome.
  88.  
  89. Repeat-By:
  90. ---------
  91.  
  92.   * Please replace this item with a description of the sequence of
  93.     events that causes the problem to occur. 
  94.  
  95. Fix:
  96. ---
  97.  
  98.   * If possible, replace this item with a description of how to
  99.     fix the problem (if you don't have a fix for the problem, don't
  100.     include this section, but please do submit your report anyway).
  101.  
  102.  
  103.  
  104. Configuration (please do not edit this section):
  105. -----------------------------------------------
  106.  
  107. uname output:     $UN
  108. Fortran compiler: $F77
  109. FFLAGS:           $FFLAGS
  110. F2C:              $F2C
  111. F2CFLAGS:         $F2CFLAGS
  112. FLIBS:            $FLIBS
  113. C compiler:       $CC
  114. CFLAGS:           $CFLAGS
  115. C++ compiler:     $CXX
  116. CXXFLAGS:         $CXXFLAGS
  117. LDFLAGS:          $LDFLAGS
  118. DEFS:
  119.  
  120. EOF
  121.  
  122. if $HAVE_FMT
  123. then
  124.   echo $DEFS | fmt | sed 's/^/  /' >> $TEMP
  125. else
  126.   echo $DEFS >> $TEMP
  127. fi
  128.  
  129. if test $# -gt 0
  130. then
  131.   if test -f "$1"
  132.   then
  133.     cat >> $TEMP << EOF
  134.  
  135. User-preferences (please do not edit this section):
  136. --------------------------------------------------
  137.  
  138. EOF
  139.     cat $1 >> $TEMP
  140.   fi
  141. fi
  142.  
  143. chmod u+w $TEMP
  144. cp $TEMP $TEMP.x
  145.  
  146. status=0
  147.  
  148. if $EDITOR $TEMP
  149. then
  150.   if cmp -s $TEMP $TEMP.x
  151.   then
  152.     echo "file not changed -- no bug report submitted"
  153.     status=1
  154.   else
  155.  
  156. # Try to extract the recipient address, in case the To: line in the
  157. # message template has been changed.  Also get cc: lines.
  158.  
  159.     TO_ADDR=`sed -e '/^--------[ \t]*$/q' $TEMP | sed -n -e 's/^[Tt][Oo]://p'`
  160.     CC_ADDR=`sed -e '/^--------[ \t]*$/q' $TEMP | sed -n -e 's/^[Cc][Cc]://p'`
  161.  
  162.     if test -z "$TO_ADDR"
  163.     then
  164.       echo "no valid \`To:' field found in header -- using $BUGADDR instead"
  165.     else
  166.       BUGADDR="$TO_ADDR"      
  167.     fi
  168.  
  169.     BUGADDR="$BUGADDR $CC_ADDR"
  170.  
  171. # Delete the `--------' separator in the message.
  172.  
  173. # Don't pretty-print this.  Odd whitespace kills Ultrix AWK!
  174.  
  175.     awk 'BEGIN{in_header=1;} /^--------[ \t]*$/ {
  176.       if (in_header) { in_header=0; print ""; next; }
  177.     } { print $0; }' $TEMP > $TEMP.x
  178.  
  179. # Now try to mail it.
  180.  
  181.     ( /bin/mail $BUGADDR < $TEMP.x ) > /dev/null 2>&1
  182.     status=$?
  183.     if test $status -ne 0; then
  184.       ( Mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
  185.       status=$?
  186.       if test $status -ne 0; then
  187.         ( /usr/ucb/mail -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
  188.         status=$?
  189.         if test $status -ne 0; then
  190.           ( mailx -s "$SUBJECT" $BUGADDR < $TEMP.x ) > /dev/null 2>&1
  191.           status=$?
  192.         fi
  193.       fi
  194.     fi
  195.  
  196.     if test $status -ne 0; then
  197.       echo "unable to send mail -- saving message in \$HOME/dead.octave-bug";
  198.       cat $TEMP >> $HOME/dead.octave-bug;
  199.       exit 1
  200.     else
  201.       echo "bug report sent to: $TO_ADDR"
  202.       echo "             cc to: $CC_ADDR"
  203.     fi
  204.   fi
  205. else
  206.   echo "problems with edit -- no bug report submitted"
  207.   status=1
  208. fi
  209.  
  210. exit $status
  211.