#219 Add support for user-defined prompts

Michael Drueing

I have been using customized (ANSI-) prompts in DOS for years, and I just found out that DOSBox doesn't support prompts other than the good old "$p$g" (i.e. "C:\foo\bar>".

So here's my attempt at a patch which fixes that. I don't remember all DOS substitutions so I instead took the ones that I remembered ($p, $g, $l, $e) and filled it up with those from windows XP.

The patch is pretty self-contained, it only touches one function in shell_misc.cpp and moves one function a bit further up in the file. It works by taking the env.variable PROMPT if it exists and constructs the prompt according to it. If the variable doesn't exist, the old behavior (implicit $p$g prompt) is retained so that it does not affect anybody who doesn't want to customize his prompt.

The only substitution I didn't implement (yet) is $t which stands for the current time. I couldn't find a clean way to get the time from the emulated DOS system, and I wanted to keep the patch minimal (i.e. touching the least files possible) so I left it out for now. Another todo might be to add a "prompt" program which sets the variable, just like DOS has.

I know that this patch is not "gaming-related" but since it is so small and self-contained I hope it can be imported into CVS anyway.



  • a patch to add PROMPT variable support