Kernel BUG: Single chars are printed to STDIN (not STDOUT)

Eric Auer <[email protected]> Mon, 11 Nov 2002 05:51:06 +0100 (MET)
Newsgroups gmane.os.freedos.devel
Message-ID <[email protected]>
Hi, while working on LBAcache, I found a kernel BUG.

      /* Display String                                               */
    case 0x09:
...
        DosWrite(STDOUT, count, bp);
...
      break;


So far so good, BUT I need INT 21.2 and INT 21.6 to be
redirectable, too! Otherwise I could only redirect strings,
not single characters. For now, if you do:

LBACACHE something > lbacache.log

then lbacache.log will contain the description but the numbers
will be on the screen. Sigh.

Current implementation in INTHNDLR.C is:

      /* Direct Console I/O                                            */
    case 0x06:
      if (lr.DL != 0xff)
        write_char_stdin(lr.DL);
...

      /* Display Character                                            */
    case 0x02:
      write_char_stdin(lr.DL);
      break;

Which in CHARIO.C turns out to be:

void write_char_stdin(int c)
{
  write_char(c, get_sft_idx(STDIN));
}

Which is obviously NOT the file handle I want to write to :-(.

I think you have introduced the stdin/stdout splitting at some
point in the past and forgotten to adjust write_char_stdin
(which should be called write_char_stdout).

Eric