Changeset ff9244a in mainline for uspace/lib/libc/generic/io/io.c


Ignore:
Timestamp:
2007-12-26T22:16:21Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2f02aa17
Parents:
75ae31d
Message:

Move the open(), read() and write() provided by streams.c away so that
these functions won't clash with the real open(), read() and write(), which are
soon to be provided by a libvfs library. Applications can now use open_stdin(),
open_stdout(), read_stdin() and write_stdout(). Later, there might be an option
of providing a custom console file system, which will work similarly to how
streams' open(), read() and write() worked.

File:
1 edited

Legend:

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

    r75ae31d rff9244a  
    4848       
    4949        for (count = 0; str[count] != 0; count++);
    50         if (write(1, (void *) str, count) == count) {
    51                 if (write(1, &nl, 1) == 1)
     50        if (write_stdout((void *) str, count) == count) {
     51                if (write_stdout(&nl, 1) == 1)
    5252                        return 0;
    5353        }
     
    6363int putnchars(const char *buf, size_t count)
    6464{
    65         if (write(1, (void *) buf, count) == count)
    66                         return 0;
     65        if (write_stdout((void *) buf, count) == count)
     66                return 0;
    6767       
    6868        return EOF;
     
    8080
    8181        for (count = 0; str[count] != 0; count++);
    82         if (write(1, (void *) str, count) == count)
    83                         return 0;
     82        if (write_stdout((void *) str, count) == count)
     83                return 0;
    8484       
    8585        return EOF;
     
    8989{
    9090        unsigned char ch = c;
    91         if (write(1, (void *) &ch, 1) == 1)
    92                         return c;
     91        if (write_stdout((void *) &ch, 1) == 1)
     92                return c;
    9393       
    9494        return EOF;
     
    9898{
    9999        unsigned char c;
    100         if (read(0, (void *) &c, 1) == 1)
    101                         return c;
     100        if (read_stdin((void *) &c, 1) == 1)
     101                return c;
    102102       
    103103        return EOF;
Note: See TracChangeset for help on using the changeset viewer.