##############################################################################
# WARNING: THIS FILE IS NOT USED BY DEFAULT. ADJUST dosemu.users OR USE -F.
#
# This file is global.conf. By default a compiled-in copy is used. If you
# make custom changes to the settings in this file, then you need to use 
# the -F switch or change dosemu.users; the custom file is then parsed
# after the built-in copy.
#
# Linux dosemu  configuration  for parser versions >= 3 (dosemu-0.97.0.1)
#
# ./doc/README-tech.txt (chapter 2.) contains a description of the syntax
# and the usage. However, you normally won't edit this file !!
#
# NOTES:
#
# 1. The file dosemu.conf (and optionally ~/.dosemurc) contains variable
#    settings, that are included by global.conf for doing the
#    most reasonable configuration.
#    The file dosemu.conf (and optionally ~/.dosemurc) is what gets
#    updated by the menu driven 'setup-dosemu' tool.
#
# 2. We strongly recommend you to edit ONLY dosemu.conf.
#    If you change global.conf, you are at your own and could break
#    'setup-dosemu'.  You really need to know a lot of DOSEMU
#    internals before you fiddle with editing global.conf.
#    However, some very special cases can only be handled in global.conf.
#    
# 3. The file global.conf (this one) is either
#      - the one compiled into dosemu.bin.
#      - specified by the config_script option in dosemu.users ("builtin" 
#        by default)
#      - or given via the -F option (from root login, else only on
#        non-suid-root DOSEMU)
#
# 4. The only compiled-in path is /etc/dosemu.users (or if not found
#    /etc/dosemu/dosemu.users), however, this can be overridden by
#    --Fusers, if not running suid-root. All other paths are configurable
#    and the dosemu binaries can reside everywhere in the system.
#
# This file (global.conf) may also serve as an example file for
#      .dosrc            ( old style user configuration file )
#      option -I         ( configuration via commandline, see man/dos.1 )
#
# Access rights for suid-root running DOSEMU sessions are defined in
#
#      /etc/dosemu.users or /etc/dosemu/dosemu.users
#
##############################################################################

ifdef u_forceold
  undef parser_version_3
  define version_3_style_used
endif

ifndef parser_version_3
  # normally won't come here, because older DOSEMUs don't use this file
  # ... but if using -F option ...
  include "/etc/dosemu.conf"
else
  # we are on version 3 parser

  ## we set some vital variable

  if (!strlen($DOSEMU_LIB_DIR))
    # be sure, because older DOSEMU won't set this
    $DOSEMU_LIB_DIR = "/var/lib/dosemu";
    $DOSEMU_CONF_DIR = "/etc";
    $DOSEMU_HDIMAGE_DIR = $DOSEMU_LIB_DIR;
  else
    if (!strlen($DOSEMU_HDIMAGE_DIR))
      $DOSEMU_HDIMAGE_DIR = $DOSEMU_LIB_DIR;
    endif
    # make sure we have absolute paths
    shell("test -d ", $DOSEMU_HDIMAGE_DIR)
    if ($DOSEMU_SHELL_RETURN)
      $DOSEMU_HDIMAGE_DIR = /var/lib/dosemu
    else
      $DOSEMU_HDIMAGE_DIR = shell("cd ", $DOSEMU_HDIMAGE_DIR, "; pwd -P");
      $DOSEMU_HDIMAGE_DIR = strdel($DOSEMU_HDIMAGE_DIR, strlen($DOSEMU_HDIMAGE_DIR)-1, 1);
    endif
    shell("test -d ", $DOSEMU_LIB_DIR)
    if ( $DOSEMU_SHELL_RETURN)
      $DOSEMU_LIB_DIR = "/var/lib/dosemu";
    else
      $DOSEMU_LIB_DIR = shell("cd ", $DOSEMU_LIB_DIR, "; pwd -P");
      $DOSEMU_LIB_DIR = strdel($DOSEMU_LIB_DIR, strlen($DOSEMU_LIB_DIR)-1, 1);
    endif
  endif

  $CONFIG_VERSION = ( (1 << 24) | (1 << 16) | (4 << 8) | 0)
  #                    ^           ^           ^         ^
  if ( $DOSEMU_VERSION_CODE < $CONFIG_VERSION )
    abort "
