-Add support for returning the amount of characters that would have been written if the buffer was large enough. -Protect code against NULL dereference. Change-Id: Ifb2041f4757e8a99f255d94768ba19621bc0ea16 http://gerrit.minix3.org/#/c/2560/