Expand tabs for int21/ah=2,9 even in raw device modes and if stdout is
redirected. This solves bug 1737 (grep2msg problem) This copy&paste exercise is to be cleaned up a bit later! git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@759 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
828a125aed
commit
b7491eba32
@ -277,7 +277,33 @@ void write_char(int c, int sft_idx)
|
||||
|
||||
void write_char_stdout(int c)
|
||||
{
|
||||
unsigned char scrpos = scr_pos;
|
||||
unsigned char count = 1;
|
||||
unsigned flags = get_sft(STDOUT)->sft_flags & (SFT_FDEVICE | SFT_FBINARY);
|
||||
|
||||
/* ah=2, ah=9 should expand tabs even for raw devices and disk files */
|
||||
if (flags != SFT_FDEVICE)
|
||||
{
|
||||
if (c == CR)
|
||||
scrpos = 0;
|
||||
else if (c == BS) {
|
||||
if (scrpos > 0)
|
||||
scrpos--;
|
||||
} else if (c != LF && c != BELL) {
|
||||
if (c == HT) {
|
||||
count = 8 - (scrpos & 7);
|
||||
c = ' ';
|
||||
}
|
||||
scrpos += count;
|
||||
}
|
||||
/* for raw devices already updated in dosfns.c */
|
||||
if (!(flags & SFT_FDEVICE))
|
||||
scr_pos = scrpos;
|
||||
}
|
||||
|
||||
do {
|
||||
write_char(c, get_sft_idx(STDOUT));
|
||||
} while (--count != 0);
|
||||
}
|
||||
|
||||
#define iscntrl(c) ((unsigned char)(c) < ' ')
|
||||
|
@ -482,14 +482,13 @@ dispatch:
|
||||
/* Display String */
|
||||
case 0x09:
|
||||
{
|
||||
size_t count = 0;
|
||||
char FAR *bp = FP_DS_DX;
|
||||
unsigned char c;
|
||||
unsigned char FAR *bp = FP_DS_DX;
|
||||
|
||||
while (bp[count] != '$')
|
||||
count++;
|
||||
while ((c = *bp++) != '$')
|
||||
write_char_stdout(c);
|
||||
|
||||
DosWrite(STDOUT, count, bp);
|
||||
lr.AL = '$';
|
||||
lr.AL = c;
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user