PatchworkOS
Loading...
Searching...
No Matches
puts.c
Go to the documentation of this file.
1#include <stdio.h>
2
3#include "user/common/file.h"
4
5int puts(const char* _RESTRICT s)
6{
8
10 {
12 return EOF;
13 }
14
15 while (*s != '\0')
16 {
17 stdout->buf[stdout->bufIndex++] = *s++;
18
20 {
22 {
24 return EOF;
25 }
26 }
27 }
28
29 stdout->buf[stdout->bufIndex++] = '\n';
30
32 {
35 return result == ERR ? EOF : 0;
36 }
37 else
38 {
40 return 0;
41 }
42}
#define ERR
Integer error value.
Definition ERR.h:17
#define _RESTRICT
Definition config.h:17
uint64_t _file_prepare_write(FILE *stream)
Definition file.c:239
uint64_t _file_flush_buffer(FILE *stream)
Definition file.c:158
int puts(const char *_RESTRICT s)
Definition puts.c:5
@ _FILE_UNBUFFERED
Definition file.h:18
@ _FILE_LINE_BUFFERED
Definition file.h:17
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
#define EOF
Definition stdio.h:25
FILE * stdout
Definition std_streams.c:17
uint8_t * buf
Definition file.h:37
uint64_t bufIndex
Definition file.h:39
uint64_t bufSize
Definition file.h:38
_file_flags_t flags
Definition file.h:44
mtx_t mtx
Definition file.h:45
_PUBLIC int mtx_lock(mtx_t *mtx)
Definition mtx_lock.c:11
_PUBLIC int mtx_unlock(mtx_t *mtx)
Definition mtx_unlock.c:10