adam-mcdaniel/oakc

What is the purpose of this if statement in getch?

Closed this issue · 2 comments

if (ch == '\r') {
    ch = getchar();
}

I assume it's to deal with enter inserting \r\n instead of just \n, but I want to make sure that's correct

It's meant to prevent getch from ever returning a '\r' character. I mostly did this for compatibility between *nix and windows.

Got it, thanks!