*** sorry, your ", $DOSEMU_LIB_DIR, "/global.conf doesn't match this dosemu version
"
  endif

  $DOSEMU_VERSION = ($DOSEMU_VERSION_CODE >> 24), '.',
                    (($DOSEMU_VERSION_CODE >> 16) & 255), '.',
                    (($DOSEMU_VERSION_CODE >> 8) & 255), '.',
                    ($DOSEMU_VERSION_CODE & 255);

  $LIST_DELIM = " ,	"	#delimiters for lists <tab>, blank, comma

  # for non-suid-root we can switch off restricted checking.
  if (strlen($DOSEMU_LAX_CHECKING))
    undef restricted
    undef guest
  endif

  # we include the global settings from $DOSEMU_CONF_DIR/dosemu.conf
  if (strlen($DOSEMU_CONF_DIR))
    shell("test -f ", $DOSEMU_CONF_DIR, "/dosemu.conf")
    if ( $DOSEMU_SHELL_RETURN)
      $DOSEMU_CONF_DIR = ""
    endif
  endif

  undef version_3_style_used    # unset it to have a valid check below
  if (strlen($DOSEMU_CONF_DIR))
    $xxx = 'include "', $DOSEMU_CONF_DIR, '/dosemu.conf"';
    $$xxx;
    ifndef version_3_style_used
      abort "
*** Your ", $DOSEMU_CONF_DIR, "/dosemu.conf is obviously an old style or a too simple one.
    Please read Quickstart and README.txt on how to upgrade.
