<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version rmj.rmm.rup.rpr">
<TITLE>stdout and putchar() behavior in musl</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Hi,</FONT></SPAN><SPAN LANG="en-us"><BR>
</SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">Did anyone observed stdout and putchar() behavior differences between musl & uClibc?</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">I have below code snippet :</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">int main(void){</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"> <FONT FACE="Calibri">int c;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"> <FONT FACE="Calibri">while((c=getchar())!= 'e') {</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"> <FONT FACE="Calibri">putchar(c+1);</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"> <FONT FACE="Calibri">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"> <FONT FACE="Calibri">return 0;</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">}</FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">When I use uClibc/gcc, I can see writing c+1 from putchar() happening immediately. But when I use musl, character(c+1) gets printed on console only if I exit from the program by entering 'e'. </FONT></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"><FONT FACE="Calibri">I guess printing character using putchar family on stdi</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">o</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"> is having bug(or</FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">different</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri"></FONT></SPAN><SPAN LANG="en-us"> <FONT FACE="Calibri">implementation</FONT></SPAN><SPAN LANG="en-us"><FONT FACE="Calibri">) in musl. Has anybody faced this issue? Any workaround?</FONT></SPAN><SPAN LANG="en-us"></SPAN></P>
<P DIR=LTR><SPAN LANG="en-us"></SPAN></P>
</BODY>
</HTML>