#!/bin/sh
if [ "$ANSI" = "Y" ]; then
  echo "[1;32;40mYou are currently in `pwd`.[0;37;40m"
  echo -n "[1;33;40mChange to: [0;37;40m"
 else
  echo "You are currently in `pwd`."
  echo -n "Change to: "
fi
read CHDIRCMD
if [ $CHDIRCMD ]; then
  cd $CHDIRCMD
  if [ "$INHOME" = "1" ]; then
    export FTPDIR=`pwd`
  fi
  if [ "$INHOME" = "2" ]; then
    export WWWDIR=`pwd`
  fi
  if [ "$INHOME" = "3" ]; then
    export FILEDIR=`pwd`
    fi
 else
  if [ "$CHDIRCMD" = "" ]; then
    if [ "$INHOME" = "1" ]; then
      FTPDIR=$FTPHOME
      cd $FTPDIR
      export FTPDIR
    fi
    if [ "$INHOME" = "2" ]; then
      WWWDIR=$WWWHOME
      cd $WWWDIR
      export WWWDIR
    fi
    if [ "$INHOME" = "3" ]; then
      FILEDIR=$FILEHOME
      cd $FILEDIR
      export FILEDIR
    fi
   else
    if [ "$ANSI" = "Y" ]; then
      echo "[1;32;40mDirectory \"$CHDIRCMD\" not found![0;37;40m"
     else
      echo "Directory \"$CHDIRCMD\" not found!"
    fi
  fi
fi
CURRENTDIR=`pwd`
if [ "$ANSI" = "Y" ]; then
  echo "[1;32;40mYou are now in \"$CURRENTDIR\".[0;37;40m"
  echo "[1;32;40mPress <ENTER> to continue.[0;37;40m"
 else
  echo "You are now in \"$CURRENTDIR\"."
  echo "Press <ENTER> to continue."
fi
read word

exec $BBSEXEC $BBSFILE