"
    endif
  endif

  ## we check if we have an ${HOME}/.dosemurc (given by $DOSEMU_RC),
  ## if yes, we include it here 'under user scope', which means it has
  ## all c_* classes undefined and can only change enviroment variables in
  ## its own isolated name space (prefixed with 'dosemu_').
  ## We later take over only such variables, that we allow.

  $_dosemurc = $DOSEMU_RC         # we get that passed from 'parse_config()'
  shell("test -f ", $_dosemurc)
  if ( (!$DOSEMU_SHELL_RETURN) ) 
    # we have a .dosemurc and can include
    $_dosemurc = ' include "', $_dosemurc, '"';
    if (!strlen($DOSEMU_LAX_CHECKING))
      enter_user_scope;
    endif
    $$_dosemurc;
    if (!strlen($DOSEMU_LAX_CHECKING))
      leave_user_scope;
    endif
    define skip_dosrc;

    ## now we take over the allowed variables, only those which exist
    ## with 'dosemu_' prefixed will overwrite those without the prefix.

    checkuservar $_debug,
      $_features, $_mapping, $_hogthreshold, $_cli_timeout, $_pic_watchdog,
      $_mathco, $_cpu, $_rdtsc, $_cpuspeed, $_xms, $_ems, $_ems_frame,
      $_dpmi, $_pm_dos_api, $_emusys, $_emuini, $_dosmem, $_full_file_locks,
      $_lfn_support
    checkuservar
      $_term_char_set, $_term_color, $_term_updfreq, $_escchar, $_layout,
      $_xterm_title, $_rawkeyboard, $_video, $_console, $_graphics,
      $_external_char_set, $_internal_char_set
    checkuservar
      $_X_updfreq, $_X_title, $_X_title_show_appname, $_X_icon_name,
      $_X_keycode, $_X_blinkrate,
      $_X_font, $_X_mitshm, $_X_sharecmap, $_X_fixed_aspect, $_X_aspect_43,
      $_X_lin_filt, $_X_bilin_filt, $_X_mode13fact, $_X_winsize, $_X_gamma,
      $_X_fullscreen, $_X_vgaemu_memsize, $_X_lfb, $_X_pm_interface, $_X_mgrab_key,
      $_X_vesamode, $_X_background_pause
    checkuservar
      $_hdimage,
      $_com1, $_com2, $_com3, $_com4, $_mouse, $_mouse_dev, $_mouse_flags, $_mouse_baud,
      $_printer, $_printer_timeout, $_printer_command,
      $_ipxsupport, $_netdev, $_novell_hack,
      $_sound, $_sb_base, $_sb_irq, $_sb_dma, $_sb_hdma, $_sb_dsp, $_sb_mixer, $_mpu_base,
      $_sound_driver,
      $_oss_min_frags, $_oss_max_frags, $_oss_stalled_frags, $_oss_do_post, $_oss_min_extra_frags,
      $_joy_device, $_joy_dos_min, $_joy_dos_max, $_joy_granularity, $_joy_latency,
      $_vbootfloppy, $_aspi
    $xxx = $_vnet
    checkuservar $_vnet
    if ($_vnet ne $xxx && $_vnet ne "tap")
      $_vnet = $xxx
    endif
    $xxx = $_pktdriver
    checkuservar $_pktdriver
    if ($_pktdriver ne $xxx && $_pktdriver && $_vnet ne "tap")
      $_pktdriver = $xxx
    endif
    $xxx = $speaker
    checkuservar $_speaker
    if ($speaker ne $xxx && $speaker eq "native")
      $speaker = $xxx
    endif
  endif
  ## end of .dosemurc inclusion

  if (strlen($_mapping)) $xxx = $_mapping else $xxx = "auto" endif
  mappingdriver $xxx;

  if (strlen($_debug))
    debug $_debug ;
  else
    debug { off }
  endif

  cpuspeed $_cpuspeed
  rdtsc $_rdtsc

  dosbanner on
  timer 0
  mathco $_mathco
  $xxx = "cpu ", $_cpu;
  $$xxx
  xms $_xms
  if ($_ems || ($_dpmi && $_pm_dos_api)) ems { ems_size $_ems ems_frame $_ems_frame } else ems off endif
  dpmi $_dpmi
  pm_dos_api $_pm_dos_api
  dosmem $_dosmem

  if ($_emusys ne "") emusys $_emusys endif
  if ($_emuini ne "") emuini $_emuini endif

  ## terminal stuff, we check a lot to insure proper operation

  $BEING_ON = ""
  $USING_X = (0)

  if (strchr($DOSEMU_OPTIONS,"X") >=0)
    $USING_X = (1)
  else
   if ($DOSEMU_STDIN_IS_CONSOLE eq "1")
    $BEING_ON = "console"
   else
    $BEING_ON = ""
    if (strstr("xterm dtterm", $TERM) >= 0)
      $BEING_ON = $BEING_ON, "_xterm"
    else
      if (strstr("linux console", $TERM) < 0)
        # remote side must be some type of real terminal
        $BEING_ON = $BEING_ON, "_terminal"
      else
        # remote side is a Linux console
        $BEING_ON = $BEING_ON, "_console"
      endif
    endif
   endif
  endif

  warn "dosemu running on ", $BEING_ON;

  $xxx = $_term_char_set
  if (!strlen($xxx))
     $xxx = "latin"
     if (strstr($BEING_ON, "_console") >= 0)
       $xxx = "ibm"
     endif
  endif
  charset $$xxx
  terminal { color $_term_color  updatefreq $_term_updfreq  escchar $_escchar }
  xterm_title $_xterm_title
  video { vga }
  if ($_external_char_set ne "")
    charset { external $$_external_char_set }
  endif
  if ($_internal_char_set ne "")
    charset { internal $$_internal_char_set }
  endif

  ## X param settings

  if ( $USING_X || (strchr($DOSEMU_OPTIONS,"L") >0) )
    # running as xdos or DEXE (which may force X later)
    if ($_X_keycode == -1)
      $xxx = "keycode 2"
    else if ($_X_keycode)
      $xxx = "keycode 1"
    else
      $xxx = "keycode 0"
    endif endif
    if ($_X_sharecmap) $xxx = $xxx, " sharecmap" endif
    if ($_X_aspect_43) $xxx = $xxx, " aspect_43" endif
    if ($_X_lin_filt) $xxx = $xxx, " lin_filt"  endif
    if ($_X_bilin_filt) $xxx = $xxx, " bilin_filt" endif
    $xxx = $xxx, " mode13fact ", $_X_mode13fact
    $xxx = $xxx, " gamma ", (int($_X_gamma * 100))
    $xxx = $xxx, " font '", $_X_font, "'"
    if (strlen($_X_winsize))
      $yyy = (strstr($_X_winsize,","))
      $yyy = " winsize (", strdel($_X_winsize,$yyy,999), ") , (",
              strsplit($_X_winsize,$yyy+1,999), ")"
      $xxx = $xxx, " X_winsize '", $yyy, "'"
    endif

    if (strlen($_X_vesamode))
      foreach $yyy (" 	", $X_vesamode)
        $zzz = (strchr($yyy,","))
        $xxx = $xxx, " vesamode (", strdel($yyy,$zzz,999), "),(",
                      strsplit($yyy,$zzz+1,999), ") "
      done
    endif
    $xxx = $xxx, ' mgrab_key "', $_X_mgrab_key, '"'
    warn "x keycode ", $xxx
    X { 
      title $_X_title title_show_appname $_X_title_show_appname      
      icon_name $_X_icon_name
      updatelines 25 updatefreq $_X_updfreq blinkrate $_X_blinkrate
      fixed_aspect $_X_fixed_aspect vgaemu_memsize $_X_vgaemu_memsize
      lfb $_X_lfb  pm_interface $_X_pm_interface mitshm $_X_mitshm
      background_pause $_X_background_pause fullscreen $_X_fullscreen $$xxx
    }
  endif

  # video settings
  if ($BEING_ON eq "console")
    $xxx = $_video
    if ($_console) $xxx = $xxx, " console" endif
    if ($_graphics)
      $xxx = $xxx, " graphics vbios_seg ", $_vbios_seg, " vbios_size ",
	        $_vbios_size, " memsize ", $_vmemsize
    endif
    if (strlen($_chipset)) $yyy = $_chipset else $yyy = "plainvga" endif
    $xxx = $xxx, " chipset ", $yyy
    if ($_vbios_post) $xxx = $xxx, " vbios_post " endif
    if ($_dualmon) $xxx = $xxx, " dualmon" endif
    video { $$xxx }
    ports { device /dev/null $$_console_ports }
    pci $_console_pci
  else
    if ($_dualmon) video {dualmon} endif
  endif

  ## sound settings
  if ($_sound)
    sound_emu { sb_base $_sb_base
	        sb_irq $_sb_irq
		sb_dma $_sb_dma
		sb_hdma $_sb_hdma
	        sb_mixer $_sb_mixer
		sb_dsp $_sb_dsp
		mpu_base $_mpu_base
		sound_driver "oss"
	      }
    oss_options { oss_min_frags $_oss_min_frags
		  oss_max_frags $_oss_max_frags
		  oss_stalled_frags $_oss_stalled_frags
		  oss_do_post $_oss_do_post
		  oss_min_extra_frags $_oss_min_extra_frags
		}
  else
    sound_emu off
  endif

  ## joystick settings
  joystick_emu { joy_device $_joy_device joy_dos_min $_joy_dos_min
	joy_dos_max $_joy_dos_max joy_granularity $_joy_granularity
	joy_latency $_joy_latency }

  ## hacks
  cli_timeout $_cli_timeout
  pic_watchdog $_pic_watchdog

  full_file_locks $_full_file_locks
  lfn_support $_lfn_support

  ## serial
  $xxx = "'", $_ttylocks, "'"
  ttylocks { directory $$xxx namestub LCK.. }
  if (1) # no idea why but we need this...
    foreach $xxx (" ", "1 2 3 4")
      $yyy = "com", $xxx
      $zzz = "$_com", $xxx
      $zzz = "'", $$zzz, "'"
      if ($_mouse_dev eq $yyy)
        serial { mouse com $xxx device $$zzz }
        $_mouse = ""
      else
        if ($$zzz eq 'virtual')
          serial { com $xxx virtual }
        else
          serial { com $xxx device $$zzz }
        endif
      endif
    done
  endif

  ## mouse settings
  if ($_mouse_internal && (strstr($_mouse_dev,"com")<0))
    $xxx = ""
    if ($_mouse_baud)
      $xxx = "baudrate ", $_mouse_baud
    endif
    $xxx = $xxx, " device '", $_mouse_dev, "'"
    mouse { $$_mouse $$_mouse_flags $$xxx internaldriver }
  endif

  hogthreshold $_hogthreshold

  ## keyboard setting
  if ($BEING_ON ne "console") $_rawkeyboard = (off) endif
  if ($_layout eq "auto")
    keyboard { layout auto  rawkeyboard $_rawkeyboard }
  else
    if ( strstr($_layout, "load") <0 )
      # we use the builtin keytables
      if (strlen($_layout)) $yyy = $_layout else $yyy = "us" endif
      keyboard { layout $$yyy  rawkeyboard $_rawkeyboard }
    else
      # we have to load a keytable
      $yyy = ""
      foreach $zzz ($LIST_DELIM, $_layout)
        if ($zzz ne "load")
          $yyy = $zzz
        endif
      done
      if (!strlen($yyy))
        abort "no keytable name in $_layout"
      endif
      shell("test -f ", $DOSEMU_LIB_DIR, "/keymap/", $yyy)
      if ( $DOSEMU_SHELL_RETURN)
        abort "keytable ",$yyy, "not found in ", $DOSEMU_LIB_DIR, "/keymap/*"
	      endif
      $_layout = 'include "keymap/', $yyy, '"' ;
      $$_layout
      keyboard { rawkeyboard $_rawkeyboard }
    endif
  endif

  $_disks = $_hdimage
  dexe { allowdisk }
  if (!strlen($_vbootfloppy))
    bootC                      # default boot mode is 'from C:'
  else
    bootA                      # default boot mode is 'from A:'
    $yyy = ""; $zzz = "";
    if (strlen($_vbootfloppy))
      foreach $xxx ($LIST_DELIM, $_vbootfloppy)
        if (strlen($yyy))
          $zzz = $xxx
        else
          $yyy = $xxx
        endif
      done
    endif
    if (strchr($yyy, "/") != 0)
      $yyyy = $HOME, "/.dosemu/", $yyy
      shell("test -f '", $yyyy, "'")
      if ($DOSEMU_SHELL_RETURN)
        $yyyy = $DOSEMU_CONF_DIR, "/", $yyy
      endif
      shell("test -f '", $yyyy, "'")
      if ($DOSEMU_SHELL_RETURN)
        $yyyy = $DOSEMU_HDIMAGE_DIR, "/", $yyy
      endif
      $yyy = $yyyy
    endif
    $_vbootfloppy = $yyy
    bootdisk { heads 2  sectors 18  tracks 80 threeinch  file $_vbootfloppy }
    if (strlen($zzz))
      $_disks = $_hdimage
    endif
  endif
  if (strlen($_floppy_a))
    $zzz = strsplit($_floppy_a, strstr($_floppy_a, ":"), 999);
    if (strlen($zzz))
      $zzz = strsplit($zzz, 1, 999)
      $_floppy_a = strdel($_floppy_a, strstr($_floppy_a, ":"), 999);
    else
      $zzz = "/dev/fd0"
    endif
    $xxx = shell("test -r ", $zzz);
    if ($DOSEMU_SHELL_RETURN)
      warn "**** Warning: floppy ", $zzz, " not accessable, disabled";
    else
      floppy { device $$zzz $$_floppy_a }
    endif
  endif
  if (strlen($_floppy_b))
    $zzz = strsplit($_floppy_b, strstr($_floppy_b, ":"), 999);
    if (strlen($zzz))
      $zzz = strsplit($zzz, 1, 999)
      $_floppy_b = strdel($_floppy_b, strstr($_floppy_b, ":"), 999);
    else
      $zzz = "/dev/fd1"
    endif
    $xxx = shell("test -r ", $zzz);
    if ($DOSEMU_SHELL_RETURN)
      warn "**** Warning: floppy ", $zzz, " not accessable, disabled";
    else
      floppy { device $$zzz $$_floppy_b }
    endif
  endif
  fastfloppy 1

  ipxsupport $_ipxsupport
  novell_hack $_novell_hack
  if (!strlen($_printer))
    printer { options "''" command $_printer_command timeout $_printer_timeout }
  else
    foreach $xxx ($LIST_DELIM, $_printer)
      $xxx = "'-P", $xxx, "'";
      printer { options $$xxx  command $_printer_command timeout $_printer_timeout }
    done
  endif

  if (strlen($_speaker))
    $xxx = "speaker ", $_speaker;
    $$xxx
  else
    speaker off
  endif
  ifdef restricted
    ## /etc/dosemu.users defined 'restricted' for this login
    define c_normal
    undef c_all
    if ($_vnet eq "tap" || !$_pktdriver)
      vnet $_vnet
      pktdriver $_pktdriver
    endif
  else
    # here are the root requiring options
    if (strlen($_irqpassing))
      $yyy = "irqpassing { "
      if (strlen($_irqpassing))
        foreach $xxx (" ", $_irqpassing)
          $yyy = $yyy, "use_sigio ", $xxx
        done
      endif
      $yyy = $yyy, " }";
      $$yyy
    else
      irqpassing off
    endif
    if (strlen($_hardware_ram))
      hardware_ram { $$_hardware_ram }
    endif
    netdev $_netdev
    vnet $_vnet
    pktdriver $_pktdriver
    if (strlen($_ports)) ports { $$_ports } endif
    if ($BEING_ON ne "console" || $_pci)
      pci $_pci
    endif
  endif

  ## setting up hdimages
  $_mounted_devices = ""
  if (strlen($_disks) && (!defined(c_dexerun)))
    $yyy = strsplit($_disks, 0, strpbrk($_disks, $LIST_DELIM) + 1)
    if (strlen($_disks))
     foreach $xxxx ($LIST_DELIM, $_disks)
      $xxx_pref = ""
      if ((strchr($xxxx, "*") + 1) && (strlen($xxxx) == strchr($xxxx, "*") + 1))
        $xxx_pref = strdel($xxxx, strlen($xxxx) - 1, 1);
        if (strchr($xxx_pref, "/") == 0)
          $xxxx = shell("cd '", $xxx_pref, "' 2>/dev/null && echo -n *")
        else
          $xxxx = shell("cd '", $HOME, "/.dosemu/", $xxx_pref, "' 2>/dev/null && echo -n *")
          if ($DOSEMU_SHELL_RETURN || $xxxx eq "*")
            $xxxx = shell("cd '", $DOSEMU_CONF_DIR, "/", $xxx_pref, "' 2>/dev/null && echo -n *")
          endif
          if ($DOSEMU_SHELL_RETURN || $xxxx eq "*")
            $xxxx = shell("cd '", $DOSEMU_HDIMAGE_DIR, "/", $xxx_pref, "' 2>/dev/null && echo -n *")
          endif
        endif
        if ($DOSEMU_SHELL_RETURN)
          $xxxx = strcat($xxx_pref, "*")
          $xxx_pref = ""
        endif
      endif
     if (strlen($xxxx))
     foreach $xxx ($LIST_DELIM, $xxxx)
      $xxx = strcat($xxx_pref, $xxx)
      if (!strncmp($xxx, "/dev/", 4))
        if (!strlen($_mounted_devices))
            # we first get all mounted devices
          $_mounted_devices = shell(" df | awk '/\dev\//{print $1}' | tr '\n' ' '");
            # we try to get the swap device too
          $_mounted_devices = $_mounted_devices, shell("awk '!/^\#/ && /\/dev/ && /swap/{print $1}' /etc/fstab | tr '\n' ' '");
        endif
        $yyy = strdel($xxx, strstr($xxx, ":ro"), 999);
        $zzz = strsplit($xxx, strstr($xxx, ":ro"), 999);
        $yyyy = strcat($yyy, ' ');
        if (strstr($_mounted_devices, $yyyy) <0)
            # device not in use
          if (strlen($zzz))
            disk { partition $yyy readonly };
          else
            disk { partition $yyy };
          endif
        else
          abort "
