Subversion Repositories HelenOS

Rev

Rev 2479 | Rev 4239 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2479 Rev 2670
Line 45... Line 45...
45
   
45
   
46
    if (str == NULL)
46
    if (str == NULL)
47
        return putnchars("(NULL)", 6);
47
        return putnchars("(NULL)", 6);
48
   
48
   
49
    for (count = 0; str[count] != 0; count++);
49
    for (count = 0; str[count] != 0; count++);
50
    if (write(1, (void *) str, count) == count) {
50
    if (write_stdout((void *) str, count) == count) {
51
        if (write(1, &nl, 1) == 1)
51
        if (write_stdout(&nl, 1) == 1)
52
            return 0;
52
            return 0;
53
    }
53
    }
54
   
54
   
55
    return EOF;
55
    return EOF;
56
}
56
}
Line 60... Line 60...
60
 * @param count
60
 * @param count
61
 * @return 0 on succes, EOF on fail
61
 * @return 0 on succes, EOF on fail
62
 */
62
 */
63
int putnchars(const char *buf, size_t count)
63
int putnchars(const char *buf, size_t count)
64
{
64
{
65
    if (write(1, (void *) buf, count) == count)
65
    if (write_stdout((void *) buf, count) == count)
66
            return 0;
66
        return 0;
67
   
67
   
68
    return EOF;
68
    return EOF;
69
}
69
}
70
 
70
 
71
/** Same as puts, but does not print newline at end
71
/** Same as puts, but does not print newline at end
Line 77... Line 77...
77
   
77
   
78
    if (str == NULL)
78
    if (str == NULL)
79
        return putnchars("(NULL)", 6);
79
        return putnchars("(NULL)", 6);
80
 
80
 
81
    for (count = 0; str[count] != 0; count++);
81
    for (count = 0; str[count] != 0; count++);
82
    if (write(1, (void *) str, count) == count)
82
    if (write_stdout((void *) str, count) == count)
83
            return 0;
83
        return 0;
84
   
84
   
85
    return EOF;
85
    return EOF;
86
}
86
}
87
 
87
 
88
int putchar(int c)
88
int putchar(int c)
89
{
89
{
90
    unsigned char ch = c;
90
    unsigned char ch = c;
91
    if (write(1, (void *) &ch, 1) == 1)
91
    if (write_stdout((void *) &ch, 1) == 1)
92
            return c;
92
        return c;
93
   
93
   
94
    return EOF;
94
    return EOF;
95
}
95
}
96
 
96
 
97
int getchar(void)
97
int getchar(void)
98
{
98
{
99
    unsigned char c;
99
    unsigned char c;
100
    if (read(0, (void *) &c, 1) == 1)
100
    if (read_stdin((void *) &c, 1) == 1)
101
            return c;
101
        return c;
102
   
102
   
103
    return EOF;
103
    return EOF;
104
}
104
}
105
 
105
 
106
/** @}
106
/** @}