Rev 8624 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8624 | Rev 8628 | ||
---|---|---|---|
1 | #include |
1 | #include |
2 | #include |
2 | #include |
3 | #include |
3 | #include |
4 | 4 | ||
5 | int fputc(int c, FILE *stream) |
5 | int fputc(int c, FILE *stream) |
6 | { |
6 | { |
7 | unsigned bytes_written; |
7 | unsigned bytes_written; |
8 | 8 | ||
9 | unsigned status = _ksys_file_write_file(stream->name, stream->position, 1, &c, &bytes_written); |
9 | unsigned status = _ksys_file_write_file(stream->name, stream->position, 1, &c, &bytes_written); |
10 | 10 | ||
11 | if (status != _KOS_FS_ERR_SUCCESS) { |
11 | if (status != KSYS_FS_ERR_SUCCESS) { |
12 | switch (status) { |
12 | switch (status) { |
13 | case _KOS_FS_ERR_1: |
13 | case KSYS_FS_ERR_1: |
14 | case _KOS_FS_ERR_2: |
14 | case KSYS_FS_ERR_2: |
15 | case _KOS_FS_ERR_3: |
15 | case KSYS_FS_ERR_3: |
16 | case _KOS_FS_ERR_4: |
16 | case KSYS_FS_ERR_4: |
17 | case _KOS_FS_ERR_5: |
17 | case KSYS_FS_ERR_5: |
18 | case _KOS_FS_ERR_EOF: |
18 | case KSYS_FS_ERR_EOF: |
19 | case _KOS_FS_ERR_7: |
19 | case KSYS_FS_ERR_7: |
20 | case _KOS_FS_ERR_8: |
20 | case KSYS_FS_ERR_8: |
21 | case _KOS_FS_ERR_9: |
21 | case KSYS_FS_ERR_9: |
22 | case _KOS_FS_ERR_10: |
22 | case KSYS_FS_ERR_10: |
23 | case _KOS_FS_ERR_11: |
23 | case KSYS_FS_ERR_11: |
24 | default: |
24 | default: |
25 | // Just some IO error, who knows what exactly happened |
25 | // Just some IO error, who knows what exactly happened |
26 | errno = EIO; |
26 | errno = EIO; |
27 | stream->error = errno; |
27 | stream->error = errno; |
28 | break; |
28 | break; |
29 | } |
29 | } |
30 | return EOF; |
30 | return EOF; |
31 | } |
31 | } |
32 | 32 | ||
33 | stream->position++; |
33 | stream->position++; |
34 | return c; |
34 | return c; |
35 | } |
35 | } |