#--------shell begin here------- save as winclk.sh
#! /bin/sh
# TOP-LEVEL script for translating winclk.exe from uuencoded form
filePart=1
missingFiles=""
until [ ${filePart} -eq 10 ]
do
  partStr="${filePart}"
  test -f winclk${partStr}
  fileErr=$?
  if [ $fileErr -eq 0 ]
  then
    awk " \
        /shell begin here/ { print_next = 1; } \
        /shell end here/ { print_mode = 0; } \
        { \
          if ( print_mode ) { \
            print; \
          } \
          if ( print_next ) { \
            print_mode = 1; \
            print_next = 0; \
          } \
        } \
        " winclk${partStr} > winclk${partStr}.sh
    test -f winclk${partStr}.sh
    exErr=0
    fileErr=$?
    if [ $fileErr -eq 0 ]
    then
      chmod +x winclk${partStr}.sh
      ./winclk${partStr}.sh
      result=$?
      if [ $result -eq 0 ]
      then
        rm -f winclk${partStr}.sh winclk${partStr}
      else
        if [ $result -eq 7 ]
        then
          rm -f winclk${partStr}.sh winclk${partStr}
          missingFiles=""
          break
        else
          if [ $result -eq 6 ]
          then
            exit 1
          else
            echo "Error in execution of winclk${partStr}.sh - continuing..."
            exErr=$result
          fi
        fi
      fi
    else
      echo "WARNING: File winclk${partStr}.sh doesn't exist!! - continuing..."
      test -f wincl=${partStr}.xb
      exErr=$?
    fi
  else
    echo "WARNING: File winclk${partStr} doesn't exist!! - continuing..."
    test -f wincl=${partStr}.xb
    exErr=$?
  fi
  if [ $exErr -ne 0 ]
  then
    if [ "$missingFiles" = "" ]
    then
      missingFiles="wincl=${partStr}.xb"
    else
      missingFiles="$missingFiles wincl=${partStr}.xb"
    fi
  fi
  filePart=`expr $filePart + 1`
done
if [ "$missingFiles" = "" ]
then
  exit 0
else
  echo "Cannot continue without file(s) ${missingFiles}..."
  exit 1
fi
#--------shell end here------- save as winclk.sh
