status_t console_init(void) { sInput.SetHandle(DEV_CONSOLE); sOutput.SetHandle(DEV_CONSOLE); // now that we're initialized, enable stdio functionality stdin = (FILE *)&sInput; stdout = stderr = (FILE *)&sOutput; return B_OK; }
status_t console_init(void) { int input, output; if (of_getprop(gChosen, "stdin", &input, sizeof(int)) == OF_FAILED) return B_ERROR; if (of_getprop(gChosen, "stdout", &output, sizeof(int)) == OF_FAILED) return B_ERROR; sInput.SetHandle(input); sOutput.SetHandle(output); // now that we're initialized, enable stdio functionality stdin = (FILE *)&sInput; stdout = stderr = (FILE *)&sOutput; return B_OK; }