# Utility functions

aurora_direct ()
{
 if /etc/aurora/Monitor query ; then
  if ! [ -x /usr/bin/chvt ]; then
   echo "---{ You have been dumped in an interactive program. To continue, press ALT+F1 }---"
  fi
  exec 6<&0
  exec 0<&3
  exec 3<&6

  exec 6>&1
  exec 1>&4
  exec 4>&6

  exec 6>&2
  exec 2>&5
  exec 5>&6
  if [ -x /usr/bin/chvt ]; then
   chvt 1
  fi
  export AURORA_DIRECT=yes
 fi
}


# Some abstractions for the Aurora command interface

aurora_cmd ()
 {
  echo "command"
 }

aurora_end ()
 {
  if [ "$AURORA_DIRECT" = "yes" ] ; then
   if ! [ -x /usr/bin/chvt ]; then
    echo
    echo "---{ To continue, press ALT+F11 }---"
    echo
   fi
   exec 6<&0
   exec 0<&3
   exec 3<&6

   exec 6>&1
   exec 1>&4
   exec 4>&6

   exec 6>&2
   exec 2>&5
   exec 5>&6
   if [ -x /usr/bin/chvt ]; then
    chvt 11
   fi
   unset AURORA_DIRECT
  else
   echo "end"
  fi
 }

aurora_set_confirm ()
 {
  echo "set confirm"
  echo "$1"
 }

aurora_set_runlevel ()
 {
  echo "set runlevel"
  echo "$1"
 }

aurora_set_missionsize ()
 {
  echo "set missionsize"
  echo "$1"
 }

aurora_set_completion_ok ()
 {
  echo "set completion ok"
  echo "$1"
 }

aurora_set_completion_passed ()
 {
  echo "set completion passed"
  echo "$1"
 }

aurora_set_completion_failed ()
 {
  echo "set completion failed"
  echo "$1"
 }

aurora_set_pixmap_logo_normal ()
 {
  echo "set pixmap logo normal"
  echo "$1"
 }

aurora_set_pixmap_logo_excuse ()
 {
  echo "set pixmap logo excuse"
  echo "$1"
 }

aurora_set_pixmap_completion_ok ()
 {
  echo "set pixmap completion ok"
  echo "$1"
 }

aurora_set_pixmap_completion_passed ()
 {
  echo "set pixmap completion passed"
  echo "$1"
 }

aurora_set_pixmap_completion_failed ()
 {
  echo "set pixmap completion failed"
  echo "$1"
 }

aurora_set_path_icons ()
 {
  echo "set path icons"
  echo "$1"
 }

aurora_set_dialog_title ()
 {
  echo "set dialog title"
  echo "$1"
 }

aurora_set_text_runlevel ()
 {
  echo "set text runlevel"
  echo "$1"
 }

aurora_set_text_confirm ()
 {
  echo "set text confirm"
 }

aurora_set_text_current_state ()
 {
  echo "set text current-state"
 }

aurora_set_text_change_state ()
 {
  echo "set text change-state"
 }

aurora_set_text_options ()
 {
  echo "set text options"
 }

aurora_set_text_clear ()
 {
  echo "set text clear"
 }

aurora_set_text_progress ()
 {
  echo "set text progress"
 }

aurora_get_name ()
 {
  echo "get name"
  read $1
 }

aurora_get_confirm ()
 {
  echo "get confirm"
  read $1
 }

aurora_create_dialog ()
 {
  echo "create dialog"
  echo "$1"
 }

aurora_create_dialog_title ()
 {
  :
 }

aurora_create_dialog_button ()
 {
  echo "$1"
 }

aurora_show_dialog ()
 {
  echo "show dialog"
  echo "$1"
 }

aurora_reset_dialog ()
 {
  echo "reset dialog"
  echo "$1"
 }


# Compound commands
# These are commands consisting of several Aurora commands

aurora_set_completion ()
 {
  aurora_set_completion_ok "$1"
  aurora_set_completion_passed "$2"
  aurora_set_completion_failed "$3"
 }
