Changeset 4e2cf8b in mainline for libc/generic/io/io.c


Ignore:
Timestamp:
2006-03-14T12:14:43Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4ba1db5
Parents:
df50cf6
Message:

Userspace printf, stdarg, and some other printf support.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • libc/generic/io/io.c

    rdf50cf6 r4e2cf8b  
    3030#include <unistd.h>
    3131#include <stdio.h>
     32#include <io/io.h>
    3233
    3334static char nl = '\n';
     
    4647}
    4748
     49/** Put count chars from buffer to stdout without adding newline
     50 * @param buf Buffer with size at least count bytes
     51 * @param count
     52 * @return 0 on succes, EOF on fail
     53 */
     54int putnchars(const char * buf, size_t count)
     55{
     56        if (write(1, (void * ) buf, count) == count) {
     57                        return 0;
     58        }
     59       
     60        return EOF;
     61}
     62
     63/** Same as puts, but does not print newline at end
     64 *
     65 */
     66int putstr(const char * str)
     67{
     68        size_t count;
     69       
     70        for (count = 0; str[count] != 0; count++);
     71        if (write(1, (void * ) str, count) == count) {
     72                        return 0;
     73        }
     74       
     75        return EOF;
     76}
     77
    4878ssize_t write(int fd, const void * buf, size_t count)
    4979{
    5080        return (ssize_t) __SYSCALL3(SYS_IO, (sysarg_t) fd, (sysarg_t) buf, (sysarg_t) count);
    5181}
     82
     83
Note: See TracChangeset for help on using the changeset viewer.