Opened 5 years ago

Closed 5 years ago

#302 closed enhancement (wontfix)

setmode() behavior

Reported by: komh 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 5 years ago by bird

  • Resolution set to invalid
  • Status changed from new to closed

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 5 years ago by komh

  • Resolution invalid deleted
  • Status changed from closed to reopened

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 5 years ago by bird

  • Resolution set to wontfix
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.