File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -303,16 +303,23 @@ static void tag_prompt()
303303 // can identify console writes that are the prompt.
304304
305305 static const char * name = "prompt" ;
306+ static const char * default_prompt = "$p$g" ;
306307 static const int buffer_size = 0x10000 ;
307308
308309 int tag_size ;
309310 char * buffer ;
311+ char * suffix ;
310312
311313 buffer = malloc (buffer_size );
312314 tag_size = strlen (g_prompt_tag_hidden );
315+ suffix = buffer + tag_size ;
313316
314317 strcpy (buffer , g_prompt_tag_hidden );
315- GetEnvironmentVariableA (name , buffer + tag_size , buffer_size - tag_size );
318+ if (!GetEnvironmentVariableA (name , suffix , buffer_size - tag_size ))
319+ {
320+ SetEnvironmentVariableA (name , default_prompt );
321+ GetEnvironmentVariableA (name , suffix , buffer_size - tag_size );
322+ }
316323 SetEnvironmentVariableA (name , buffer );
317324
318325 free (buffer );
You can’t perform that action at this time.
0 commit comments