home *** CD-ROM | disk | FTP | other *** search
/ HTML - Publishing on the Internet / html_cdrom.iso / tools / html / windows / check / htmlchek.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-02-19  |  2KB  |  63 lines

  1. #!/bin/sh
  2. #
  3. # Shell script to run htmlchek.awk under the best available awk interpreter,
  4. # and avoid problems of invoking old awk, if possible.  Also does options
  5. # checking.
  6. #
  7. case `type gawk` in *gawk ) awkntrp='gawk';;
  8.                         * ) case `type nawk` in *nawk ) awkntrp='nawk';;
  9.                                                     * ) awkntrp='awk';;
  10.                             esac;;
  11. esac
  12. #
  13. nonvar='NO'
  14. for px
  15. do
  16.  case $px
  17.  in -v ) ;;
  18.     -?* ) echo "You are passing flags to the $awkntrp interpreter in argument $px" >&2
  19.           echo "(This may not be what you intended)" >&2 ;;
  20.     *=* ) if   test $nonvar = 'YES'
  21.           then echo "Error: An option=value argument $px followed" >&2
  22.                echo "a filename argument on the command line." >&2
  23.                exit 1
  24.           else
  25.             case $px
  26.             in append=* | arena=* | configfile=* | deprecated=* |\
  27.                dirprefix=* | dlstrict=* | html3=* | htmlplus=* | loosepair=* |\
  28.                lowlevelnonpair=* | lowlevelpair=* | map=* | metachar=* |\
  29.                netscape=* | nogtwarn=* | nonblock=* | nonpair=* |\
  30.                nonrecurpair=* | novalopts=* | nowswarn=* | refsfile=* |\
  31.                reqopts=* | strictpair=* | subtract=* | sugar=* | tagopts=* |\
  32.                usebase=* | xref=* | cf=* | inline=* | lf=* | listfile=* ) ;;
  33.              * ) echo "Error: In the option=value argument $px, the part" >&2
  34.                  echo "before the equals sign \`=' is not a recognized option." >&2
  35.                  exit 1;;
  36.             esac
  37.           fi;;
  38.       * ) nonvar='YES';;
  39.  esac
  40. done
  41. #
  42. case ${HTMLCHEK:-"/"}
  43.     in */ ) ;;
  44.        * ) HTMLCHEK="$HTMLCHEK/";;
  45. esac
  46. if test -s ${HTMLCHEK}htmlchek.awk
  47. then
  48.     echo "Checking file(s) now... (using $awkntrp)" >&2
  49.     $awkntrp -f ${HTMLCHEK}htmlchek.awk $@
  50.     if test $? -ne 0
  51.     then echo "Note: there was apparently an error in running $awkntrp" >&2
  52.          echo "There may be an appropriate errormessage at the end of the STDOUT output" >&2
  53.          exit 1
  54.     fi
  55. else
  56.     echo "htmlchek.awk is not found.  Either copy it to the current directory, or
  57. set the environment variable HTMLCHEK to the pathname where it is located.
  58. Do \`setenv HTMLCHEK /somedir/' in csh and tcsh, \`HTMLCHEK=/somedir/;
  59. export HTMLCHEK' in sh and its offspring." >&2
  60.     exit 1
  61. fi
  62. exit 0
  63.