*/ DEVICE_CMD Read_IO(REBREQ *req) /* ** Low level "raw" standard input function. ** ** The request buffer must be long enough to hold result. ** ** Result is NOT terminated (the actual field has length.) ** ***********************************************************************/ { long total = 0; int len = req->length; if (GET_FLAG(req->modes, RDM_NULL)) { req->common.data[0] = 0; return DR_DONE; } req->actual = 0; if (Std_Inp >= 0) { interrupted = 0; // Perform a processed read or a raw read? #ifndef HAS_SMART_CONSOLE if (Term_IO) total = Read_Line(Term_IO, s_cast(req->common.data), len); else #endif total = read(Std_Inp, req->common.data, len); /* will be restarted in case of signal */ if (total < 0) { req->error = errno; return DR_ERROR; } if (interrupted) { char noop[] = "does[]\n"; APPEND_BYTES_LIMIT(req->common.data, cb_cast(noop), len); total += sizeof(noop); } req->actual = total; } return DR_DONE; }
// // Read_IO: C // // Low level "raw" standard input function. // // The request buffer must be long enough to hold result. // // Result is NOT terminated (the actual field has length.) // DEVICE_CMD Read_IO(REBREQ *req) { long total = 0; int len = req->length; if (GET_FLAG(req->modes, RDM_NULL)) { req->common.data[0] = 0; return DR_DONE; } req->actual = 0; if (Std_Inp >= 0) { interrupted = 0; // Perform a processed read or a raw read? #ifndef HAS_SMART_CONSOLE if (Term_IO) total = Read_Line(Term_IO, s_cast(req->common.data), len); else #endif total = read(Std_Inp, req->common.data, len); /* will be restarted in case of signal */ if (total < 0) { req->error = errno; return DR_ERROR; } if (interrupted) { char noop[] = "does[]\n"; APPEND_BYTES_LIMIT(req->common.data, cb_cast(noop), len); total += sizeof(noop); } req->actual = total; } return DR_DONE; }