Opened 6 years ago

Closed 6 years ago

#302 closed enhancement (wontfix)

setmode() behavior

Reported by: KO Myung-Hun Owned by:
Priority: low Milestone: libc-0.7
Component: libc Version: 0.6.5
Severity: minor Keywords:



setmode() works on every file handles, unconditionally. But it would be better to set the handles to text mode if they are consoles.

And, I think, setting consoles to binary mode is meaningless.

In practice, MinGW beahves like this.

Change History (3)

comment:1 Changed 6 years ago by bird

Resolution: invalid
Status: newclosed

What on earth are you babbling about here? setmode() in trunk/libc/src/libc/io/pc_setmode.c works on individual file handles.

comment:2 Changed 6 years ago by KO Myung-Hun

Resolution: invalid
Status: closedreopened

What I meant is simple. Check if a file handle is for a console before setting its mode. If a console, do not set to binary mode(O_BINARY). Set to O_TEXT always. That is, I want for kLIBC to include the equivalent codes to the following,

#define setmode(h, m) (setmode)(h, isatty(h) ? O_TEXT : ( m ))

comment:3 Changed 6 years ago by bird

Resolution: wontfix
Status: reopenedclosed
Note: See TracTickets for help on using tickets.