Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 405 → Rev 402

/svarcom/trunk/command.c
15,6 → 15,11
* installs it by creating a new PSP, set int 22 vector to the routine, set my "parent PSP" to the routine
* and quit.
*
*
*
* good lecture about PSP and allocating memory
* https://retrocomputing.stackexchange.com/questions/20001/how-much-of-the-program-segment-prefix-area-can-be-reused-by-programs-with-impun/20006#20006
*
* PSP structure
* http://www.piclist.com/techref/dos/psps.htm
*
278,14 → 283,14
 
for (;;) {
char far *cmdline = MK_FP(rmod_seg, RMOD_OFFSET_INPBUFF + 2);
unsigned char far *echostatus = MK_FP(rmod_seg, RMOD_OFFSET_ECHOFLAG);
 
if (*echostatus != 0) outputnl(""); /* terminate the previous command with a CR/LF */
/* revert input history terminator to \r */
if (cmdline[-1] != 0) {
cmdline[(unsigned short)(cmdline[-1])] = '\r';
}
 
SKIP_NEWLINE:
 
/* print shell prompt (only if ECHO is enabled) */
if (*echostatus != 0) {
{
/* print shell prompt */
char *promptptr = BUFFER;
buildprompt(promptptr, *rmod_envseg);
_asm {
299,11 → 304,6
}
}
 
/* revert input history terminator to \r */
if (cmdline[-1] != 0) {
cmdline[(unsigned short)(cmdline[-1])] = '\r';
}
 
/* wait for user input */
_asm {
push ax
336,13 → 336,6
int 0x2f
 
DONE:
/* terminate command with a CR/LF */
mov ah, 0x02 /* display character in dl */
mov dl, 0x0d
int 0x21
mov dl, 0x0a
int 0x21
 
pop ds
pop dx
pop cx
349,9 → 342,10
pop bx
pop ax
}
outputnl("");
 
/* if nothing entered, loop again (but without appending an extra CR/LF) */
if (cmdline[-1] == 0) goto SKIP_NEWLINE;
/* if nothing entered, loop again */
if (cmdline[-1] == 0) continue;
 
/* replace \r by a zero terminator */
cmdline[(unsigned char)(cmdline[-1])] = 0;
370,10 → 364,11
 
/* try matching (and executing) an internal command */
{
int ecode = cmd_process(rmod_seg, *rmod_envseg, cmdline, BUFFER);
int ecode = cmd_process(*rmod_envseg, cmdline, BUFFER);
if (ecode >= 0) *lastexitcode = ecode;
if (ecode >= -1) { /* internal command executed */
redir_revert(); /* revert stdout (in case it was redirected) */
outputnl("");
continue;
}
}