Subversion Repositories SvarDOS

Rev

Rev 369 | Rev 372 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 369 Rev 370
Line 79... Line 79...
79
    }
79
    }
80
  }
80
  }
81
}
81
}
82
 
82
 
83
 
83
 
84
static void buildprompt(char *s, const char *fmt) {
84
static void buildprompt(char *s, unsigned short envseg) {
-
 
85
  /* locate the prompt variable or use the default pattern */
-
 
86
  const char far *fmt = env_lookup(envseg, "PROMPT");
-
 
87
  while ((fmt != NULL) && (*fmt != 0)) {
-
 
88
    fmt++;
-
 
89
    if (fmt[-1] == '=') break;
-
 
90
  }
-
 
91
  if ((fmt == NULL) || (*fmt == 0)) fmt = "$p$g"; /* fallback to default if empty */
-
 
92
  /* build the prompt string based on pattern */
85
  for (; *fmt != 0; fmt++) {
93
  for (; *fmt != 0; fmt++) {
86
    if (*fmt != '$') {
94
    if (*fmt != '$') {
87
      *s = *fmt;
95
      *s = *fmt;
88
      s++;
96
      s++;
89
      continue;
97
      continue;
Line 281... Line 289...
281
 
289
 
282
    {
290
    {
283
      /* print shell prompt */
291
      /* print shell prompt */
284
      char buff[256];
292
      char buff[256];
285
      char *promptptr = buff;
293
      char *promptptr = buff;
286
      buildprompt(promptptr, "$p$g"); /* TODO: prompt should be configurable via environment */
294
      buildprompt(promptptr, *rmod_envseg);
287
      _asm {
295
      _asm {
288
        push ax
296
        push ax
289
        push dx
297
        push dx
290
        mov ah, 0x09
298
        mov ah, 0x09
291
        mov dx, promptptr
299
        mov dx, promptptr