[comp.os.minix] putchar in MINIX 1.2 and 1.3

usenet@cps3xx.UUCP (Usenet file owner) (04/14/89)

I am using MINIX to teach the OS course.
I am having a problem with the 'putchar()' in the c-compiler of v1.3
(The same problem exists in v1.2). Here is a code segment

#include <stdio.h>

main()
{
 int c;

 while ((c = getchar()) != '\n') putchar(c);
 getchar();
}

the execution of the above code:

 12345<cr>
 q<cr>          !! buffer not flushed before second getchar()
 12345$

The Unix version of the above is:

 12345<cr>
 12345q$    !! buffer flushed before second getchar()

It seems that there is problem with flushing of the buffer. Is there a
way out without redefining 'putchar()' in term of 'printf()' in
include/stdio.h ? Does it require changes to fputc.c in library
sources? The problem seems to be bugging the students and hence, help
will be greatly appreciated.

- ishwar rattan (rattan@frith.egr.msu.edu)