12. Running a DOS-application directly from Unix shell

This part of the document was written by Hans <lermen@fgan.de>.

12.1. Using the keystroke and commandline options.

Make use of the keystroke configure option and the -I commandline option of DOSEMU (>=dosemu-0.66.2) such as

    dosemu.bin -D-a -I 'keystroke "dir > C:\\garbage\rexitemu\r"'

The "..." will be 'typed in' by dosemu exactly as if you had them typed at the keyboard. The advantage of this technique is, that all DOS applications will accept them, even interactive ones. A '\' is interpreted as in C and leads in ESC-codes. Here a list of of the current implemented ones:

    \r     Carriage return == <ENTER>
    \n     LF
    \t     tab
    \b     backspace
    \f     formfeed
    \a     bell
    \v     vertical tab
    \^x    <Ctrl>x, where X is one of the usual C,M,L,[ ...
           (e.g.: \^[ == <Ctrl>[ == ESC )
    \Ax    <Alt>x, hence  \Ad means <Alt>d
    \Fn;   Function key Fn. Note that the trailing ';' is needed.
           (e.g.:  \F10;  == F10 )
    \Pn;   Set the virtual typematic rate, thats the speed for
           autotyping in. It is given in unix timer ticks to wait
           between two strokes. A value of 7 for example leads to
           a rate of 100/7=14 cps.
    \pn;   Before typing the next stroke wait n unix ticks.
           This is useful, when the DOS-application flushes the
           keyboard buffer on startup. Your strokes would be discarded,
           if you don't wait.

When using X, the keystroke feature can be used to directly fire up a DOS application with one click, if you have the right entry in your .fvwmrc

12.2. Using an input file

I tested this with dosemu-0.64.4/Linux-2.0.28 and it works fine.

When your dos-app does only normal printout (text), then you may even do this

       # dosemu.bin -D-a 2>/dev/null <FILE >FILE.out

FILE.out then contains the output from the dos-app, but merged with ESC-sequences from Slang.

You may elaborate this technique by writing a script, which gets the dos-command to execute from the commandline and generate 'FILE' for you.

12.3. Running DOSEMU within a cron job

When you try to use one of the above to start dosemu out of a crontab, then you have to asure, that the process has a proper environement set up ( especially the TERM and/or TERMCAP variable ).

Normally cron would setup TERM=dumb, this is fine because DOSEMU recognizes it and internally sets it's own TERMCAP entry and TERM to `dosemu-none'. You may also configure your video to
       # dosemu.bin ... -I 'video { none }'
or have a TERM=none to force the same setting. If you use the wrapper script, there is save way to do the same:
       # dosemu -dumb
In all other crontab run cases you may get nasty error messages either from DOSEMU or from Slang.