Rev 4211 | Rev 4232 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4211 | Rev 4226 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <async.h> |
46 | #include <async.h> |
47 | #include <libadt/fifo.h> |
47 | #include <libadt/fifo.h> |
48 | #include <screenbuffer.h> |
48 | #include <screenbuffer.h> |
49 | #include <sys/mman.h> |
49 | #include <sys/mman.h> |
50 | #include <stdio.h> |
50 | #include <stdio.h> |
- | 51 | #include <string.h> |
|
51 | #include <sysinfo.h> |
52 | #include <sysinfo.h> |
52 | #include <event.h> |
53 | #include <event.h> |
53 | 54 | ||
54 | #include "console.h" |
55 | #include "console.h" |
55 | #include "gcons.h" |
56 | #include "gcons.h" |
Line 463... | Line 464... | ||
463 | 464 | ||
464 | /** Handle CONSOLE_WRITE call. */ |
465 | /** Handle CONSOLE_WRITE call. */ |
465 | static void cons_write(int consnum, ipc_callid_t rid, ipc_call_t *request) |
466 | static void cons_write(int consnum, ipc_callid_t rid, ipc_call_t *request) |
466 | { |
467 | { |
467 | ipc_callid_t callid; |
468 | ipc_callid_t callid; |
468 | size_t len; |
469 | size_t size; |
- | 470 | wchar_t ch; |
|
469 | size_t i; |
471 | size_t off; |
470 | 472 | ||
471 | if (!ipc_data_write_receive(&callid, &len)) { |
473 | if (!ipc_data_write_receive(&callid, &size)) { |
472 | ipc_answer_0(callid, EINVAL); |
474 | ipc_answer_0(callid, EINVAL); |
473 | ipc_answer_0(rid, EINVAL); |
475 | ipc_answer_0(rid, EINVAL); |
474 | } |
476 | } |
475 | 477 | ||
476 | if (len > CWRITE_BUF_SIZE) |
478 | if (size > CWRITE_BUF_SIZE) |
477 | len = CWRITE_BUF_SIZE; |
479 | size = CWRITE_BUF_SIZE; |
478 | 480 | ||
479 | (void) ipc_data_write_finalize(callid, cwrite_buf, len); |
481 | (void) ipc_data_write_finalize(callid, cwrite_buf, size); |
480 | 482 | ||
- | 483 | off = 0; |
|
481 | for (i = 0; i < len; i++) { |
484 | while (off < size) { |
- | 485 | ch = str_decode(cwrite_buf, &off, size); |
|
482 | write_char(consnum, cwrite_buf[i]); |
486 | write_char(consnum, ch); |
483 | } |
487 | } |
484 | 488 | ||
485 | gcons_notify_char(consnum); |
489 | gcons_notify_char(consnum); |
486 | ipc_answer_1(rid, EOK, len); |
490 | ipc_answer_1(rid, EOK, size); |
487 | } |
491 | } |
488 | 492 | ||
489 | /** Default thread for new connections */ |
493 | /** Default thread for new connections */ |
490 | static void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
494 | static void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
491 | { |
495 | { |