*** device ", $yyy, " in use, cannot do partition access
"
        endif
      else
        $yyy = strdel($xxx, strstr($xxx, ":ro"), 999);
        $zzz = strsplit($xxx, strstr($xxx, ":ro"), 999);
        if (strchr($yyy, "/") != 0)
          $yyyy = $HOME, "/.dosemu/", $yyy
          shell("test -e '", $yyyy, "'")
          if ($DOSEMU_SHELL_RETURN)
            $yyyy = $DOSEMU_CONF_DIR, "/", $yyy
	  endif
          shell("test -e '", $yyyy, "'")
          if ($DOSEMU_SHELL_RETURN)
            $yyyy = $DOSEMU_HDIMAGE_DIR, "/", $yyy
	  endif
	  $yyy = $yyyy
        endif
        shell("test -d '", $yyy, "'")
        if (!$DOSEMU_SHELL_RETURN)
          if (strlen($zzz))
            disk { directory $yyy readonly };
          else
            disk { directory $yyy };
          endif
        else
          disk { image $yyy }
        endif
      endif
     done
     endif
    done
   endif
  endif

  ## setting up ASPI devices
  ifndef restricted
    if (strlen($_aspi))
      foreach $xxx ($LIST_DELIM, $_aspi)
        $zz = (1);
        $yy2 = ""; $yy3 = (-1);
        if(strlen($xxx))
         foreach $yyy (":", $xxx)
          $zzz = "$yy", $zz, " = $yyy";
          $zz = ($zz + 1);
          $$zzz
         done;
        endif;
        aspi { $yy1 devicetype $yy2 target $yy3 };
      done
    endif
  endif

  ## setting up the features list
  if ( (  ($DOSEMU_VERSION_CODE >= ((98 << 16) | (3 << 8) | 3))
             && ($DOSEMU_VERSION_CODE < (99 << 16)) )
       || ($DOSEMU_VERSION_CODE > ((99 << 16) | (5 << 8))) )
    if (strlen($_features))
      foreach $xxx ($LIST_DELIM, $_features)
        $yyy = strdel($xxx, strstr($xxx, ":"), 999);
        $zzz = strsplit($xxx, strstr($xxx, ":"), 999);
        if (strlen($zzz))
          $zzz = strsplit($zzz, 1, 999);
        else
          $zzz = (0);
        endif
        feature { $yyy = $zzz };
      done
    endif
  endif

endif
#############################################################################
